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
32 #include "msxml_private.h"
34 #include "wine/debug.h"
36 WINE_DEFAULT_DEBUG_CHANNEL(msxml
);
40 typedef struct _domcomment
42 const struct IXMLDOMCommentVtbl
*lpVtbl
;
48 static inline domcomment
*impl_from_IXMLDOMComment( IXMLDOMComment
*iface
)
50 return (domcomment
*)((char*)iface
- FIELD_OFFSET(domcomment
, lpVtbl
));
53 static HRESULT WINAPI
domcomment_QueryInterface(
54 IXMLDOMComment
*iface
,
58 domcomment
*This
= impl_from_IXMLDOMComment( iface
);
59 TRACE("%p %s %p\n", This
, debugstr_guid(riid
), ppvObject
);
61 if ( IsEqualGUID( riid
, &IID_IXMLDOMComment
) ||
62 IsEqualGUID( riid
, &IID_IUnknown
) )
66 else if ( IsEqualGUID( riid
, &IID_IDispatch
) ||
67 IsEqualGUID( riid
, &IID_IXMLDOMNode
) )
69 return IUnknown_QueryInterface(This
->node_unk
, riid
, ppvObject
);
73 FIXME("Unsupported inteferace %s\n", debugstr_guid(riid
));
77 IXMLDOMComment_AddRef( iface
);
82 static ULONG WINAPI
domcomment_AddRef(
83 IXMLDOMComment
*iface
)
85 domcomment
*This
= impl_from_IXMLDOMComment( iface
);
86 return InterlockedIncrement( &This
->ref
);
89 static ULONG WINAPI
domcomment_Release(
90 IXMLDOMComment
*iface
)
92 domcomment
*This
= impl_from_IXMLDOMComment( iface
);
95 ref
= InterlockedDecrement( &This
->ref
);
98 IUnknown_Release( This
->node_unk
);
99 HeapFree( GetProcessHeap(), 0, This
);
105 static HRESULT WINAPI
domcomment_GetTypeInfoCount(
106 IXMLDOMComment
*iface
,
113 static HRESULT WINAPI
domcomment_GetTypeInfo(
114 IXMLDOMComment
*iface
,
115 UINT iTInfo
, LCID lcid
,
116 ITypeInfo
** ppTInfo
)
122 static HRESULT WINAPI
domcomment_GetIDsOfNames(
123 IXMLDOMComment
*iface
,
124 REFIID riid
, LPOLESTR
* rgszNames
,
125 UINT cNames
, LCID lcid
, DISPID
* rgDispId
)
131 static HRESULT WINAPI
domcomment_Invoke(
132 IXMLDOMComment
*iface
,
133 DISPID dispIdMember
, REFIID riid
, LCID lcid
,
134 WORD wFlags
, DISPPARAMS
* pDispParams
, VARIANT
* pVarResult
,
135 EXCEPINFO
* pExcepInfo
, UINT
* puArgErr
)
141 static HRESULT WINAPI
domcomment_get_nodeName(
142 IXMLDOMComment
*iface
,
145 domcomment
*This
= impl_from_IXMLDOMComment( iface
);
146 return IXMLDOMNode_get_nodeName( This
->node
, p
);
149 static HRESULT WINAPI
domcomment_get_nodeValue(
150 IXMLDOMComment
*iface
,
153 domcomment
*This
= impl_from_IXMLDOMComment( iface
);
154 return IXMLDOMNode_get_nodeValue( This
->node
, var1
);
157 static HRESULT WINAPI
domcomment_put_nodeValue(
158 IXMLDOMComment
*iface
,
161 domcomment
*This
= impl_from_IXMLDOMComment( iface
);
162 return IXMLDOMNode_put_nodeValue( This
->node
, var1
);
165 static HRESULT WINAPI
domcomment_get_nodeType(
166 IXMLDOMComment
*iface
,
167 DOMNodeType
* domNodeType
)
169 domcomment
*This
= impl_from_IXMLDOMComment( iface
);
170 return IXMLDOMNode_get_nodeType( This
->node
, domNodeType
);
173 static HRESULT WINAPI
domcomment_get_parentNode(
174 IXMLDOMComment
*iface
,
175 IXMLDOMNode
** parent
)
177 domcomment
*This
= impl_from_IXMLDOMComment( iface
);
178 return IXMLDOMNode_get_parentNode( This
->node
, parent
);
181 static HRESULT WINAPI
domcomment_get_childNodes(
182 IXMLDOMComment
*iface
,
183 IXMLDOMNodeList
** outList
)
185 domcomment
*This
= impl_from_IXMLDOMComment( iface
);
186 return IXMLDOMNode_get_childNodes( This
->node
, outList
);
189 static HRESULT WINAPI
domcomment_get_firstChild(
190 IXMLDOMComment
*iface
,
191 IXMLDOMNode
** domNode
)
193 domcomment
*This
= impl_from_IXMLDOMComment( iface
);
194 return IXMLDOMNode_get_firstChild( This
->node
, domNode
);
197 static HRESULT WINAPI
domcomment_get_lastChild(
198 IXMLDOMComment
*iface
,
199 IXMLDOMNode
** domNode
)
201 domcomment
*This
= impl_from_IXMLDOMComment( iface
);
202 return IXMLDOMNode_get_lastChild( This
->node
, domNode
);
205 static HRESULT WINAPI
domcomment_get_previousSibling(
206 IXMLDOMComment
*iface
,
207 IXMLDOMNode
** domNode
)
209 domcomment
*This
= impl_from_IXMLDOMComment( iface
);
210 return IXMLDOMNode_get_previousSibling( This
->node
, domNode
);
213 static HRESULT WINAPI
domcomment_get_nextSibling(
214 IXMLDOMComment
*iface
,
215 IXMLDOMNode
** domNode
)
217 domcomment
*This
= impl_from_IXMLDOMComment( iface
);
218 return IXMLDOMNode_get_nextSibling( This
->node
, domNode
);
221 static HRESULT WINAPI
domcomment_get_attributes(
222 IXMLDOMComment
*iface
,
223 IXMLDOMNamedNodeMap
** attributeMap
)
225 domcomment
*This
= impl_from_IXMLDOMComment( iface
);
226 return IXMLDOMNode_get_attributes( This
->node
, attributeMap
);
229 static HRESULT WINAPI
domcomment_insertBefore(
230 IXMLDOMComment
*iface
,
231 IXMLDOMNode
* newNode
, VARIANT var1
,
232 IXMLDOMNode
** outOldNode
)
234 domcomment
*This
= impl_from_IXMLDOMComment( iface
);
235 return IXMLDOMNode_insertBefore( This
->node
, newNode
, var1
, outOldNode
);
238 static HRESULT WINAPI
domcomment_replaceChild(
239 IXMLDOMComment
*iface
,
240 IXMLDOMNode
* newNode
,
241 IXMLDOMNode
* oldNode
,
242 IXMLDOMNode
** outOldNode
)
244 domcomment
*This
= impl_from_IXMLDOMComment( iface
);
245 return IXMLDOMNode_replaceChild( This
->node
, newNode
, oldNode
, outOldNode
);
248 static HRESULT WINAPI
domcomment_removeChild(
249 IXMLDOMComment
*iface
,
250 IXMLDOMNode
* domNode
, IXMLDOMNode
** oldNode
)
252 domcomment
*This
= impl_from_IXMLDOMComment( iface
);
253 return IXMLDOMNode_removeChild( This
->node
, domNode
, oldNode
);
256 static HRESULT WINAPI
domcomment_appendChild(
257 IXMLDOMComment
*iface
,
258 IXMLDOMNode
* newNode
, IXMLDOMNode
** outNewNode
)
260 domcomment
*This
= impl_from_IXMLDOMComment( iface
);
261 return IXMLDOMNode_appendChild( This
->node
, newNode
, outNewNode
);
264 static HRESULT WINAPI
domcomment_hasChildNodes(
265 IXMLDOMComment
*iface
,
268 domcomment
*This
= impl_from_IXMLDOMComment( iface
);
269 return IXMLDOMNode_hasChildNodes( This
->node
, pbool
);
272 static HRESULT WINAPI
domcomment_get_ownerDocument(
273 IXMLDOMComment
*iface
,
274 IXMLDOMDocument
** domDocument
)
276 domcomment
*This
= impl_from_IXMLDOMComment( iface
);
277 return IXMLDOMNode_get_ownerDocument( This
->node
, domDocument
);
280 static HRESULT WINAPI
domcomment_cloneNode(
281 IXMLDOMComment
*iface
,
282 VARIANT_BOOL pbool
, IXMLDOMNode
** outNode
)
284 domcomment
*This
= impl_from_IXMLDOMComment( iface
);
285 return IXMLDOMNode_cloneNode( This
->node
, pbool
, outNode
);
288 static HRESULT WINAPI
domcomment_get_nodeTypeString(
289 IXMLDOMComment
*iface
,
292 domcomment
*This
= impl_from_IXMLDOMComment( iface
);
293 return IXMLDOMNode_get_nodeTypeString( This
->node
, p
);
296 static HRESULT WINAPI
domcomment_get_text(
297 IXMLDOMComment
*iface
,
300 domcomment
*This
= impl_from_IXMLDOMComment( iface
);
301 return IXMLDOMNode_get_text( This
->node
, p
);
304 static HRESULT WINAPI
domcomment_put_text(
305 IXMLDOMComment
*iface
,
308 domcomment
*This
= impl_from_IXMLDOMComment( iface
);
309 return IXMLDOMNode_put_text( This
->node
, p
);
312 static HRESULT WINAPI
domcomment_get_specified(
313 IXMLDOMComment
*iface
,
316 domcomment
*This
= impl_from_IXMLDOMComment( iface
);
317 return IXMLDOMNode_get_specified( This
->node
, pbool
);
320 static HRESULT WINAPI
domcomment_get_definition(
321 IXMLDOMComment
*iface
,
322 IXMLDOMNode
** domNode
)
324 domcomment
*This
= impl_from_IXMLDOMComment( iface
);
325 return IXMLDOMNode_get_definition( This
->node
, domNode
);
328 static HRESULT WINAPI
domcomment_get_nodeTypedValue(
329 IXMLDOMComment
*iface
,
332 domcomment
*This
= impl_from_IXMLDOMComment( iface
);
333 return IXMLDOMNode_get_nodeTypedValue( This
->node
, var1
);
336 static HRESULT WINAPI
domcomment_put_nodeTypedValue(
337 IXMLDOMComment
*iface
,
340 domcomment
*This
= impl_from_IXMLDOMComment( iface
);
341 return IXMLDOMNode_put_nodeTypedValue( This
->node
, var1
);
344 static HRESULT WINAPI
domcomment_get_dataType(
345 IXMLDOMComment
*iface
,
348 domcomment
*This
= impl_from_IXMLDOMComment( iface
);
349 return IXMLDOMNode_get_dataType( This
->node
, var1
);
352 static HRESULT WINAPI
domcomment_put_dataType(
353 IXMLDOMComment
*iface
,
356 domcomment
*This
= impl_from_IXMLDOMComment( iface
);
357 return IXMLDOMNode_put_dataType( This
->node
, p
);
360 static HRESULT WINAPI
domcomment_get_xml(
361 IXMLDOMComment
*iface
,
364 domcomment
*This
= impl_from_IXMLDOMComment( iface
);
365 return IXMLDOMNode_get_xml( This
->node
, p
);
368 static HRESULT WINAPI
domcomment_transformNode(
369 IXMLDOMComment
*iface
,
370 IXMLDOMNode
* domNode
, BSTR
* p
)
372 domcomment
*This
= impl_from_IXMLDOMComment( iface
);
373 return IXMLDOMNode_transformNode( This
->node
, domNode
, p
);
376 static HRESULT WINAPI
domcomment_selectNodes(
377 IXMLDOMComment
*iface
,
378 BSTR p
, IXMLDOMNodeList
** outList
)
380 domcomment
*This
= impl_from_IXMLDOMComment( iface
);
381 return IXMLDOMNode_selectNodes( This
->node
, p
, outList
);
384 static HRESULT WINAPI
domcomment_selectSingleNode(
385 IXMLDOMComment
*iface
,
386 BSTR p
, IXMLDOMNode
** outNode
)
388 domcomment
*This
= impl_from_IXMLDOMComment( iface
);
389 return IXMLDOMNode_selectSingleNode( This
->node
, p
, outNode
);
392 static HRESULT WINAPI
domcomment_get_parsed(
393 IXMLDOMComment
*iface
,
396 domcomment
*This
= impl_from_IXMLDOMComment( iface
);
397 return IXMLDOMNode_get_parsed( This
->node
, pbool
);
400 static HRESULT WINAPI
domcomment_get_namespaceURI(
401 IXMLDOMComment
*iface
,
404 domcomment
*This
= impl_from_IXMLDOMComment( iface
);
405 return IXMLDOMNode_get_namespaceURI( This
->node
, p
);
408 static HRESULT WINAPI
domcomment_get_prefix(
409 IXMLDOMComment
*iface
,
412 domcomment
*This
= impl_from_IXMLDOMComment( iface
);
413 return IXMLDOMNode_get_prefix( This
->node
, p
);
416 static HRESULT WINAPI
domcomment_get_baseName(
417 IXMLDOMComment
*iface
,
420 domcomment
*This
= impl_from_IXMLDOMComment( iface
);
421 return IXMLDOMNode_get_baseName( This
->node
, p
);
424 static HRESULT WINAPI
domcomment_transformNodeToObject(
425 IXMLDOMComment
*iface
,
426 IXMLDOMNode
* domNode
, VARIANT var1
)
428 domcomment
*This
= impl_from_IXMLDOMComment( iface
);
429 return IXMLDOMNode_transformNodeToObject( This
->node
, domNode
, var1
);
432 static HRESULT WINAPI
domcomment_get_data(
433 IXMLDOMComment
*iface
,
440 static HRESULT WINAPI
domcomment_put_data(
441 IXMLDOMComment
*iface
,
448 static HRESULT WINAPI
domcomment_get_length(
449 IXMLDOMComment
*iface
,
456 static HRESULT WINAPI
domcomment_substringData(
457 IXMLDOMComment
*iface
,
458 long offset
, long count
, BSTR
*p
)
464 static HRESULT WINAPI
domcomment_appendData(
465 IXMLDOMComment
*iface
,
472 static HRESULT WINAPI
domcomment_insertData(
473 IXMLDOMComment
*iface
,
480 static HRESULT WINAPI
domcomment_deleteData(
481 IXMLDOMComment
*iface
,
482 long offset
, long count
)
488 static HRESULT WINAPI
domcomment_replaceData(
489 IXMLDOMComment
*iface
,
490 long offset
, long count
, BSTR p
)
496 static const struct IXMLDOMCommentVtbl domcomment_vtbl
=
498 domcomment_QueryInterface
,
501 domcomment_GetTypeInfoCount
,
502 domcomment_GetTypeInfo
,
503 domcomment_GetIDsOfNames
,
505 domcomment_get_nodeName
,
506 domcomment_get_nodeValue
,
507 domcomment_put_nodeValue
,
508 domcomment_get_nodeType
,
509 domcomment_get_parentNode
,
510 domcomment_get_childNodes
,
511 domcomment_get_firstChild
,
512 domcomment_get_lastChild
,
513 domcomment_get_previousSibling
,
514 domcomment_get_nextSibling
,
515 domcomment_get_attributes
,
516 domcomment_insertBefore
,
517 domcomment_replaceChild
,
518 domcomment_removeChild
,
519 domcomment_appendChild
,
520 domcomment_hasChildNodes
,
521 domcomment_get_ownerDocument
,
522 domcomment_cloneNode
,
523 domcomment_get_nodeTypeString
,
526 domcomment_get_specified
,
527 domcomment_get_definition
,
528 domcomment_get_nodeTypedValue
,
529 domcomment_put_nodeTypedValue
,
530 domcomment_get_dataType
,
531 domcomment_put_dataType
,
533 domcomment_transformNode
,
534 domcomment_selectNodes
,
535 domcomment_selectSingleNode
,
536 domcomment_get_parsed
,
537 domcomment_get_namespaceURI
,
538 domcomment_get_prefix
,
539 domcomment_get_baseName
,
540 domcomment_transformNodeToObject
,
543 domcomment_get_length
,
544 domcomment_substringData
,
545 domcomment_appendData
,
546 domcomment_insertData
,
547 domcomment_deleteData
,
548 domcomment_replaceData
551 IUnknown
* create_comment( xmlNodePtr comment
)
556 This
= HeapAlloc( GetProcessHeap(), 0, sizeof *This
);
560 This
->lpVtbl
= &domcomment_vtbl
;
563 This
->node_unk
= create_basic_node( comment
, (IUnknown
*)&This
->lpVtbl
);
566 HeapFree(GetProcessHeap(), 0, This
);
570 hr
= IUnknown_QueryInterface(This
->node_unk
, &IID_IXMLDOMNode
, (LPVOID
*)&This
->node
);
573 IUnknown_Release(This
->node_unk
);
574 HeapFree( GetProcessHeap(), 0, This
);
577 /* The ref on This->node is actually looped back into this object, so release it */
578 IXMLDOMNode_Release(This
->node
);
580 return (IUnknown
*) &This
->lpVtbl
;