push b79aff4f9e064e6702329573e5ebb8548e254b61
[wine/hacks.git] / dlls / msxml3 / attribute.c
blob689829996f143c6760994e1121a1772e4c85ca19
1 /*
2 * DOM Attribute 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 _domattr
42 const struct IXMLDOMAttributeVtbl *lpVtbl;
43 LONG ref;
44 IUnknown *node_unk;
45 IXMLDOMNode *node;
46 } domattr;
48 static inline domattr *impl_from_IXMLDOMAttribute( IXMLDOMAttribute *iface )
50 return (domattr *)((char*)iface - FIELD_OFFSET(domattr, lpVtbl));
53 static HRESULT WINAPI domattr_QueryInterface(
54 IXMLDOMAttribute *iface,
55 REFIID riid,
56 void** ppvObject )
58 domattr *This = impl_from_IXMLDOMAttribute( iface );
59 TRACE("%p %s %p\n", This, debugstr_guid(riid), ppvObject);
61 if ( IsEqualGUID( riid, &IID_IXMLDOMAttribute ) ||
62 IsEqualGUID( riid, &IID_IUnknown ) )
64 *ppvObject = iface;
66 else if ( IsEqualGUID( riid, &IID_IDispatch ) ||
67 IsEqualGUID( riid, &IID_IXMLDOMNode ) )
69 return IUnknown_QueryInterface(This->node_unk, riid, ppvObject);
71 else
73 FIXME("Unsupported inteferace %s\n", debugstr_guid(riid));
74 return E_NOINTERFACE;
77 IXMLDOMAttribute_AddRef( iface );
79 return S_OK;
82 static ULONG WINAPI domattr_AddRef(
83 IXMLDOMAttribute *iface )
85 domattr *This = impl_from_IXMLDOMAttribute( iface );
86 return InterlockedIncrement( &This->ref );
89 static ULONG WINAPI domattr_Release(
90 IXMLDOMAttribute *iface )
92 domattr *This = impl_from_IXMLDOMAttribute( iface );
93 ULONG ref;
95 ref = InterlockedDecrement( &This->ref );
96 if ( ref == 0 )
98 IUnknown_Release( This->node_unk );
99 HeapFree( GetProcessHeap(), 0, This );
102 return ref;
105 static HRESULT WINAPI domattr_GetTypeInfoCount(
106 IXMLDOMAttribute *iface,
107 UINT* pctinfo )
109 FIXME("\n");
110 return E_NOTIMPL;
113 static HRESULT WINAPI domattr_GetTypeInfo(
114 IXMLDOMAttribute *iface,
115 UINT iTInfo, LCID lcid,
116 ITypeInfo** ppTInfo )
118 FIXME("\n");
119 return E_NOTIMPL;
122 static HRESULT WINAPI domattr_GetIDsOfNames(
123 IXMLDOMAttribute *iface,
124 REFIID riid, LPOLESTR* rgszNames,
125 UINT cNames, LCID lcid, DISPID* rgDispId )
127 FIXME("\n");
128 return E_NOTIMPL;
131 static HRESULT WINAPI domattr_Invoke(
132 IXMLDOMAttribute *iface,
133 DISPID dispIdMember, REFIID riid, LCID lcid,
134 WORD wFlags, DISPPARAMS* pDispParams, VARIANT* pVarResult,
135 EXCEPINFO* pExcepInfo, UINT* puArgErr )
137 FIXME("\n");
138 return E_NOTIMPL;
141 static HRESULT WINAPI domattr_get_nodeName(
142 IXMLDOMAttribute *iface,
143 BSTR* p )
145 domattr *This = impl_from_IXMLDOMAttribute( iface );
146 return IXMLDOMNode_get_nodeName( This->node, p );
149 static HRESULT WINAPI domattr_get_nodeValue(
150 IXMLDOMAttribute *iface,
151 VARIANT* var1 )
153 domattr *This = impl_from_IXMLDOMAttribute( iface );
154 return IXMLDOMNode_get_nodeValue( This->node, var1 );
157 static HRESULT WINAPI domattr_put_nodeValue(
158 IXMLDOMAttribute *iface,
159 VARIANT var1 )
161 domattr *This = impl_from_IXMLDOMAttribute( iface );
162 return IXMLDOMNode_put_nodeValue( This->node, var1 );
165 static HRESULT WINAPI domattr_get_nodeType(
166 IXMLDOMAttribute *iface,
167 DOMNodeType* domNodeType )
169 domattr *This = impl_from_IXMLDOMAttribute( iface );
170 return IXMLDOMNode_get_nodeType( This->node, domNodeType );
173 static HRESULT WINAPI domattr_get_parentNode(
174 IXMLDOMAttribute *iface,
175 IXMLDOMNode** parent )
177 domattr *This = impl_from_IXMLDOMAttribute( iface );
178 return IXMLDOMNode_get_parentNode( This->node, parent );
181 static HRESULT WINAPI domattr_get_childNodes(
182 IXMLDOMAttribute *iface,
183 IXMLDOMNodeList** outList)
185 domattr *This = impl_from_IXMLDOMAttribute( iface );
186 return IXMLDOMNode_get_childNodes( This->node, outList );
189 static HRESULT WINAPI domattr_get_firstChild(
190 IXMLDOMAttribute *iface,
191 IXMLDOMNode** domNode)
193 domattr *This = impl_from_IXMLDOMAttribute( iface );
194 return IXMLDOMNode_get_firstChild( This->node, domNode );
197 static HRESULT WINAPI domattr_get_lastChild(
198 IXMLDOMAttribute *iface,
199 IXMLDOMNode** domNode)
201 domattr *This = impl_from_IXMLDOMAttribute( iface );
202 return IXMLDOMNode_get_lastChild( This->node, domNode );
205 static HRESULT WINAPI domattr_get_previousSibling(
206 IXMLDOMAttribute *iface,
207 IXMLDOMNode** domNode)
209 domattr *This = impl_from_IXMLDOMAttribute( iface );
210 return IXMLDOMNode_get_previousSibling( This->node, domNode );
213 static HRESULT WINAPI domattr_get_nextSibling(
214 IXMLDOMAttribute *iface,
215 IXMLDOMNode** domNode)
217 domattr *This = impl_from_IXMLDOMAttribute( iface );
218 return IXMLDOMNode_get_nextSibling( This->node, domNode );
221 static HRESULT WINAPI domattr_get_attributes(
222 IXMLDOMAttribute *iface,
223 IXMLDOMNamedNodeMap** attributeMap)
225 domattr *This = impl_from_IXMLDOMAttribute( iface );
226 return IXMLDOMNode_get_attributes( This->node, attributeMap );
229 static HRESULT WINAPI domattr_insertBefore(
230 IXMLDOMAttribute *iface,
231 IXMLDOMNode* newNode, VARIANT var1,
232 IXMLDOMNode** outOldNode)
234 domattr *This = impl_from_IXMLDOMAttribute( iface );
235 return IXMLDOMNode_insertBefore( This->node, newNode, var1, outOldNode );
238 static HRESULT WINAPI domattr_replaceChild(
239 IXMLDOMAttribute *iface,
240 IXMLDOMNode* newNode,
241 IXMLDOMNode* oldNode,
242 IXMLDOMNode** outOldNode)
244 domattr *This = impl_from_IXMLDOMAttribute( iface );
245 return IXMLDOMNode_replaceChild( This->node, newNode, oldNode, outOldNode );
248 static HRESULT WINAPI domattr_removeChild(
249 IXMLDOMAttribute *iface,
250 IXMLDOMNode* domNode, IXMLDOMNode** oldNode)
252 domattr *This = impl_from_IXMLDOMAttribute( iface );
253 return IXMLDOMNode_removeChild( This->node, domNode, oldNode );
256 static HRESULT WINAPI domattr_appendChild(
257 IXMLDOMAttribute *iface,
258 IXMLDOMNode* newNode, IXMLDOMNode** outNewNode)
260 domattr *This = impl_from_IXMLDOMAttribute( iface );
261 return IXMLDOMNode_appendChild( This->node, newNode, outNewNode );
264 static HRESULT WINAPI domattr_hasChildNodes(
265 IXMLDOMAttribute *iface,
266 VARIANT_BOOL* pbool)
268 domattr *This = impl_from_IXMLDOMAttribute( iface );
269 return IXMLDOMNode_hasChildNodes( This->node, pbool );
272 static HRESULT WINAPI domattr_get_ownerDocument(
273 IXMLDOMAttribute *iface,
274 IXMLDOMDocument** domDocument)
276 domattr *This = impl_from_IXMLDOMAttribute( iface );
277 return IXMLDOMNode_get_ownerDocument( This->node, domDocument );
280 static HRESULT WINAPI domattr_cloneNode(
281 IXMLDOMAttribute *iface,
282 VARIANT_BOOL pbool, IXMLDOMNode** outNode)
284 domattr *This = impl_from_IXMLDOMAttribute( iface );
285 return IXMLDOMNode_cloneNode( This->node, pbool, outNode );
288 static HRESULT WINAPI domattr_get_nodeTypeString(
289 IXMLDOMAttribute *iface,
290 BSTR* p)
292 domattr *This = impl_from_IXMLDOMAttribute( iface );
293 return IXMLDOMNode_get_nodeTypeString( This->node, p );
296 static HRESULT WINAPI domattr_get_text(
297 IXMLDOMAttribute *iface,
298 BSTR* p)
300 domattr *This = impl_from_IXMLDOMAttribute( iface );
301 return IXMLDOMNode_get_text( This->node, p );
304 static HRESULT WINAPI domattr_put_text(
305 IXMLDOMAttribute *iface,
306 BSTR p)
308 domattr *This = impl_from_IXMLDOMAttribute( iface );
309 return IXMLDOMNode_put_text( This->node, p );
312 static HRESULT WINAPI domattr_get_specified(
313 IXMLDOMAttribute *iface,
314 VARIANT_BOOL* pbool)
316 domattr *This = impl_from_IXMLDOMAttribute( iface );
317 return IXMLDOMNode_get_specified( This->node, pbool );
320 static HRESULT WINAPI domattr_get_definition(
321 IXMLDOMAttribute *iface,
322 IXMLDOMNode** domNode)
324 domattr *This = impl_from_IXMLDOMAttribute( iface );
325 return IXMLDOMNode_get_definition( This->node, domNode );
328 static HRESULT WINAPI domattr_get_nodeTypedValue(
329 IXMLDOMAttribute *iface,
330 VARIANT* var1)
332 domattr *This = impl_from_IXMLDOMAttribute( iface );
333 return IXMLDOMNode_get_nodeTypedValue( This->node, var1 );
336 static HRESULT WINAPI domattr_put_nodeTypedValue(
337 IXMLDOMAttribute *iface,
338 VARIANT var1)
340 domattr *This = impl_from_IXMLDOMAttribute( iface );
341 return IXMLDOMNode_put_nodeTypedValue( This->node, var1 );
344 static HRESULT WINAPI domattr_get_dataType(
345 IXMLDOMAttribute *iface,
346 VARIANT* var1)
348 domattr *This = impl_from_IXMLDOMAttribute( iface );
349 return IXMLDOMNode_get_dataType( This->node, var1 );
352 static HRESULT WINAPI domattr_put_dataType(
353 IXMLDOMAttribute *iface,
354 BSTR p)
356 domattr *This = impl_from_IXMLDOMAttribute( iface );
357 return IXMLDOMNode_put_dataType( This->node, p );
360 static HRESULT WINAPI domattr_get_xml(
361 IXMLDOMAttribute *iface,
362 BSTR* p)
364 domattr *This = impl_from_IXMLDOMAttribute( iface );
365 return IXMLDOMNode_get_xml( This->node, p );
368 static HRESULT WINAPI domattr_transformNode(
369 IXMLDOMAttribute *iface,
370 IXMLDOMNode* domNode, BSTR* p)
372 domattr *This = impl_from_IXMLDOMAttribute( iface );
373 return IXMLDOMNode_transformNode( This->node, domNode, p );
376 static HRESULT WINAPI domattr_selectNodes(
377 IXMLDOMAttribute *iface,
378 BSTR p, IXMLDOMNodeList** outList)
380 domattr *This = impl_from_IXMLDOMAttribute( iface );
381 return IXMLDOMNode_selectNodes( This->node, p, outList );
384 static HRESULT WINAPI domattr_selectSingleNode(
385 IXMLDOMAttribute *iface,
386 BSTR p, IXMLDOMNode** outNode)
388 domattr *This = impl_from_IXMLDOMAttribute( iface );
389 return IXMLDOMNode_selectSingleNode( This->node, p, outNode );
392 static HRESULT WINAPI domattr_get_parsed(
393 IXMLDOMAttribute *iface,
394 VARIANT_BOOL* pbool)
396 domattr *This = impl_from_IXMLDOMAttribute( iface );
397 return IXMLDOMNode_get_parsed( This->node, pbool );
400 static HRESULT WINAPI domattr_get_namespaceURI(
401 IXMLDOMAttribute *iface,
402 BSTR* p)
404 domattr *This = impl_from_IXMLDOMAttribute( iface );
405 return IXMLDOMNode_get_namespaceURI( This->node, p );
408 static HRESULT WINAPI domattr_get_prefix(
409 IXMLDOMAttribute *iface,
410 BSTR* p)
412 domattr *This = impl_from_IXMLDOMAttribute( iface );
413 return IXMLDOMNode_get_prefix( This->node, p );
416 static HRESULT WINAPI domattr_get_baseName(
417 IXMLDOMAttribute *iface,
418 BSTR* p)
420 domattr *This = impl_from_IXMLDOMAttribute( iface );
421 return IXMLDOMNode_get_baseName( This->node, p );
424 static HRESULT WINAPI domattr_transformNodeToObject(
425 IXMLDOMAttribute *iface,
426 IXMLDOMNode* domNode, VARIANT var1)
428 domattr *This = impl_from_IXMLDOMAttribute( iface );
429 return IXMLDOMNode_transformNodeToObject( This->node, domNode, var1 );
432 static HRESULT WINAPI domattr_get_name(
433 IXMLDOMAttribute *iface,
434 BSTR *p)
436 FIXME("\n");
437 return E_NOTIMPL;
440 static HRESULT WINAPI domattr_get_value(
441 IXMLDOMAttribute *iface,
442 VARIANT *var1)
444 FIXME("\n");
445 return E_NOTIMPL;
448 static HRESULT WINAPI domattr_put_value(
449 IXMLDOMAttribute *iface,
450 VARIANT var1)
452 FIXME("\n");
453 return E_NOTIMPL;
456 static const struct IXMLDOMAttributeVtbl domattr_vtbl =
458 domattr_QueryInterface,
459 domattr_AddRef,
460 domattr_Release,
461 domattr_GetTypeInfoCount,
462 domattr_GetTypeInfo,
463 domattr_GetIDsOfNames,
464 domattr_Invoke,
465 domattr_get_nodeName,
466 domattr_get_nodeValue,
467 domattr_put_nodeValue,
468 domattr_get_nodeType,
469 domattr_get_parentNode,
470 domattr_get_childNodes,
471 domattr_get_firstChild,
472 domattr_get_lastChild,
473 domattr_get_previousSibling,
474 domattr_get_nextSibling,
475 domattr_get_attributes,
476 domattr_insertBefore,
477 domattr_replaceChild,
478 domattr_removeChild,
479 domattr_appendChild,
480 domattr_hasChildNodes,
481 domattr_get_ownerDocument,
482 domattr_cloneNode,
483 domattr_get_nodeTypeString,
484 domattr_get_text,
485 domattr_put_text,
486 domattr_get_specified,
487 domattr_get_definition,
488 domattr_get_nodeTypedValue,
489 domattr_put_nodeTypedValue,
490 domattr_get_dataType,
491 domattr_put_dataType,
492 domattr_get_xml,
493 domattr_transformNode,
494 domattr_selectNodes,
495 domattr_selectSingleNode,
496 domattr_get_parsed,
497 domattr_get_namespaceURI,
498 domattr_get_prefix,
499 domattr_get_baseName,
500 domattr_transformNodeToObject,
501 domattr_get_name,
502 domattr_get_value,
503 domattr_put_value
506 IUnknown* create_attribute( xmlNodePtr attribute )
508 domattr *This;
509 HRESULT hr;
511 This = HeapAlloc( GetProcessHeap(), 0, sizeof *This );
512 if ( !This )
513 return NULL;
515 This->lpVtbl = &domattr_vtbl;
516 This->ref = 1;
518 This->node_unk = create_basic_node( attribute, (IUnknown*)&This->lpVtbl );
519 if(!This->node_unk)
521 HeapFree(GetProcessHeap(), 0, This);
522 return NULL;
525 hr = IUnknown_QueryInterface(This->node_unk, &IID_IXMLDOMNode, (LPVOID*)&This->node);
526 if(FAILED(hr))
528 IUnknown_Release(This->node_unk);
529 HeapFree( GetProcessHeap(), 0, This );
530 return NULL;
532 /* The ref on This->node is actually looped back into this object, so release it */
533 IXMLDOMNode_Release(This->node);
535 return (IUnknown*) &This->lpVtbl;
538 #endif