xcopy: Remove spaces before '\n's in the Korean translation.
[wine/hramrach.git] / dlls / msxml3 / msxml_private.h
blob5fbedf91b12ff14351422d450da7ea5c87581158
1 /*
2 * Common definitions
4 * Copyright 2005 Mike McCormack
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 #ifndef __MSXML_PRIVATE__
22 #define __MSXML_PRIVATE__
24 #include "dispex.h"
26 #include "wine/unicode.h"
28 #ifndef __WINE_CONFIG_H
29 # error You must include config.h to use this header
30 #endif
32 /* typelibs */
33 typedef enum tid_t {
34 IXMLDOMAttribute_tid,
35 IXMLDOMCDATASection_tid,
36 IXMLDOMComment_tid,
37 IXMLDOMDocument_tid,
38 IXMLDOMDocument2_tid,
39 IXMLDOMDocumentFragment_tid,
40 IXMLDOMElement_tid,
41 IXMLDOMEntityReference_tid,
42 IXMLDOMImplementation_tid,
43 IXMLDOMNamedNodeMap_tid,
44 IXMLDOMNode_tid,
45 IXMLDOMNodeList_tid,
46 IXMLDOMParseError_tid,
47 IXMLDOMProcessingInstruction_tid,
48 IXMLDOMSchemaCollection_tid,
49 IXMLDOMSelection_tid,
50 IXMLDOMText_tid,
51 IXMLElement_tid,
52 IXMLDocument_tid,
53 IXMLHTTPRequest_tid,
54 IVBSAXAttributes_tid,
55 IVBSAXContentHandler_tid,
56 IVBSAXDeclHandler_tid,
57 IVBSAXDTDHandler_tid,
58 IVBSAXEntityResolver_tid,
59 IVBSAXErrorHandler_tid,
60 IVBSAXLexicalHandler_tid,
61 IVBSAXLocator_tid,
62 IVBSAXXMLFilter_tid,
63 IVBSAXXMLReader_tid,
64 IMXAttributes_tid,
65 IMXReaderControl_tid,
66 IMXWriter_tid,
67 LAST_tid
68 } tid_t;
70 extern HRESULT get_typeinfo(tid_t tid, ITypeInfo **typeinfo);
71 extern void release_typelib(void);
73 typedef struct dispex_data_t dispex_data_t;
74 typedef struct dispex_dynamic_data_t dispex_dynamic_data_t;
76 #define MSXML_DISPID_CUSTOM_MIN 0x60000000
77 #define MSXML_DISPID_CUSTOM_MAX 0x6fffffff
79 typedef struct {
80 HRESULT (*get_dispid)(IUnknown*,BSTR,DWORD,DISPID*);
81 HRESULT (*invoke)(IUnknown*,DISPID,LCID,WORD,DISPPARAMS*,VARIANT*,EXCEPINFO*);
82 } dispex_static_data_vtbl_t;
84 typedef struct {
85 const dispex_static_data_vtbl_t *vtbl;
86 const tid_t disp_tid;
87 dispex_data_t *data;
88 const tid_t* const iface_tids;
89 } dispex_static_data_t;
91 typedef struct {
92 const IDispatchExVtbl *lpIDispatchExVtbl;
94 IUnknown *outer;
96 dispex_static_data_t *data;
97 dispex_dynamic_data_t *dynamic_data;
98 } DispatchEx;
100 void init_dispex(DispatchEx*,IUnknown*,dispex_static_data_t*);
101 BOOL dispex_query_interface(DispatchEx*,REFIID,void**);
103 #ifdef HAVE_LIBXML2
105 #ifdef HAVE_LIBXML_PARSER_H
106 #include <libxml/parser.h>
107 #endif
109 /* constructors */
110 extern IUnknown *create_domdoc( xmlNodePtr document );
111 extern IUnknown *create_xmldoc( void );
112 extern IXMLDOMNode *create_node( xmlNodePtr node );
113 extern IUnknown *create_element( xmlNodePtr element );
114 extern IUnknown *create_attribute( xmlNodePtr attribute );
115 extern IUnknown *create_text( xmlNodePtr text );
116 extern IUnknown *create_pi( xmlNodePtr pi );
117 extern IUnknown *create_comment( xmlNodePtr comment );
118 extern IUnknown *create_cdata( xmlNodePtr text );
119 extern IXMLDOMNodeList *create_children_nodelist( xmlNodePtr );
120 extern IXMLDOMNamedNodeMap *create_nodemap( IXMLDOMNode *node );
121 extern IUnknown *create_doc_Implementation(void);
122 extern IUnknown *create_doc_fragment( xmlNodePtr fragment );
123 extern IUnknown *create_doc_entity_ref( xmlNodePtr entity );
125 extern HRESULT queryresult_create( xmlNodePtr, LPWSTR, IXMLDOMNodeList ** );
127 /* data accessors */
128 xmlNodePtr xmlNodePtr_from_domnode( IXMLDOMNode *iface, xmlElementType type );
130 /* helpers */
131 extern xmlChar *xmlChar_from_wchar( LPWSTR str );
133 extern LONG xmldoc_add_ref( xmlDocPtr doc );
134 extern LONG xmldoc_release( xmlDocPtr doc );
135 extern HRESULT xmldoc_add_orphan( xmlDocPtr doc, xmlNodePtr node );
136 extern HRESULT xmldoc_remove_orphan( xmlDocPtr doc, xmlNodePtr node );
137 extern void xmldoc_link_xmldecl(xmlDocPtr doc, xmlNodePtr node);
138 extern xmlNodePtr xmldoc_unlink_xmldecl(xmlDocPtr doc);
140 extern HRESULT XMLElement_create( IUnknown *pUnkOuter, xmlNodePtr node, LPVOID *ppObj, BOOL own );
143 /* IXMLDOMNode Internal Structure */
144 typedef struct _xmlnode
146 DispatchEx dispex;
147 const struct IXMLDOMNodeVtbl *lpVtbl;
148 IUnknown *pUnkOuter;
149 LONG ref;
150 xmlNodePtr node;
151 } xmlnode;
153 static inline xmlnode *impl_from_IXMLDOMNode( IXMLDOMNode *iface )
155 return (xmlnode *)((char*)iface - FIELD_OFFSET(xmlnode, lpVtbl));
158 static inline IXMLDOMNode *IXMLDOMNode_from_impl(xmlnode *This)
160 return (IXMLDOMNode*)&This->lpVtbl;
163 extern void init_xmlnode(xmlnode*,xmlNodePtr,IUnknown*,dispex_static_data_t*);
164 extern void destroy_xmlnode(xmlnode*);
166 extern HRESULT DOMDocument_create_from_xmldoc(xmlDocPtr xmldoc, IXMLDOMDocument2 **document);
168 static inline BSTR bstr_from_xmlChar(const xmlChar *str)
170 BSTR ret = NULL;
172 if(str) {
173 DWORD len = MultiByteToWideChar(CP_UTF8, 0, (LPCSTR)str, -1, NULL, 0);
174 ret = SysAllocStringLen(NULL, len-1);
175 if(ret)
176 MultiByteToWideChar( CP_UTF8, 0, (LPCSTR)str, -1, ret, len);
178 else
179 ret = SysAllocStringLen(NULL, 0);
181 return ret;
184 #endif
186 void* libxslt_handle;
187 #ifdef SONAME_LIBXSLT
188 # ifdef HAVE_LIBXSLT_PATTERN_H
189 # include <libxslt/pattern.h>
190 # endif
191 # ifdef HAVE_LIBXSLT_TRANSFORM_H
192 # include <libxslt/transform.h>
193 # endif
194 # include <libxslt/xsltutils.h>
195 # include <libxslt/xsltInternals.h>
197 # define MAKE_FUNCPTR(f) extern typeof(f) * p##f
198 MAKE_FUNCPTR(xsltApplyStylesheet);
199 MAKE_FUNCPTR(xsltCleanupGlobals);
200 MAKE_FUNCPTR(xsltFreeStylesheet);
201 MAKE_FUNCPTR(xsltParseStylesheetDoc);
202 # undef MAKE_FUNCPTR
203 #endif
205 extern IXMLDOMParseError *create_parseError( LONG code, BSTR url, BSTR reason, BSTR srcText,
206 LONG line, LONG linepos, LONG filepos );
207 extern HRESULT DOMDocument_create( IUnknown *pUnkOuter, LPVOID *ppObj );
208 extern HRESULT SchemaCache_create( IUnknown *pUnkOuter, LPVOID *ppObj );
209 extern HRESULT XMLDocument_create( IUnknown *pUnkOuter, LPVOID *ppObj );
210 extern HRESULT SAXXMLReader_create(IUnknown *pUnkOuter, LPVOID *ppObj );
211 extern HRESULT XMLHTTPRequest_create(IUnknown *pUnkOuter, LPVOID *ppObj);
213 typedef struct bsc_t bsc_t;
215 HRESULT bind_url(LPCWSTR, HRESULT (*onDataAvailable)(void*,char*,DWORD), void*, bsc_t**);
216 void detach_bsc(bsc_t*);
218 /* memory allocation functions */
220 static inline void *heap_alloc(size_t len)
222 return HeapAlloc(GetProcessHeap(), 0, len);
225 static inline void *heap_alloc_zero(size_t len)
227 return HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len);
230 static inline void *heap_realloc(void *mem, size_t len)
232 return HeapReAlloc(GetProcessHeap(), 0, mem, len);
235 static inline BOOL heap_free(void *mem)
237 return HeapFree(GetProcessHeap(), 0, mem);
240 static inline LPWSTR heap_strdupW(LPCWSTR str)
242 LPWSTR ret = NULL;
244 if(str) {
245 DWORD size;
247 size = (strlenW(str)+1)*sizeof(WCHAR);
248 ret = heap_alloc(size);
249 memcpy(ret, str, size);
252 return ret;
255 #endif /* __MSXML_PRIVATE__ */