msi: Create macro functions to set feature and component states.
[wine.git] / dlls / msxml3 / comment.c
blob4515dbda6fbc979eb81d4fcb18bf690cfcd9de64
1 /*
2 * DOM comment node implementation
4 * Copyright 2006 Huw Davies
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 #define COBJMACROS
23 #include "config.h"
25 #include <stdarg.h>
26 #include "windef.h"
27 #include "winbase.h"
28 #include "winuser.h"
29 #include "ole2.h"
30 #include "msxml2.h"
32 #include "msxml_private.h"
34 #include "wine/debug.h"
36 WINE_DEFAULT_DEBUG_CHANNEL(msxml);
38 #ifdef HAVE_LIBXML2
40 typedef struct _domcomment
42 const struct IXMLDOMCommentVtbl *lpVtbl;
43 LONG ref;
44 IUnknown *node_unk;
45 IXMLDOMNode *node;
46 } domcomment;
48 static inline domcomment *impl_from_IXMLDOMComment( IXMLDOMComment *iface )
50 return (domcomment *)((char*)iface - FIELD_OFFSET(domcomment, lpVtbl));
53 static inline xmlNodePtr get_comment( domcomment *This )
55 return xmlNodePtr_from_domnode( This->node, XML_COMMENT_NODE );
58 static HRESULT WINAPI domcomment_QueryInterface(
59 IXMLDOMComment *iface,
60 REFIID riid,
61 void** ppvObject )
63 domcomment *This = impl_from_IXMLDOMComment( iface );
64 TRACE("%p %s %p\n", This, debugstr_guid(riid), ppvObject);
66 if ( IsEqualGUID( riid, &IID_IXMLDOMComment ) ||
67 IsEqualGUID( riid, &IID_IUnknown ) )
69 *ppvObject = iface;
71 else if ( IsEqualGUID( riid, &IID_IDispatch ) ||
72 IsEqualGUID( riid, &IID_IXMLDOMNode ) )
74 return IUnknown_QueryInterface(This->node_unk, riid, ppvObject);
76 else
78 FIXME("Unsupported inteferace %s\n", debugstr_guid(riid));
79 return E_NOINTERFACE;
82 IXMLDOMComment_AddRef( iface );
84 return S_OK;
87 static ULONG WINAPI domcomment_AddRef(
88 IXMLDOMComment *iface )
90 domcomment *This = impl_from_IXMLDOMComment( iface );
91 return InterlockedIncrement( &This->ref );
94 static ULONG WINAPI domcomment_Release(
95 IXMLDOMComment *iface )
97 domcomment *This = impl_from_IXMLDOMComment( iface );
98 ULONG ref;
100 ref = InterlockedDecrement( &This->ref );
101 if ( ref == 0 )
103 IUnknown_Release( This->node_unk );
104 HeapFree( GetProcessHeap(), 0, This );
107 return ref;
110 static HRESULT WINAPI domcomment_GetTypeInfoCount(
111 IXMLDOMComment *iface,
112 UINT* pctinfo )
114 FIXME("\n");
115 return E_NOTIMPL;
118 static HRESULT WINAPI domcomment_GetTypeInfo(
119 IXMLDOMComment *iface,
120 UINT iTInfo, LCID lcid,
121 ITypeInfo** ppTInfo )
123 FIXME("\n");
124 return E_NOTIMPL;
127 static HRESULT WINAPI domcomment_GetIDsOfNames(
128 IXMLDOMComment *iface,
129 REFIID riid, LPOLESTR* rgszNames,
130 UINT cNames, LCID lcid, DISPID* rgDispId )
132 FIXME("\n");
133 return E_NOTIMPL;
136 static HRESULT WINAPI domcomment_Invoke(
137 IXMLDOMComment *iface,
138 DISPID dispIdMember, REFIID riid, LCID lcid,
139 WORD wFlags, DISPPARAMS* pDispParams, VARIANT* pVarResult,
140 EXCEPINFO* pExcepInfo, UINT* puArgErr )
142 FIXME("\n");
143 return E_NOTIMPL;
146 static HRESULT WINAPI domcomment_get_nodeName(
147 IXMLDOMComment *iface,
148 BSTR* p )
150 domcomment *This = impl_from_IXMLDOMComment( iface );
151 return IXMLDOMNode_get_nodeName( This->node, p );
154 static HRESULT WINAPI domcomment_get_nodeValue(
155 IXMLDOMComment *iface,
156 VARIANT* var1 )
158 domcomment *This = impl_from_IXMLDOMComment( iface );
159 return IXMLDOMNode_get_nodeValue( This->node, var1 );
162 static HRESULT WINAPI domcomment_put_nodeValue(
163 IXMLDOMComment *iface,
164 VARIANT var1 )
166 domcomment *This = impl_from_IXMLDOMComment( iface );
167 return IXMLDOMNode_put_nodeValue( This->node, var1 );
170 static HRESULT WINAPI domcomment_get_nodeType(
171 IXMLDOMComment *iface,
172 DOMNodeType* domNodeType )
174 domcomment *This = impl_from_IXMLDOMComment( iface );
175 return IXMLDOMNode_get_nodeType( This->node, domNodeType );
178 static HRESULT WINAPI domcomment_get_parentNode(
179 IXMLDOMComment *iface,
180 IXMLDOMNode** parent )
182 domcomment *This = impl_from_IXMLDOMComment( iface );
183 return IXMLDOMNode_get_parentNode( This->node, parent );
186 static HRESULT WINAPI domcomment_get_childNodes(
187 IXMLDOMComment *iface,
188 IXMLDOMNodeList** outList)
190 domcomment *This = impl_from_IXMLDOMComment( iface );
191 return IXMLDOMNode_get_childNodes( This->node, outList );
194 static HRESULT WINAPI domcomment_get_firstChild(
195 IXMLDOMComment *iface,
196 IXMLDOMNode** domNode)
198 domcomment *This = impl_from_IXMLDOMComment( iface );
199 return IXMLDOMNode_get_firstChild( This->node, domNode );
202 static HRESULT WINAPI domcomment_get_lastChild(
203 IXMLDOMComment *iface,
204 IXMLDOMNode** domNode)
206 domcomment *This = impl_from_IXMLDOMComment( iface );
207 return IXMLDOMNode_get_lastChild( This->node, domNode );
210 static HRESULT WINAPI domcomment_get_previousSibling(
211 IXMLDOMComment *iface,
212 IXMLDOMNode** domNode)
214 domcomment *This = impl_from_IXMLDOMComment( iface );
215 return IXMLDOMNode_get_previousSibling( This->node, domNode );
218 static HRESULT WINAPI domcomment_get_nextSibling(
219 IXMLDOMComment *iface,
220 IXMLDOMNode** domNode)
222 domcomment *This = impl_from_IXMLDOMComment( iface );
223 return IXMLDOMNode_get_nextSibling( This->node, domNode );
226 static HRESULT WINAPI domcomment_get_attributes(
227 IXMLDOMComment *iface,
228 IXMLDOMNamedNodeMap** attributeMap)
230 domcomment *This = impl_from_IXMLDOMComment( iface );
231 return IXMLDOMNode_get_attributes( This->node, attributeMap );
234 static HRESULT WINAPI domcomment_insertBefore(
235 IXMLDOMComment *iface,
236 IXMLDOMNode* newNode, VARIANT var1,
237 IXMLDOMNode** outOldNode)
239 domcomment *This = impl_from_IXMLDOMComment( iface );
240 return IXMLDOMNode_insertBefore( This->node, newNode, var1, outOldNode );
243 static HRESULT WINAPI domcomment_replaceChild(
244 IXMLDOMComment *iface,
245 IXMLDOMNode* newNode,
246 IXMLDOMNode* oldNode,
247 IXMLDOMNode** outOldNode)
249 domcomment *This = impl_from_IXMLDOMComment( iface );
250 return IXMLDOMNode_replaceChild( This->node, newNode, oldNode, outOldNode );
253 static HRESULT WINAPI domcomment_removeChild(
254 IXMLDOMComment *iface,
255 IXMLDOMNode* domNode, IXMLDOMNode** oldNode)
257 domcomment *This = impl_from_IXMLDOMComment( iface );
258 return IXMLDOMNode_removeChild( This->node, domNode, oldNode );
261 static HRESULT WINAPI domcomment_appendChild(
262 IXMLDOMComment *iface,
263 IXMLDOMNode* newNode, IXMLDOMNode** outNewNode)
265 domcomment *This = impl_from_IXMLDOMComment( iface );
266 return IXMLDOMNode_appendChild( This->node, newNode, outNewNode );
269 static HRESULT WINAPI domcomment_hasChildNodes(
270 IXMLDOMComment *iface,
271 VARIANT_BOOL* pbool)
273 domcomment *This = impl_from_IXMLDOMComment( iface );
274 return IXMLDOMNode_hasChildNodes( This->node, pbool );
277 static HRESULT WINAPI domcomment_get_ownerDocument(
278 IXMLDOMComment *iface,
279 IXMLDOMDocument** domDocument)
281 domcomment *This = impl_from_IXMLDOMComment( iface );
282 return IXMLDOMNode_get_ownerDocument( This->node, domDocument );
285 static HRESULT WINAPI domcomment_cloneNode(
286 IXMLDOMComment *iface,
287 VARIANT_BOOL pbool, IXMLDOMNode** outNode)
289 domcomment *This = impl_from_IXMLDOMComment( iface );
290 return IXMLDOMNode_cloneNode( This->node, pbool, outNode );
293 static HRESULT WINAPI domcomment_get_nodeTypeString(
294 IXMLDOMComment *iface,
295 BSTR* p)
297 domcomment *This = impl_from_IXMLDOMComment( iface );
298 return IXMLDOMNode_get_nodeTypeString( This->node, p );
301 static HRESULT WINAPI domcomment_get_text(
302 IXMLDOMComment *iface,
303 BSTR* p)
305 domcomment *This = impl_from_IXMLDOMComment( iface );
306 return IXMLDOMNode_get_text( This->node, p );
309 static HRESULT WINAPI domcomment_put_text(
310 IXMLDOMComment *iface,
311 BSTR p)
313 domcomment *This = impl_from_IXMLDOMComment( iface );
314 return IXMLDOMNode_put_text( This->node, p );
317 static HRESULT WINAPI domcomment_get_specified(
318 IXMLDOMComment *iface,
319 VARIANT_BOOL* pbool)
321 domcomment *This = impl_from_IXMLDOMComment( iface );
322 return IXMLDOMNode_get_specified( This->node, pbool );
325 static HRESULT WINAPI domcomment_get_definition(
326 IXMLDOMComment *iface,
327 IXMLDOMNode** domNode)
329 domcomment *This = impl_from_IXMLDOMComment( iface );
330 return IXMLDOMNode_get_definition( This->node, domNode );
333 static HRESULT WINAPI domcomment_get_nodeTypedValue(
334 IXMLDOMComment *iface,
335 VARIANT* var1)
337 domcomment *This = impl_from_IXMLDOMComment( iface );
338 return IXMLDOMNode_get_nodeTypedValue( This->node, var1 );
341 static HRESULT WINAPI domcomment_put_nodeTypedValue(
342 IXMLDOMComment *iface,
343 VARIANT var1)
345 domcomment *This = impl_from_IXMLDOMComment( iface );
346 return IXMLDOMNode_put_nodeTypedValue( This->node, var1 );
349 static HRESULT WINAPI domcomment_get_dataType(
350 IXMLDOMComment *iface,
351 VARIANT* var1)
353 domcomment *This = impl_from_IXMLDOMComment( iface );
354 return IXMLDOMNode_get_dataType( This->node, var1 );
357 static HRESULT WINAPI domcomment_put_dataType(
358 IXMLDOMComment *iface,
359 BSTR p)
361 domcomment *This = impl_from_IXMLDOMComment( iface );
362 return IXMLDOMNode_put_dataType( This->node, p );
365 static HRESULT WINAPI domcomment_get_xml(
366 IXMLDOMComment *iface,
367 BSTR* p)
369 domcomment *This = impl_from_IXMLDOMComment( iface );
370 return IXMLDOMNode_get_xml( This->node, p );
373 static HRESULT WINAPI domcomment_transformNode(
374 IXMLDOMComment *iface,
375 IXMLDOMNode* domNode, BSTR* p)
377 domcomment *This = impl_from_IXMLDOMComment( iface );
378 return IXMLDOMNode_transformNode( This->node, domNode, p );
381 static HRESULT WINAPI domcomment_selectNodes(
382 IXMLDOMComment *iface,
383 BSTR p, IXMLDOMNodeList** outList)
385 domcomment *This = impl_from_IXMLDOMComment( iface );
386 return IXMLDOMNode_selectNodes( This->node, p, outList );
389 static HRESULT WINAPI domcomment_selectSingleNode(
390 IXMLDOMComment *iface,
391 BSTR p, IXMLDOMNode** outNode)
393 domcomment *This = impl_from_IXMLDOMComment( iface );
394 return IXMLDOMNode_selectSingleNode( This->node, p, outNode );
397 static HRESULT WINAPI domcomment_get_parsed(
398 IXMLDOMComment *iface,
399 VARIANT_BOOL* pbool)
401 domcomment *This = impl_from_IXMLDOMComment( iface );
402 return IXMLDOMNode_get_parsed( This->node, pbool );
405 static HRESULT WINAPI domcomment_get_namespaceURI(
406 IXMLDOMComment *iface,
407 BSTR* p)
409 domcomment *This = impl_from_IXMLDOMComment( iface );
410 return IXMLDOMNode_get_namespaceURI( This->node, p );
413 static HRESULT WINAPI domcomment_get_prefix(
414 IXMLDOMComment *iface,
415 BSTR* p)
417 domcomment *This = impl_from_IXMLDOMComment( iface );
418 return IXMLDOMNode_get_prefix( This->node, p );
421 static HRESULT WINAPI domcomment_get_baseName(
422 IXMLDOMComment *iface,
423 BSTR* p)
425 domcomment *This = impl_from_IXMLDOMComment( iface );
426 return IXMLDOMNode_get_baseName( This->node, p );
429 static HRESULT WINAPI domcomment_transformNodeToObject(
430 IXMLDOMComment *iface,
431 IXMLDOMNode* domNode, VARIANT var1)
433 domcomment *This = impl_from_IXMLDOMComment( iface );
434 return IXMLDOMNode_transformNodeToObject( This->node, domNode, var1 );
437 static HRESULT WINAPI domcomment_get_data(
438 IXMLDOMComment *iface,
439 BSTR *p)
441 FIXME("\n");
442 return E_NOTIMPL;
445 static HRESULT WINAPI domcomment_put_data(
446 IXMLDOMComment *iface,
447 BSTR data)
449 FIXME("\n");
450 return E_NOTIMPL;
453 static HRESULT WINAPI domcomment_get_length(
454 IXMLDOMComment *iface,
455 long *len)
457 FIXME("\n");
458 return E_NOTIMPL;
461 static HRESULT WINAPI domcomment_substringData(
462 IXMLDOMComment *iface,
463 long offset, long count, BSTR *p)
465 FIXME("\n");
466 return E_NOTIMPL;
469 static HRESULT WINAPI domcomment_appendData(
470 IXMLDOMComment *iface,
471 BSTR p)
473 FIXME("\n");
474 return E_NOTIMPL;
477 static HRESULT WINAPI domcomment_insertData(
478 IXMLDOMComment *iface,
479 long offset, BSTR p)
481 FIXME("\n");
482 return E_NOTIMPL;
485 static HRESULT WINAPI domcomment_deleteData(
486 IXMLDOMComment *iface,
487 long offset, long count)
489 FIXME("\n");
490 return E_NOTIMPL;
493 static HRESULT WINAPI domcomment_replaceData(
494 IXMLDOMComment *iface,
495 long offset, long count, BSTR p)
497 FIXME("\n");
498 return E_NOTIMPL;
501 static const struct IXMLDOMCommentVtbl domcomment_vtbl =
503 domcomment_QueryInterface,
504 domcomment_AddRef,
505 domcomment_Release,
506 domcomment_GetTypeInfoCount,
507 domcomment_GetTypeInfo,
508 domcomment_GetIDsOfNames,
509 domcomment_Invoke,
510 domcomment_get_nodeName,
511 domcomment_get_nodeValue,
512 domcomment_put_nodeValue,
513 domcomment_get_nodeType,
514 domcomment_get_parentNode,
515 domcomment_get_childNodes,
516 domcomment_get_firstChild,
517 domcomment_get_lastChild,
518 domcomment_get_previousSibling,
519 domcomment_get_nextSibling,
520 domcomment_get_attributes,
521 domcomment_insertBefore,
522 domcomment_replaceChild,
523 domcomment_removeChild,
524 domcomment_appendChild,
525 domcomment_hasChildNodes,
526 domcomment_get_ownerDocument,
527 domcomment_cloneNode,
528 domcomment_get_nodeTypeString,
529 domcomment_get_text,
530 domcomment_put_text,
531 domcomment_get_specified,
532 domcomment_get_definition,
533 domcomment_get_nodeTypedValue,
534 domcomment_put_nodeTypedValue,
535 domcomment_get_dataType,
536 domcomment_put_dataType,
537 domcomment_get_xml,
538 domcomment_transformNode,
539 domcomment_selectNodes,
540 domcomment_selectSingleNode,
541 domcomment_get_parsed,
542 domcomment_get_namespaceURI,
543 domcomment_get_prefix,
544 domcomment_get_baseName,
545 domcomment_transformNodeToObject,
546 domcomment_get_data,
547 domcomment_put_data,
548 domcomment_get_length,
549 domcomment_substringData,
550 domcomment_appendData,
551 domcomment_insertData,
552 domcomment_deleteData,
553 domcomment_replaceData
556 IUnknown* create_comment( xmlNodePtr comment )
558 domcomment *This;
559 HRESULT hr;
561 This = HeapAlloc( GetProcessHeap(), 0, sizeof *This );
562 if ( !This )
563 return NULL;
565 This->lpVtbl = &domcomment_vtbl;
566 This->ref = 1;
568 This->node_unk = create_basic_node( comment, (IUnknown*)&This->lpVtbl );
569 if(!This->node_unk)
571 HeapFree(GetProcessHeap(), 0, This);
572 return NULL;
575 hr = IUnknown_QueryInterface(This->node_unk, &IID_IXMLDOMNode, (LPVOID*)&This->node);
576 if(FAILED(hr))
578 IUnknown_Release(This->node_unk);
579 HeapFree( GetProcessHeap(), 0, This );
580 return NULL;
582 /* The ref on This->node is actually looped back into this object, so release it */
583 IXMLDOMNode_Release(This->node);
585 return (IUnknown*) &This->lpVtbl;
588 #endif