push a9ea98eed33411fd355fd4e8b78f7880f1dd09a3
[wine/hacks.git] / dlls / msxml3 / msxml_private.h
blobae3a4e6cbd21e66588cd34e05dcdd722a09a7703
1 /*
2 * MSXML Class Factory
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 #ifdef HAVE_LIBXML2
34 #ifdef HAVE_LIBXML_PARSER_H
35 #include <libxml/parser.h>
36 #endif
38 /* constructors */
39 extern IUnknown *create_domdoc( xmlNodePtr document );
40 extern IUnknown *create_xmldoc( void );
41 extern IXMLDOMNode *create_node( xmlNodePtr node );
42 extern IUnknown *create_basic_node( xmlNodePtr node, IUnknown *pUnkOuter );
43 extern IUnknown *create_element( xmlNodePtr element, IUnknown *pUnkOuter );
44 extern IUnknown *create_attribute( xmlNodePtr attribute );
45 extern IUnknown *create_text( xmlNodePtr text );
46 extern IUnknown *create_pi( xmlNodePtr pi );
47 extern IUnknown *create_comment( xmlNodePtr comment );
48 extern IUnknown *create_cdata( xmlNodePtr text );
49 extern IXMLDOMNodeList *create_children_nodelist( xmlNodePtr );
50 extern IXMLDOMNamedNodeMap *create_nodemap( IXMLDOMNode *node );
51 extern IUnknown *create_doc_Implementation();
52 extern IUnknown *create_doc_fragment( xmlNodePtr fragment );
53 extern IUnknown *create_doc_entity_ref( xmlNodePtr entity );
55 extern HRESULT queryresult_create( xmlNodePtr, LPWSTR, IXMLDOMNodeList ** );
57 extern void attach_xmlnode( IXMLDOMNode *node, xmlNodePtr xmlnode );
59 /* data accessors */
60 xmlNodePtr xmlNodePtr_from_domnode( IXMLDOMNode *iface, xmlElementType type );
62 /* helpers */
63 extern xmlChar *xmlChar_from_wchar( LPWSTR str );
64 extern BSTR bstr_from_xmlChar( const xmlChar *buf );
66 extern LONG xmldoc_add_ref( xmlDocPtr doc );
67 extern LONG xmldoc_release( xmlDocPtr doc );
69 extern HRESULT XMLElement_create( IUnknown *pUnkOuter, xmlNodePtr node, LPVOID *ppObj );
70 extern HRESULT XMLElementCollection_create( IUnknown *pUnkOuter, xmlNodePtr node, LPVOID *ppObj );
72 extern xmlDocPtr parse_xml(char *ptr, int len);
74 /* IXMLDOMNode Internal Structure */
75 typedef struct _xmlnode
77 const struct IXMLDOMNodeVtbl *lpVtbl;
78 const struct IUnknownVtbl *lpInternalUnkVtbl;
79 IUnknown *pUnkOuter;
80 LONG ref;
81 xmlNodePtr node;
82 } xmlnode;
84 static inline xmlnode *impl_from_IXMLDOMNode( IXMLDOMNode *iface )
86 return (xmlnode *)((char*)iface - FIELD_OFFSET(xmlnode, lpVtbl));
89 extern HRESULT DOMDocument_create_from_xmldoc(xmlDocPtr xmldoc, IXMLDOMDocument2 **document);
91 #endif
93 extern IXMLDOMParseError *create_parseError( LONG code, BSTR url, BSTR reason, BSTR srcText,
94 LONG line, LONG linepos, LONG filepos );
95 extern HRESULT DOMDocument_create( IUnknown *pUnkOuter, LPVOID *ppObj );
96 extern HRESULT SchemaCache_create( IUnknown *pUnkOuter, LPVOID *ppObj );
97 extern HRESULT XMLDocument_create( IUnknown *pUnkOuter, LPVOID *ppObj );
98 extern HRESULT SAXXMLReader_create(IUnknown *pUnkOuter, LPVOID *ppObj );
100 typedef struct bsc_t bsc_t;
102 HRESULT bind_url(LPCWSTR, HRESULT (*onDataAvailable)(void*,char*,DWORD), void*, bsc_t**);
103 void detach_bsc(bsc_t*);
105 /* typelibs */
106 typedef enum tid_t {
107 IXMLDOMAttribute_tid,
108 IXMLDOMCDATASection_tid,
109 IXMLDOMComment_tid,
110 IXMLDOMDocument2_tid,
111 IXMLDOMDocumentFragment_tid,
112 IXMLDOMElement_tid,
113 IXMLDOMEntityReference_tid,
114 IXMLDOMImplementation_tid,
115 IXMLDOMNamedNodeMap_tid,
116 IXMLDOMNode_tid,
117 IXMLDOMNodeList_tid,
118 IXMLDOMParseError_tid,
119 IXMLDOMProcessingInstruction_tid,
120 IXMLDOMSchemaCollection_tid,
121 IXMLDOMText_tid,
122 IXMLElement_tid,
123 IXMLDocument_tid,
124 IVBSAXAttributes_tid,
125 IVBSAXContentHandler_tid,
126 IVBSAXDeclHandler_tid,
127 IVBSAXDTDHandler_tid,
128 IVBSAXEntityResolver_tid,
129 IVBSAXErrorHandler_tid,
130 IVBSAXLexicalHandler_tid,
131 IVBSAXLocator_tid,
132 IVBSAXXMLFilter_tid,
133 IVBSAXXMLReader_tid,
134 IMXAttributes_tid,
135 IMXReaderControl_tid,
136 IMXWriter_tid,
137 LAST_tid
138 } tid_t;
140 extern HRESULT get_typeinfo(tid_t tid, ITypeInfo **typeinfo);
141 extern void release_typelib(void);
143 typedef struct dispex_data_t dispex_data_t;
144 typedef struct dispex_dynamic_data_t dispex_dynamic_data_t;
146 #define MSXML_DISPID_CUSTOM_MIN 0x60000000
147 #define MSXML_DISPID_CUSTOM_MAX 0x6fffffff
149 typedef struct {
150 HRESULT (*get_dispid)(IUnknown*,BSTR,DWORD,DISPID*);
151 HRESULT (*invoke)(IUnknown*,DISPID,LCID,WORD,DISPPARAMS*,VARIANT*,EXCEPINFO*);
152 } dispex_static_data_vtbl_t;
154 typedef struct {
155 const dispex_static_data_vtbl_t *vtbl;
156 const tid_t disp_tid;
157 dispex_data_t *data;
158 const tid_t* const iface_tids;
159 } dispex_static_data_t;
161 typedef struct {
162 const IDispatchExVtbl *lpIDispatchExVtbl;
164 IUnknown *outer;
166 dispex_static_data_t *data;
167 dispex_dynamic_data_t *dynamic_data;
168 } DispatchEx;
170 void init_dispex(DispatchEx*,IUnknown*,dispex_static_data_t*);
171 BOOL dispex_query_interface(DispatchEx*,REFIID,void**);
173 /* memory allocation functions */
175 static inline void *heap_alloc(size_t len)
177 return HeapAlloc(GetProcessHeap(), 0, len);
180 static inline void *heap_alloc_zero(size_t len)
182 return HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len);
185 static inline void *heap_realloc(void *mem, size_t len)
187 return HeapReAlloc(GetProcessHeap(), 0, mem, len);
190 static inline BOOL heap_free(void *mem)
192 return HeapFree(GetProcessHeap(), 0, mem);
195 static inline LPWSTR heap_strdupW(LPCWSTR str)
197 LPWSTR ret = NULL;
199 if(str) {
200 DWORD size;
202 size = (strlenW(str)+1)*sizeof(WCHAR);
203 ret = heap_alloc(size);
204 memcpy(ret, str, size);
207 return ret;
210 #endif /* __MSXML_PRIVATE__ */