msxml3: Store xmlnode object in domelem.

This commit is contained in:
Jacek Caban 2009-08-21 13:24:53 +02:00 committed by Alexandre Julliard
parent d48246e1cc
commit 38c0667334
1 changed files with 42 additions and 47 deletions

View File

@ -44,8 +44,7 @@ typedef struct _domelem
const struct IUnknownVtbl *lpInternalUnkVtbl;
IUnknown *pUnkOuter;
LONG ref;
IUnknown *node_unk;
IXMLDOMNode *node;
xmlnode *node;
} domelem;
static inline domelem *impl_from_IXMLDOMElement( IXMLDOMElement *iface )
@ -60,7 +59,7 @@ static inline domelem *impl_from_InternalUnknown( IUnknown *iface )
static inline xmlNodePtr get_element( domelem *This )
{
return xmlNodePtr_from_domnode( This->node, XML_ELEMENT_NODE );
return This->node->node;
}
static HRESULT WINAPI domelem_QueryInterface(
@ -170,7 +169,7 @@ static HRESULT WINAPI domelem_get_nodeName(
BSTR* p )
{
domelem *This = impl_from_IXMLDOMElement( iface );
return IXMLDOMNode_get_nodeName( This->node, p );
return IXMLDOMNode_get_nodeName( IXMLDOMNode_from_impl(This->node), p );
}
static HRESULT WINAPI domelem_get_nodeValue(
@ -178,7 +177,7 @@ static HRESULT WINAPI domelem_get_nodeValue(
VARIANT* var1 )
{
domelem *This = impl_from_IXMLDOMElement( iface );
return IXMLDOMNode_get_nodeValue( This->node, var1 );
return IXMLDOMNode_get_nodeValue( IXMLDOMNode_from_impl(This->node), var1 );
}
static HRESULT WINAPI domelem_put_nodeValue(
@ -186,7 +185,7 @@ static HRESULT WINAPI domelem_put_nodeValue(
VARIANT var1 )
{
domelem *This = impl_from_IXMLDOMElement( iface );
return IXMLDOMNode_put_nodeValue( This->node, var1 );
return IXMLDOMNode_put_nodeValue( IXMLDOMNode_from_impl(This->node), var1 );
}
static HRESULT WINAPI domelem_get_nodeType(
@ -194,7 +193,7 @@ static HRESULT WINAPI domelem_get_nodeType(
DOMNodeType* domNodeType )
{
domelem *This = impl_from_IXMLDOMElement( iface );
return IXMLDOMNode_get_nodeType( This->node, domNodeType );
return IXMLDOMNode_get_nodeType( IXMLDOMNode_from_impl(This->node), domNodeType );
}
static HRESULT WINAPI domelem_get_parentNode(
@ -202,7 +201,7 @@ static HRESULT WINAPI domelem_get_parentNode(
IXMLDOMNode** parent )
{
domelem *This = impl_from_IXMLDOMElement( iface );
return IXMLDOMNode_get_parentNode( This->node, parent );
return IXMLDOMNode_get_parentNode( IXMLDOMNode_from_impl(This->node), parent );
}
static HRESULT WINAPI domelem_get_childNodes(
@ -210,7 +209,7 @@ static HRESULT WINAPI domelem_get_childNodes(
IXMLDOMNodeList** outList)
{
domelem *This = impl_from_IXMLDOMElement( iface );
return IXMLDOMNode_get_childNodes( This->node, outList );
return IXMLDOMNode_get_childNodes( IXMLDOMNode_from_impl(This->node), outList );
}
static HRESULT WINAPI domelem_get_firstChild(
@ -218,7 +217,7 @@ static HRESULT WINAPI domelem_get_firstChild(
IXMLDOMNode** domNode)
{
domelem *This = impl_from_IXMLDOMElement( iface );
return IXMLDOMNode_get_firstChild( This->node, domNode );
return IXMLDOMNode_get_firstChild( IXMLDOMNode_from_impl(This->node), domNode );
}
static HRESULT WINAPI domelem_get_lastChild(
@ -226,7 +225,7 @@ static HRESULT WINAPI domelem_get_lastChild(
IXMLDOMNode** domNode)
{
domelem *This = impl_from_IXMLDOMElement( iface );
return IXMLDOMNode_get_lastChild( This->node, domNode );
return IXMLDOMNode_get_lastChild( IXMLDOMNode_from_impl(This->node), domNode );
}
static HRESULT WINAPI domelem_get_previousSibling(
@ -234,7 +233,7 @@ static HRESULT WINAPI domelem_get_previousSibling(
IXMLDOMNode** domNode)
{
domelem *This = impl_from_IXMLDOMElement( iface );
return IXMLDOMNode_get_previousSibling( This->node, domNode );
return IXMLDOMNode_get_previousSibling( IXMLDOMNode_from_impl(This->node), domNode );
}
static HRESULT WINAPI domelem_get_nextSibling(
@ -242,7 +241,7 @@ static HRESULT WINAPI domelem_get_nextSibling(
IXMLDOMNode** domNode)
{
domelem *This = impl_from_IXMLDOMElement( iface );
return IXMLDOMNode_get_nextSibling( This->node, domNode );
return IXMLDOMNode_get_nextSibling( IXMLDOMNode_from_impl(This->node), domNode );
}
static HRESULT WINAPI domelem_get_attributes(
@ -250,7 +249,7 @@ static HRESULT WINAPI domelem_get_attributes(
IXMLDOMNamedNodeMap** attributeMap)
{
domelem *This = impl_from_IXMLDOMElement( iface );
return IXMLDOMNode_get_attributes( This->node, attributeMap );
return IXMLDOMNode_get_attributes( IXMLDOMNode_from_impl(This->node), attributeMap );
}
static HRESULT WINAPI domelem_insertBefore(
@ -259,7 +258,7 @@ static HRESULT WINAPI domelem_insertBefore(
IXMLDOMNode** outOldNode)
{
domelem *This = impl_from_IXMLDOMElement( iface );
return IXMLDOMNode_insertBefore( This->node, newNode, var1, outOldNode );
return IXMLDOMNode_insertBefore( IXMLDOMNode_from_impl(This->node), newNode, var1, outOldNode );
}
static HRESULT WINAPI domelem_replaceChild(
@ -269,7 +268,7 @@ static HRESULT WINAPI domelem_replaceChild(
IXMLDOMNode** outOldNode)
{
domelem *This = impl_from_IXMLDOMElement( iface );
return IXMLDOMNode_replaceChild( This->node, newNode, oldNode, outOldNode );
return IXMLDOMNode_replaceChild( IXMLDOMNode_from_impl(This->node), newNode, oldNode, outOldNode );
}
static HRESULT WINAPI domelem_removeChild(
@ -277,7 +276,7 @@ static HRESULT WINAPI domelem_removeChild(
IXMLDOMNode* domNode, IXMLDOMNode** oldNode)
{
domelem *This = impl_from_IXMLDOMElement( iface );
return IXMLDOMNode_removeChild( This->node, domNode, oldNode );
return IXMLDOMNode_removeChild( IXMLDOMNode_from_impl(This->node), domNode, oldNode );
}
static HRESULT WINAPI domelem_appendChild(
@ -285,7 +284,7 @@ static HRESULT WINAPI domelem_appendChild(
IXMLDOMNode* newNode, IXMLDOMNode** outNewNode)
{
domelem *This = impl_from_IXMLDOMElement( iface );
return IXMLDOMNode_appendChild( This->node, newNode, outNewNode );
return IXMLDOMNode_appendChild( IXMLDOMNode_from_impl(This->node), newNode, outNewNode );
}
static HRESULT WINAPI domelem_hasChildNodes(
@ -293,7 +292,7 @@ static HRESULT WINAPI domelem_hasChildNodes(
VARIANT_BOOL* pbool)
{
domelem *This = impl_from_IXMLDOMElement( iface );
return IXMLDOMNode_hasChildNodes( This->node, pbool );
return IXMLDOMNode_hasChildNodes( IXMLDOMNode_from_impl(This->node), pbool );
}
static HRESULT WINAPI domelem_get_ownerDocument(
@ -301,7 +300,7 @@ static HRESULT WINAPI domelem_get_ownerDocument(
IXMLDOMDocument** domDocument)
{
domelem *This = impl_from_IXMLDOMElement( iface );
return IXMLDOMNode_get_ownerDocument( This->node, domDocument );
return IXMLDOMNode_get_ownerDocument( IXMLDOMNode_from_impl(This->node), domDocument );
}
static HRESULT WINAPI domelem_cloneNode(
@ -309,7 +308,7 @@ static HRESULT WINAPI domelem_cloneNode(
VARIANT_BOOL pbool, IXMLDOMNode** outNode)
{
domelem *This = impl_from_IXMLDOMElement( iface );
return IXMLDOMNode_cloneNode( This->node, pbool, outNode );
return IXMLDOMNode_cloneNode( IXMLDOMNode_from_impl(This->node), pbool, outNode );
}
static HRESULT WINAPI domelem_get_nodeTypeString(
@ -317,7 +316,7 @@ static HRESULT WINAPI domelem_get_nodeTypeString(
BSTR* p)
{
domelem *This = impl_from_IXMLDOMElement( iface );
return IXMLDOMNode_get_nodeTypeString( This->node, p );
return IXMLDOMNode_get_nodeTypeString( IXMLDOMNode_from_impl(This->node), p );
}
static HRESULT WINAPI domelem_get_text(
@ -325,7 +324,7 @@ static HRESULT WINAPI domelem_get_text(
BSTR* p)
{
domelem *This = impl_from_IXMLDOMElement( iface );
return IXMLDOMNode_get_text( This->node, p );
return IXMLDOMNode_get_text( IXMLDOMNode_from_impl(This->node), p );
}
static HRESULT WINAPI domelem_put_text(
@ -333,7 +332,7 @@ static HRESULT WINAPI domelem_put_text(
BSTR p)
{
domelem *This = impl_from_IXMLDOMElement( iface );
return IXMLDOMNode_put_text( This->node, p );
return IXMLDOMNode_put_text( IXMLDOMNode_from_impl(This->node), p );
}
static HRESULT WINAPI domelem_get_specified(
@ -341,7 +340,7 @@ static HRESULT WINAPI domelem_get_specified(
VARIANT_BOOL* pbool)
{
domelem *This = impl_from_IXMLDOMElement( iface );
return IXMLDOMNode_get_specified( This->node, pbool );
return IXMLDOMNode_get_specified( IXMLDOMNode_from_impl(This->node), pbool );
}
static HRESULT WINAPI domelem_get_definition(
@ -349,7 +348,7 @@ static HRESULT WINAPI domelem_get_definition(
IXMLDOMNode** domNode)
{
domelem *This = impl_from_IXMLDOMElement( iface );
return IXMLDOMNode_get_definition( This->node, domNode );
return IXMLDOMNode_get_definition( IXMLDOMNode_from_impl(This->node), domNode );
}
static HRESULT WINAPI domelem_get_nodeTypedValue(
@ -357,7 +356,7 @@ static HRESULT WINAPI domelem_get_nodeTypedValue(
VARIANT* var1)
{
domelem *This = impl_from_IXMLDOMElement( iface );
return IXMLDOMNode_get_nodeTypedValue( This->node, var1 );
return IXMLDOMNode_get_nodeTypedValue( IXMLDOMNode_from_impl(This->node), var1 );
}
static HRESULT WINAPI domelem_put_nodeTypedValue(
@ -365,7 +364,7 @@ static HRESULT WINAPI domelem_put_nodeTypedValue(
VARIANT var1)
{
domelem *This = impl_from_IXMLDOMElement( iface );
return IXMLDOMNode_put_nodeTypedValue( This->node, var1 );
return IXMLDOMNode_put_nodeTypedValue( IXMLDOMNode_from_impl(This->node), var1 );
}
static HRESULT WINAPI domelem_get_dataType(
@ -373,7 +372,7 @@ static HRESULT WINAPI domelem_get_dataType(
VARIANT* var1)
{
domelem *This = impl_from_IXMLDOMElement( iface );
return IXMLDOMNode_get_dataType( This->node, var1 );
return IXMLDOMNode_get_dataType( IXMLDOMNode_from_impl(This->node), var1 );
}
static HRESULT WINAPI domelem_put_dataType(
@ -381,7 +380,7 @@ static HRESULT WINAPI domelem_put_dataType(
BSTR p)
{
domelem *This = impl_from_IXMLDOMElement( iface );
return IXMLDOMNode_put_dataType( This->node, p );
return IXMLDOMNode_put_dataType( IXMLDOMNode_from_impl(This->node), p );
}
static HRESULT WINAPI domelem_get_xml(
@ -389,7 +388,7 @@ static HRESULT WINAPI domelem_get_xml(
BSTR* p)
{
domelem *This = impl_from_IXMLDOMElement( iface );
return IXMLDOMNode_get_xml( This->node, p );
return IXMLDOMNode_get_xml( IXMLDOMNode_from_impl(This->node), p );
}
static HRESULT WINAPI domelem_transformNode(
@ -397,7 +396,7 @@ static HRESULT WINAPI domelem_transformNode(
IXMLDOMNode* domNode, BSTR* p)
{
domelem *This = impl_from_IXMLDOMElement( iface );
return IXMLDOMNode_transformNode( This->node, domNode, p );
return IXMLDOMNode_transformNode( IXMLDOMNode_from_impl(This->node), domNode, p );
}
static HRESULT WINAPI domelem_selectNodes(
@ -405,7 +404,7 @@ static HRESULT WINAPI domelem_selectNodes(
BSTR p, IXMLDOMNodeList** outList)
{
domelem *This = impl_from_IXMLDOMElement( iface );
return IXMLDOMNode_selectNodes( This->node, p, outList );
return IXMLDOMNode_selectNodes( IXMLDOMNode_from_impl(This->node), p, outList );
}
static HRESULT WINAPI domelem_selectSingleNode(
@ -413,7 +412,7 @@ static HRESULT WINAPI domelem_selectSingleNode(
BSTR p, IXMLDOMNode** outNode)
{
domelem *This = impl_from_IXMLDOMElement( iface );
return IXMLDOMNode_selectSingleNode( This->node, p, outNode );
return IXMLDOMNode_selectSingleNode( IXMLDOMNode_from_impl(This->node), p, outNode );
}
static HRESULT WINAPI domelem_get_parsed(
@ -421,7 +420,7 @@ static HRESULT WINAPI domelem_get_parsed(
VARIANT_BOOL* pbool)
{
domelem *This = impl_from_IXMLDOMElement( iface );
return IXMLDOMNode_get_parsed( This->node, pbool );
return IXMLDOMNode_get_parsed( IXMLDOMNode_from_impl(This->node), pbool );
}
static HRESULT WINAPI domelem_get_namespaceURI(
@ -429,7 +428,7 @@ static HRESULT WINAPI domelem_get_namespaceURI(
BSTR* p)
{
domelem *This = impl_from_IXMLDOMElement( iface );
return IXMLDOMNode_get_namespaceURI( This->node, p );
return IXMLDOMNode_get_namespaceURI( IXMLDOMNode_from_impl(This->node), p );
}
static HRESULT WINAPI domelem_get_prefix(
@ -437,7 +436,7 @@ static HRESULT WINAPI domelem_get_prefix(
BSTR* p)
{
domelem *This = impl_from_IXMLDOMElement( iface );
return IXMLDOMNode_get_prefix( This->node, p );
return IXMLDOMNode_get_prefix( IXMLDOMNode_from_impl(This->node), p );
}
static HRESULT WINAPI domelem_get_baseName(
@ -445,7 +444,7 @@ static HRESULT WINAPI domelem_get_baseName(
BSTR* p)
{
domelem *This = impl_from_IXMLDOMElement( iface );
return IXMLDOMNode_get_baseName( This->node, p );
return IXMLDOMNode_get_baseName( IXMLDOMNode_from_impl(This->node), p );
}
static HRESULT WINAPI domelem_transformNodeToObject(
@ -453,7 +452,7 @@ static HRESULT WINAPI domelem_transformNodeToObject(
IXMLDOMNode* domNode, VARIANT var1)
{
domelem *This = impl_from_IXMLDOMElement( iface );
return IXMLDOMNode_transformNodeToObject( This->node, domNode, var1 );
return IXMLDOMNode_transformNodeToObject( IXMLDOMNode_from_impl(This->node), domNode, var1 );
}
static HRESULT WINAPI domelem_get_tagName(
@ -744,7 +743,7 @@ static HRESULT WINAPI Internal_QueryInterface(
}
else if ( IsEqualGUID( riid, &IID_IXMLDOMNode ) )
{
return IUnknown_QueryInterface(This->node_unk, riid, ppvObject);
*ppvObject = IXMLDOMNode_from_impl(This->node);
}
else
{
@ -773,7 +772,7 @@ static ULONG WINAPI Internal_Release(
ref = InterlockedDecrement( &This->ref );
if ( ref == 0 )
{
IUnknown_Release( This->node_unk );
IXMLDOMNode_Release( IXMLDOMNode_from_impl(This->node) );
HeapFree( GetProcessHeap(), 0, This );
}
@ -790,7 +789,6 @@ static const struct IUnknownVtbl internal_unk_vtbl =
IUnknown* create_element( xmlNodePtr element, IUnknown *pUnkOuter )
{
domelem *This;
xmlnode *node;
This = HeapAlloc( GetProcessHeap(), 0, sizeof *This );
if ( !This )
@ -805,16 +803,13 @@ IUnknown* create_element( xmlNodePtr element, IUnknown *pUnkOuter )
else
This->pUnkOuter = (IUnknown *)&This->lpInternalUnkVtbl;
node = create_basic_node( element, (IUnknown*)&This->lpVtbl );
if(!node)
This->node = create_basic_node( element, (IUnknown*)&This->lpVtbl );
if(!This->node)
{
HeapFree(GetProcessHeap(), 0, This);
return NULL;
}
This->node_unk = (IUnknown*)&node->lpInternalUnkVtbl;
This->node = IXMLDOMNode_from_impl(node);
return (IUnknown*) &This->lpInternalUnkVtbl;
}