msxml3: Store xmlnode pointer in dom_pi.

This commit is contained in:
Jacek Caban 2009-09-30 15:35:51 +02:00 committed by Alexandre Julliard
parent 2ed8402597
commit 4ca6e39f64
1 changed files with 45 additions and 51 deletions

View File

@ -41,8 +41,7 @@ typedef struct _dom_pi
{
const struct IXMLDOMProcessingInstructionVtbl *lpVtbl;
LONG ref;
IUnknown *node_unk;
IXMLDOMNode *node;
xmlnode *node;
} dom_pi;
static inline dom_pi *impl_from_IXMLDOMProcessingInstruction( IXMLDOMProcessingInstruction *iface )
@ -66,7 +65,7 @@ static HRESULT WINAPI dom_pi_QueryInterface(
}
else if ( IsEqualGUID( riid, &IID_IXMLDOMNode ) )
{
return IUnknown_QueryInterface(This->node_unk, riid, ppvObject);
*ppvObject = IXMLDOMNode_from_impl(This->node);
}
else
{
@ -74,8 +73,7 @@ static HRESULT WINAPI dom_pi_QueryInterface(
return E_NOINTERFACE;
}
IXMLDOMProcessingInstruction_AddRef( iface );
IUnknown_AddRef((IUnknown*)*ppvObject);
return S_OK;
}
@ -95,7 +93,7 @@ static ULONG WINAPI dom_pi_Release(
ref = InterlockedDecrement( &This->ref );
if ( ref == 0 )
{
IUnknown_Release( This->node_unk );
IXMLDOMNode_Release(IXMLDOMNode_from_impl(This->node));
HeapFree( GetProcessHeap(), 0, This );
}
@ -184,7 +182,7 @@ static HRESULT WINAPI dom_pi_get_nodeName(
BSTR* p )
{
dom_pi *This = impl_from_IXMLDOMProcessingInstruction( iface );
return IXMLDOMNode_get_nodeName( This->node, p );
return IXMLDOMNode_get_nodeName( IXMLDOMNode_from_impl(This->node), p );
}
static HRESULT WINAPI dom_pi_get_nodeValue(
@ -192,7 +190,7 @@ static HRESULT WINAPI dom_pi_get_nodeValue(
VARIANT* var1 )
{
dom_pi *This = impl_from_IXMLDOMProcessingInstruction( iface );
return IXMLDOMNode_get_nodeValue( This->node, var1 );
return IXMLDOMNode_get_nodeValue( IXMLDOMNode_from_impl(This->node), var1 );
}
static HRESULT WINAPI dom_pi_put_nodeValue(
@ -219,7 +217,7 @@ static HRESULT WINAPI dom_pi_put_nodeValue(
SysFreeString(sTarget);
}
return IXMLDOMNode_put_nodeValue( This->node, var1 );
return IXMLDOMNode_put_nodeValue( IXMLDOMNode_from_impl(This->node), var1 );
}
static HRESULT WINAPI dom_pi_get_nodeType(
@ -227,7 +225,7 @@ static HRESULT WINAPI dom_pi_get_nodeType(
DOMNodeType* domNodeType )
{
dom_pi *This = impl_from_IXMLDOMProcessingInstruction( iface );
return IXMLDOMNode_get_nodeType( This->node, domNodeType );
return IXMLDOMNode_get_nodeType( IXMLDOMNode_from_impl(This->node), domNodeType );
}
static HRESULT WINAPI dom_pi_get_parentNode(
@ -235,7 +233,7 @@ static HRESULT WINAPI dom_pi_get_parentNode(
IXMLDOMNode** parent )
{
dom_pi *This = impl_from_IXMLDOMProcessingInstruction( iface );
return IXMLDOMNode_get_parentNode( This->node, parent );
return IXMLDOMNode_get_parentNode( IXMLDOMNode_from_impl(This->node), parent );
}
static HRESULT WINAPI dom_pi_get_childNodes(
@ -243,7 +241,7 @@ static HRESULT WINAPI dom_pi_get_childNodes(
IXMLDOMNodeList** outList)
{
dom_pi *This = impl_from_IXMLDOMProcessingInstruction( iface );
return IXMLDOMNode_get_childNodes( This->node, outList );
return IXMLDOMNode_get_childNodes( IXMLDOMNode_from_impl(This->node), outList );
}
static HRESULT WINAPI dom_pi_get_firstChild(
@ -251,7 +249,7 @@ static HRESULT WINAPI dom_pi_get_firstChild(
IXMLDOMNode** domNode)
{
dom_pi *This = impl_from_IXMLDOMProcessingInstruction( iface );
return IXMLDOMNode_get_firstChild( This->node, domNode );
return IXMLDOMNode_get_firstChild( IXMLDOMNode_from_impl(This->node), domNode );
}
static HRESULT WINAPI dom_pi_get_lastChild(
@ -259,7 +257,7 @@ static HRESULT WINAPI dom_pi_get_lastChild(
IXMLDOMNode** domNode)
{
dom_pi *This = impl_from_IXMLDOMProcessingInstruction( iface );
return IXMLDOMNode_get_lastChild( This->node, domNode );
return IXMLDOMNode_get_lastChild( IXMLDOMNode_from_impl(This->node), domNode );
}
static HRESULT WINAPI dom_pi_get_previousSibling(
@ -267,7 +265,7 @@ static HRESULT WINAPI dom_pi_get_previousSibling(
IXMLDOMNode** domNode)
{
dom_pi *This = impl_from_IXMLDOMProcessingInstruction( iface );
return IXMLDOMNode_get_previousSibling( This->node, domNode );
return IXMLDOMNode_get_previousSibling( IXMLDOMNode_from_impl(This->node), domNode );
}
static HRESULT WINAPI dom_pi_get_nextSibling(
@ -275,7 +273,7 @@ static HRESULT WINAPI dom_pi_get_nextSibling(
IXMLDOMNode** domNode)
{
dom_pi *This = impl_from_IXMLDOMProcessingInstruction( iface );
return IXMLDOMNode_get_nextSibling( This->node, domNode );
return IXMLDOMNode_get_nextSibling( IXMLDOMNode_from_impl(This->node), domNode );
}
static HRESULT WINAPI dom_pi_get_attributes(
@ -283,7 +281,7 @@ static HRESULT WINAPI dom_pi_get_attributes(
IXMLDOMNamedNodeMap** attributeMap)
{
dom_pi *This = impl_from_IXMLDOMProcessingInstruction( iface );
return IXMLDOMNode_get_attributes( This->node, attributeMap );
return IXMLDOMNode_get_attributes( IXMLDOMNode_from_impl(This->node), attributeMap );
}
static HRESULT WINAPI dom_pi_insertBefore(
@ -292,7 +290,7 @@ static HRESULT WINAPI dom_pi_insertBefore(
IXMLDOMNode** outOldNode)
{
dom_pi *This = impl_from_IXMLDOMProcessingInstruction( iface );
return IXMLDOMNode_insertBefore( This->node, newNode, var1, outOldNode );
return IXMLDOMNode_insertBefore( IXMLDOMNode_from_impl(This->node), newNode, var1, outOldNode );
}
static HRESULT WINAPI dom_pi_replaceChild(
@ -302,7 +300,7 @@ static HRESULT WINAPI dom_pi_replaceChild(
IXMLDOMNode** outOldNode)
{
dom_pi *This = impl_from_IXMLDOMProcessingInstruction( iface );
return IXMLDOMNode_replaceChild( This->node, newNode, oldNode, outOldNode );
return IXMLDOMNode_replaceChild( IXMLDOMNode_from_impl(This->node), newNode, oldNode, outOldNode );
}
static HRESULT WINAPI dom_pi_removeChild(
@ -310,7 +308,7 @@ static HRESULT WINAPI dom_pi_removeChild(
IXMLDOMNode* domNode, IXMLDOMNode** oldNode)
{
dom_pi *This = impl_from_IXMLDOMProcessingInstruction( iface );
return IXMLDOMNode_removeChild( This->node, domNode, oldNode );
return IXMLDOMNode_removeChild( IXMLDOMNode_from_impl(This->node), domNode, oldNode );
}
static HRESULT WINAPI dom_pi_appendChild(
@ -318,7 +316,7 @@ static HRESULT WINAPI dom_pi_appendChild(
IXMLDOMNode* newNode, IXMLDOMNode** outNewNode)
{
dom_pi *This = impl_from_IXMLDOMProcessingInstruction( iface );
return IXMLDOMNode_appendChild( This->node, newNode, outNewNode );
return IXMLDOMNode_appendChild( IXMLDOMNode_from_impl(This->node), newNode, outNewNode );
}
static HRESULT WINAPI dom_pi_hasChildNodes(
@ -326,7 +324,7 @@ static HRESULT WINAPI dom_pi_hasChildNodes(
VARIANT_BOOL* pbool)
{
dom_pi *This = impl_from_IXMLDOMProcessingInstruction( iface );
return IXMLDOMNode_hasChildNodes( This->node, pbool );
return IXMLDOMNode_hasChildNodes( IXMLDOMNode_from_impl(This->node), pbool );
}
static HRESULT WINAPI dom_pi_get_ownerDocument(
@ -334,7 +332,7 @@ static HRESULT WINAPI dom_pi_get_ownerDocument(
IXMLDOMDocument** domDocument)
{
dom_pi *This = impl_from_IXMLDOMProcessingInstruction( iface );
return IXMLDOMNode_get_ownerDocument( This->node, domDocument );
return IXMLDOMNode_get_ownerDocument( IXMLDOMNode_from_impl(This->node), domDocument );
}
static HRESULT WINAPI dom_pi_cloneNode(
@ -342,7 +340,7 @@ static HRESULT WINAPI dom_pi_cloneNode(
VARIANT_BOOL pbool, IXMLDOMNode** outNode)
{
dom_pi *This = impl_from_IXMLDOMProcessingInstruction( iface );
return IXMLDOMNode_cloneNode( This->node, pbool, outNode );
return IXMLDOMNode_cloneNode( IXMLDOMNode_from_impl(This->node), pbool, outNode );
}
static HRESULT WINAPI dom_pi_get_nodeTypeString(
@ -350,7 +348,7 @@ static HRESULT WINAPI dom_pi_get_nodeTypeString(
BSTR* p)
{
dom_pi *This = impl_from_IXMLDOMProcessingInstruction( iface );
return IXMLDOMNode_get_nodeTypeString( This->node, p );
return IXMLDOMNode_get_nodeTypeString( IXMLDOMNode_from_impl(This->node), p );
}
static HRESULT WINAPI dom_pi_get_text(
@ -358,7 +356,7 @@ static HRESULT WINAPI dom_pi_get_text(
BSTR* p)
{
dom_pi *This = impl_from_IXMLDOMProcessingInstruction( iface );
return IXMLDOMNode_get_text( This->node, p );
return IXMLDOMNode_get_text( IXMLDOMNode_from_impl(This->node), p );
}
static HRESULT WINAPI dom_pi_put_text(
@ -366,7 +364,7 @@ static HRESULT WINAPI dom_pi_put_text(
BSTR p)
{
dom_pi *This = impl_from_IXMLDOMProcessingInstruction( iface );
return IXMLDOMNode_put_text( This->node, p );
return IXMLDOMNode_put_text( IXMLDOMNode_from_impl(This->node), p );
}
static HRESULT WINAPI dom_pi_get_specified(
@ -374,7 +372,7 @@ static HRESULT WINAPI dom_pi_get_specified(
VARIANT_BOOL* pbool)
{
dom_pi *This = impl_from_IXMLDOMProcessingInstruction( iface );
return IXMLDOMNode_get_specified( This->node, pbool );
return IXMLDOMNode_get_specified( IXMLDOMNode_from_impl(This->node), pbool );
}
static HRESULT WINAPI dom_pi_get_definition(
@ -382,7 +380,7 @@ static HRESULT WINAPI dom_pi_get_definition(
IXMLDOMNode** domNode)
{
dom_pi *This = impl_from_IXMLDOMProcessingInstruction( iface );
return IXMLDOMNode_get_definition( This->node, domNode );
return IXMLDOMNode_get_definition( IXMLDOMNode_from_impl(This->node), domNode );
}
static HRESULT WINAPI dom_pi_get_nodeTypedValue(
@ -390,7 +388,7 @@ static HRESULT WINAPI dom_pi_get_nodeTypedValue(
VARIANT* var1)
{
dom_pi *This = impl_from_IXMLDOMProcessingInstruction( iface );
return IXMLDOMNode_get_nodeTypedValue( This->node, var1 );
return IXMLDOMNode_get_nodeTypedValue( IXMLDOMNode_from_impl(This->node), var1 );
}
static HRESULT WINAPI dom_pi_put_nodeTypedValue(
@ -398,7 +396,7 @@ static HRESULT WINAPI dom_pi_put_nodeTypedValue(
VARIANT var1)
{
dom_pi *This = impl_from_IXMLDOMProcessingInstruction( iface );
return IXMLDOMNode_put_nodeTypedValue( This->node, var1 );
return IXMLDOMNode_put_nodeTypedValue( IXMLDOMNode_from_impl(This->node), var1 );
}
static HRESULT WINAPI dom_pi_get_dataType(
@ -406,7 +404,7 @@ static HRESULT WINAPI dom_pi_get_dataType(
VARIANT* var1)
{
dom_pi *This = impl_from_IXMLDOMProcessingInstruction( iface );
return IXMLDOMNode_get_dataType( This->node, var1 );
return IXMLDOMNode_get_dataType( IXMLDOMNode_from_impl(This->node), var1 );
}
static HRESULT WINAPI dom_pi_put_dataType(
@ -414,7 +412,7 @@ static HRESULT WINAPI dom_pi_put_dataType(
BSTR p)
{
dom_pi *This = impl_from_IXMLDOMProcessingInstruction( iface );
return IXMLDOMNode_put_dataType( This->node, p );
return IXMLDOMNode_put_dataType( IXMLDOMNode_from_impl(This->node), p );
}
static HRESULT WINAPI dom_pi_get_xml(
@ -422,7 +420,7 @@ static HRESULT WINAPI dom_pi_get_xml(
BSTR* p)
{
dom_pi *This = impl_from_IXMLDOMProcessingInstruction( iface );
return IXMLDOMNode_get_xml( This->node, p );
return IXMLDOMNode_get_xml( IXMLDOMNode_from_impl(This->node), p );
}
static HRESULT WINAPI dom_pi_transformNode(
@ -430,7 +428,7 @@ static HRESULT WINAPI dom_pi_transformNode(
IXMLDOMNode* domNode, BSTR* p)
{
dom_pi *This = impl_from_IXMLDOMProcessingInstruction( iface );
return IXMLDOMNode_transformNode( This->node, domNode, p );
return IXMLDOMNode_transformNode( IXMLDOMNode_from_impl(This->node), domNode, p );
}
static HRESULT WINAPI dom_pi_selectNodes(
@ -438,7 +436,7 @@ static HRESULT WINAPI dom_pi_selectNodes(
BSTR p, IXMLDOMNodeList** outList)
{
dom_pi *This = impl_from_IXMLDOMProcessingInstruction( iface );
return IXMLDOMNode_selectNodes( This->node, p, outList );
return IXMLDOMNode_selectNodes( IXMLDOMNode_from_impl(This->node), p, outList );
}
static HRESULT WINAPI dom_pi_selectSingleNode(
@ -446,7 +444,7 @@ static HRESULT WINAPI dom_pi_selectSingleNode(
BSTR p, IXMLDOMNode** outNode)
{
dom_pi *This = impl_from_IXMLDOMProcessingInstruction( iface );
return IXMLDOMNode_selectSingleNode( This->node, p, outNode );
return IXMLDOMNode_selectSingleNode( IXMLDOMNode_from_impl(This->node), p, outNode );
}
static HRESULT WINAPI dom_pi_get_parsed(
@ -454,7 +452,7 @@ static HRESULT WINAPI dom_pi_get_parsed(
VARIANT_BOOL* pbool)
{
dom_pi *This = impl_from_IXMLDOMProcessingInstruction( iface );
return IXMLDOMNode_get_parsed( This->node, pbool );
return IXMLDOMNode_get_parsed( IXMLDOMNode_from_impl(This->node), pbool );
}
static HRESULT WINAPI dom_pi_get_namespaceURI(
@ -462,7 +460,7 @@ static HRESULT WINAPI dom_pi_get_namespaceURI(
BSTR* p)
{
dom_pi *This = impl_from_IXMLDOMProcessingInstruction( iface );
return IXMLDOMNode_get_namespaceURI( This->node, p );
return IXMLDOMNode_get_namespaceURI( IXMLDOMNode_from_impl(This->node), p );
}
static HRESULT WINAPI dom_pi_get_prefix(
@ -470,7 +468,7 @@ static HRESULT WINAPI dom_pi_get_prefix(
BSTR* p)
{
dom_pi *This = impl_from_IXMLDOMProcessingInstruction( iface );
return IXMLDOMNode_get_prefix( This->node, p );
return IXMLDOMNode_get_prefix( IXMLDOMNode_from_impl(This->node), p );
}
static HRESULT WINAPI dom_pi_get_baseName(
@ -478,7 +476,7 @@ static HRESULT WINAPI dom_pi_get_baseName(
BSTR* p)
{
dom_pi *This = impl_from_IXMLDOMProcessingInstruction( iface );
return IXMLDOMNode_get_baseName( This->node, p );
return IXMLDOMNode_get_baseName( IXMLDOMNode_from_impl(This->node), p );
}
static HRESULT WINAPI dom_pi_transformNodeToObject(
@ -486,7 +484,7 @@ static HRESULT WINAPI dom_pi_transformNodeToObject(
IXMLDOMNode* domNode, VARIANT var1)
{
dom_pi *This = impl_from_IXMLDOMProcessingInstruction( iface );
return IXMLDOMNode_transformNodeToObject( This->node, domNode, var1 );
return IXMLDOMNode_transformNodeToObject( IXMLDOMNode_from_impl(This->node), domNode, var1 );
}
static HRESULT WINAPI dom_pi_get_target(
@ -495,7 +493,7 @@ static HRESULT WINAPI dom_pi_get_target(
{
/* target returns the same value as nodeName property */
dom_pi *This = impl_from_IXMLDOMProcessingInstruction( iface );
return IXMLDOMNode_get_nodeName( This->node, p );
return IXMLDOMNode_get_nodeName( IXMLDOMNode_from_impl(This->node), p );
}
static HRESULT WINAPI dom_pi_get_data(
@ -509,7 +507,7 @@ static HRESULT WINAPI dom_pi_get_data(
if(!p)
return E_INVALIDARG;
hr = IXMLDOMNode_get_nodeValue( This->node, &vRet );
hr = IXMLDOMNode_get_nodeValue( IXMLDOMNode_from_impl(This->node), &vRet );
if(hr == S_OK)
{
*p = V_BSTR(&vRet);
@ -546,7 +544,7 @@ static HRESULT WINAPI dom_pi_put_data(
V_VT(&val) = VT_BSTR;
V_BSTR(&val) = data;
hr = IXMLDOMNode_put_nodeValue( This->node, val );
hr = IXMLDOMNode_put_nodeValue( IXMLDOMNode_from_impl(This->node), val );
return hr;
}
@ -605,7 +603,6 @@ static const struct IXMLDOMProcessingInstructionVtbl dom_pi_vtbl =
IUnknown* create_pi( xmlNodePtr pi )
{
dom_pi *This;
xmlnode *node;
This = HeapAlloc( GetProcessHeap(), 0, sizeof *This );
if ( !This )
@ -614,16 +611,13 @@ IUnknown* create_pi( xmlNodePtr pi )
This->lpVtbl = &dom_pi_vtbl;
This->ref = 1;
node = create_basic_node( pi, (IUnknown*)&This->lpVtbl, NULL );
if(!node)
This->node = create_basic_node( pi, (IUnknown*)&This->lpVtbl, NULL );
if(!This->node)
{
HeapFree(GetProcessHeap(), 0, This);
return NULL;
}
This->node_unk = (IUnknown*)&node->lpInternalUnkVtbl;
This->node = IXMLDOMNode_from_impl(node);
return (IUnknown*) &This->lpVtbl;
}