2005-08-08 17:04:00 +02:00
|
|
|
/*
|
|
|
|
* Node map implementation
|
|
|
|
*
|
|
|
|
* Copyright 2005 Mike McCormack
|
|
|
|
*
|
2005-11-08 13:46:43 +01:00
|
|
|
* This library is free software; you can redistribute it and/or
|
2005-08-08 17:04:00 +02:00
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
2005-11-08 13:46:43 +01:00
|
|
|
* This library is distributed in the hope that it will be useful,
|
2005-08-08 17:04:00 +02:00
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
2006-05-18 14:49:52 +02:00
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
2005-08-08 17:04:00 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
|
|
|
|
#define COBJMACROS
|
|
|
|
|
|
|
|
#include <stdarg.h>
|
2011-02-24 13:11:53 +01:00
|
|
|
#ifdef HAVE_LIBXML2
|
|
|
|
# include <libxml/parser.h>
|
|
|
|
# include <libxml/xmlerror.h>
|
|
|
|
#endif
|
|
|
|
|
2005-08-08 17:04:00 +02:00
|
|
|
#include "windef.h"
|
|
|
|
#include "winbase.h"
|
|
|
|
#include "winuser.h"
|
|
|
|
#include "winnls.h"
|
|
|
|
#include "ole2.h"
|
2010-08-29 23:31:49 +02:00
|
|
|
#include "msxml6.h"
|
2011-11-04 16:59:05 +01:00
|
|
|
#include "msxml2did.h"
|
2005-08-08 17:04:00 +02:00
|
|
|
|
|
|
|
#include "msxml_private.h"
|
|
|
|
|
|
|
|
#include "wine/debug.h"
|
|
|
|
|
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(msxml);
|
|
|
|
|
2005-08-08 20:01:52 +02:00
|
|
|
#ifdef HAVE_LIBXML2
|
|
|
|
|
2012-07-03 08:06:59 +02:00
|
|
|
typedef struct
|
2005-08-08 17:04:00 +02:00
|
|
|
{
|
2011-11-04 16:59:05 +01:00
|
|
|
DispatchEx dispex;
|
2010-12-16 01:04:17 +01:00
|
|
|
IXMLDOMNamedNodeMap IXMLDOMNamedNodeMap_iface;
|
|
|
|
ISupportErrorInfo ISupportErrorInfo_iface;
|
2005-08-08 17:04:00 +02:00
|
|
|
LONG ref;
|
2011-03-10 19:56:51 +01:00
|
|
|
|
|
|
|
xmlNodePtr node;
|
2009-03-09 23:28:53 +01:00
|
|
|
LONG iterator;
|
2012-07-03 08:06:59 +02:00
|
|
|
IEnumVARIANT *enumvariant;
|
2011-11-12 22:45:10 +01:00
|
|
|
|
|
|
|
const struct nodemap_funcs *funcs;
|
2005-08-08 17:04:00 +02:00
|
|
|
} xmlnodemap;
|
|
|
|
|
2012-07-03 08:06:59 +02:00
|
|
|
static HRESULT nodemap_get_item(IUnknown *iface, LONG index, VARIANT *item)
|
|
|
|
{
|
|
|
|
V_VT(item) = VT_DISPATCH;
|
|
|
|
return IXMLDOMNamedNodeMap_get_item((IXMLDOMNamedNodeMap*)iface, index, (IXMLDOMNode**)&V_DISPATCH(item));
|
|
|
|
}
|
|
|
|
|
|
|
|
static const struct enumvariant_funcs nodemap_enumvariant = {
|
|
|
|
nodemap_get_item,
|
|
|
|
NULL
|
|
|
|
};
|
|
|
|
|
2005-08-08 17:04:00 +02:00
|
|
|
static inline xmlnodemap *impl_from_IXMLDOMNamedNodeMap( IXMLDOMNamedNodeMap *iface )
|
|
|
|
{
|
2010-12-16 01:04:17 +01:00
|
|
|
return CONTAINING_RECORD(iface, xmlnodemap, IXMLDOMNamedNodeMap_iface);
|
2005-08-08 17:04:00 +02:00
|
|
|
}
|
|
|
|
|
2006-02-10 15:14:33 +01:00
|
|
|
static inline xmlnodemap *impl_from_ISupportErrorInfo( ISupportErrorInfo *iface )
|
|
|
|
{
|
2010-12-16 01:04:17 +01:00
|
|
|
return CONTAINING_RECORD(iface, xmlnodemap, ISupportErrorInfo_iface);
|
2006-02-10 15:14:33 +01:00
|
|
|
}
|
|
|
|
|
2005-08-08 17:04:00 +02:00
|
|
|
static HRESULT WINAPI xmlnodemap_QueryInterface(
|
|
|
|
IXMLDOMNamedNodeMap *iface,
|
|
|
|
REFIID riid, void** ppvObject )
|
|
|
|
{
|
2006-02-10 15:14:33 +01:00
|
|
|
xmlnodemap *This = impl_from_IXMLDOMNamedNodeMap( iface );
|
2010-02-17 07:40:40 +01:00
|
|
|
TRACE("(%p)->(%s %p)\n", iface, debugstr_guid(riid), ppvObject);
|
2005-08-08 17:04:00 +02:00
|
|
|
|
2006-02-10 15:14:33 +01:00
|
|
|
if( IsEqualGUID( riid, &IID_IUnknown ) ||
|
2005-08-08 17:04:00 +02:00
|
|
|
IsEqualGUID( riid, &IID_IDispatch ) ||
|
2006-02-10 15:14:33 +01:00
|
|
|
IsEqualGUID( riid, &IID_IXMLDOMNamedNodeMap ) )
|
2005-08-08 17:04:00 +02:00
|
|
|
{
|
|
|
|
*ppvObject = iface;
|
|
|
|
}
|
2012-07-03 08:06:59 +02:00
|
|
|
else if (IsEqualGUID( riid, &IID_IEnumVARIANT ))
|
|
|
|
{
|
|
|
|
if (!This->enumvariant)
|
|
|
|
{
|
|
|
|
HRESULT hr = create_enumvariant((IUnknown*)iface, FALSE, &nodemap_enumvariant, &This->enumvariant);
|
|
|
|
if (FAILED(hr)) return hr;
|
|
|
|
}
|
|
|
|
|
|
|
|
return IEnumVARIANT_QueryInterface(This->enumvariant, &IID_IEnumVARIANT, ppvObject);
|
|
|
|
}
|
2011-11-04 16:59:05 +01:00
|
|
|
else if (dispex_query_interface(&This->dispex, riid, ppvObject))
|
|
|
|
{
|
|
|
|
return *ppvObject ? S_OK : E_NOINTERFACE;
|
|
|
|
}
|
2006-02-10 15:14:33 +01:00
|
|
|
else if( IsEqualGUID( riid, &IID_ISupportErrorInfo ))
|
|
|
|
{
|
2010-12-16 01:04:17 +01:00
|
|
|
*ppvObject = &This->ISupportErrorInfo_iface;
|
2006-02-10 15:14:33 +01:00
|
|
|
}
|
2005-08-08 17:04:00 +02:00
|
|
|
else
|
2006-01-27 19:22:56 +01:00
|
|
|
{
|
2011-03-13 14:40:26 +01:00
|
|
|
TRACE("interface %s not implemented\n", debugstr_guid(riid));
|
2011-02-28 20:28:53 +01:00
|
|
|
*ppvObject = NULL;
|
2005-08-08 17:04:00 +02:00
|
|
|
return E_NOINTERFACE;
|
2006-01-27 19:22:56 +01:00
|
|
|
}
|
2005-08-08 17:04:00 +02:00
|
|
|
|
|
|
|
IXMLDOMElement_AddRef( iface );
|
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI xmlnodemap_AddRef(
|
|
|
|
IXMLDOMNamedNodeMap *iface )
|
|
|
|
{
|
|
|
|
xmlnodemap *This = impl_from_IXMLDOMNamedNodeMap( iface );
|
2011-03-05 19:32:31 +01:00
|
|
|
ULONG ref = InterlockedIncrement( &This->ref );
|
|
|
|
TRACE("(%p)->(%d)\n", This, ref);
|
|
|
|
return ref;
|
2005-08-08 17:04:00 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI xmlnodemap_Release(
|
|
|
|
IXMLDOMNamedNodeMap *iface )
|
|
|
|
{
|
|
|
|
xmlnodemap *This = impl_from_IXMLDOMNamedNodeMap( iface );
|
2011-03-05 19:32:31 +01:00
|
|
|
ULONG ref = InterlockedDecrement( &This->ref );
|
2005-08-08 17:04:00 +02:00
|
|
|
|
2011-03-05 19:32:31 +01:00
|
|
|
TRACE("(%p)->(%d)\n", This, ref);
|
2005-08-08 17:04:00 +02:00
|
|
|
if ( ref == 0 )
|
|
|
|
{
|
2011-03-10 19:56:51 +01:00
|
|
|
xmldoc_release( This->node->doc );
|
2012-07-03 08:06:59 +02:00
|
|
|
if (This->enumvariant) IEnumVARIANT_Release(This->enumvariant);
|
2011-11-04 16:59:05 +01:00
|
|
|
release_dispex(&This->dispex);
|
2010-02-03 20:47:53 +01:00
|
|
|
heap_free( This );
|
2005-08-08 17:04:00 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
return ref;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI xmlnodemap_GetTypeInfoCount(
|
|
|
|
IXMLDOMNamedNodeMap *iface,
|
|
|
|
UINT* pctinfo )
|
|
|
|
{
|
2008-02-19 02:24:18 +01:00
|
|
|
xmlnodemap *This = impl_from_IXMLDOMNamedNodeMap( iface );
|
2011-11-19 17:32:23 +01:00
|
|
|
return IDispatchEx_GetTypeInfoCount(&This->dispex.IDispatchEx_iface, pctinfo);
|
2005-08-08 17:04:00 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI xmlnodemap_GetTypeInfo(
|
|
|
|
IXMLDOMNamedNodeMap *iface,
|
|
|
|
UINT iTInfo, LCID lcid,
|
|
|
|
ITypeInfo** ppTInfo )
|
|
|
|
{
|
2008-02-19 02:24:18 +01:00
|
|
|
xmlnodemap *This = impl_from_IXMLDOMNamedNodeMap( iface );
|
2011-11-19 17:32:23 +01:00
|
|
|
return IDispatchEx_GetTypeInfo(&This->dispex.IDispatchEx_iface,
|
|
|
|
iTInfo, lcid, ppTInfo);
|
2005-08-08 17:04:00 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI xmlnodemap_GetIDsOfNames(
|
|
|
|
IXMLDOMNamedNodeMap *iface,
|
|
|
|
REFIID riid, LPOLESTR* rgszNames,
|
|
|
|
UINT cNames, LCID lcid, DISPID* rgDispId )
|
|
|
|
{
|
2008-02-19 02:24:18 +01:00
|
|
|
xmlnodemap *This = impl_from_IXMLDOMNamedNodeMap( iface );
|
2011-11-19 17:32:23 +01:00
|
|
|
return IDispatchEx_GetIDsOfNames(&This->dispex.IDispatchEx_iface,
|
|
|
|
riid, rgszNames, cNames, lcid, rgDispId);
|
2005-08-08 17:04:00 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI xmlnodemap_Invoke(
|
|
|
|
IXMLDOMNamedNodeMap *iface,
|
|
|
|
DISPID dispIdMember, REFIID riid, LCID lcid,
|
|
|
|
WORD wFlags, DISPPARAMS* pDispParams, VARIANT* pVarResult,
|
|
|
|
EXCEPINFO* pExcepInfo, UINT* puArgErr )
|
|
|
|
{
|
2008-02-19 02:24:18 +01:00
|
|
|
xmlnodemap *This = impl_from_IXMLDOMNamedNodeMap( iface );
|
2011-11-19 17:32:23 +01:00
|
|
|
return IDispatchEx_Invoke(&This->dispex.IDispatchEx_iface,
|
|
|
|
dispIdMember, riid, lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
|
2005-08-08 17:04:00 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI xmlnodemap_getNamedItem(
|
|
|
|
IXMLDOMNamedNodeMap *iface,
|
|
|
|
BSTR name,
|
2011-11-12 15:14:11 +01:00
|
|
|
IXMLDOMNode** item)
|
2005-08-08 17:04:00 +02:00
|
|
|
{
|
|
|
|
xmlnodemap *This = impl_from_IXMLDOMNamedNodeMap( iface );
|
2011-11-12 15:14:11 +01:00
|
|
|
|
|
|
|
TRACE("(%p)->(%s %p)\n", This, debugstr_w(name), item );
|
|
|
|
|
2011-11-12 22:45:10 +01:00
|
|
|
return This->funcs->get_named_item(This->node, name, item);
|
2005-08-08 17:04:00 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI xmlnodemap_setNamedItem(
|
|
|
|
IXMLDOMNamedNodeMap *iface,
|
|
|
|
IXMLDOMNode* newItem,
|
|
|
|
IXMLDOMNode** namedItem)
|
|
|
|
{
|
2008-01-03 23:06:03 +01:00
|
|
|
xmlnodemap *This = impl_from_IXMLDOMNamedNodeMap( iface );
|
|
|
|
|
2010-02-17 07:40:40 +01:00
|
|
|
TRACE("(%p)->(%p %p)\n", This, newItem, namedItem );
|
2008-01-03 23:06:03 +01:00
|
|
|
|
2011-11-12 22:45:10 +01:00
|
|
|
return This->funcs->set_named_item(This->node, newItem, namedItem);
|
2005-08-08 17:04:00 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI xmlnodemap_removeNamedItem(
|
|
|
|
IXMLDOMNamedNodeMap *iface,
|
|
|
|
BSTR name,
|
|
|
|
IXMLDOMNode** namedItem)
|
|
|
|
{
|
2008-10-11 23:57:48 +02:00
|
|
|
xmlnodemap *This = impl_from_IXMLDOMNamedNodeMap( iface );
|
2011-11-12 22:45:10 +01:00
|
|
|
|
2010-02-17 07:40:40 +01:00
|
|
|
TRACE("(%p)->(%s %p)\n", This, debugstr_w(name), namedItem );
|
2011-11-12 22:45:10 +01:00
|
|
|
|
|
|
|
return This->funcs->remove_named_item(This->node, name, namedItem);
|
2005-08-08 17:04:00 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI xmlnodemap_get_item(
|
|
|
|
IXMLDOMNamedNodeMap *iface,
|
2009-03-09 23:28:16 +01:00
|
|
|
LONG index,
|
2011-11-12 22:45:10 +01:00
|
|
|
IXMLDOMNode** item)
|
2005-08-08 17:04:00 +02:00
|
|
|
{
|
2005-11-03 13:04:52 +01:00
|
|
|
xmlnodemap *This = impl_from_IXMLDOMNamedNodeMap( iface );
|
|
|
|
|
2011-11-12 22:45:10 +01:00
|
|
|
TRACE("(%p)->(%d %p)\n", This, index, item);
|
2005-11-03 13:04:52 +01:00
|
|
|
|
2011-11-12 22:45:10 +01:00
|
|
|
return This->funcs->get_item(This->node, index, item);
|
2005-08-08 17:04:00 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI xmlnodemap_get_length(
|
|
|
|
IXMLDOMNamedNodeMap *iface,
|
2011-11-12 22:45:10 +01:00
|
|
|
LONG *length)
|
2005-08-08 17:04:00 +02:00
|
|
|
{
|
2005-11-03 13:04:52 +01:00
|
|
|
xmlnodemap *This = impl_from_IXMLDOMNamedNodeMap( iface );
|
|
|
|
|
2011-11-12 22:45:10 +01:00
|
|
|
TRACE("(%p)->(%p)\n", This, length);
|
2005-11-03 13:04:52 +01:00
|
|
|
|
2011-11-12 22:45:10 +01:00
|
|
|
return This->funcs->get_length(This->node, length);
|
2005-08-08 17:04:00 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI xmlnodemap_getQualifiedItem(
|
|
|
|
IXMLDOMNamedNodeMap *iface,
|
|
|
|
BSTR baseName,
|
|
|
|
BSTR namespaceURI,
|
2011-11-12 22:45:10 +01:00
|
|
|
IXMLDOMNode** item)
|
2005-08-08 17:04:00 +02:00
|
|
|
{
|
2010-02-17 07:40:40 +01:00
|
|
|
xmlnodemap *This = impl_from_IXMLDOMNamedNodeMap( iface );
|
2010-09-03 10:13:29 +02:00
|
|
|
|
2011-11-12 22:45:10 +01:00
|
|
|
TRACE("(%p)->(%s %s %p)\n", This, debugstr_w(baseName), debugstr_w(namespaceURI), item);
|
2010-09-03 10:13:29 +02:00
|
|
|
|
2011-11-12 22:45:10 +01:00
|
|
|
return This->funcs->get_qualified_item(This->node, baseName, namespaceURI, item);
|
2005-08-08 17:04:00 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI xmlnodemap_removeQualifiedItem(
|
|
|
|
IXMLDOMNamedNodeMap *iface,
|
|
|
|
BSTR baseName,
|
|
|
|
BSTR namespaceURI,
|
2011-11-12 22:45:10 +01:00
|
|
|
IXMLDOMNode** item)
|
2005-08-08 17:04:00 +02:00
|
|
|
{
|
2010-02-17 07:40:40 +01:00
|
|
|
xmlnodemap *This = impl_from_IXMLDOMNamedNodeMap( iface );
|
2010-09-04 16:41:10 +02:00
|
|
|
|
2012-01-08 22:58:06 +01:00
|
|
|
TRACE("(%p)->(%s %s %p)\n", This, debugstr_w(baseName), debugstr_w(namespaceURI), item);
|
2010-09-04 16:41:10 +02:00
|
|
|
|
2011-11-12 22:45:10 +01:00
|
|
|
return This->funcs->remove_qualified_item(This->node, baseName, namespaceURI, item);
|
2005-08-08 17:04:00 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI xmlnodemap_nextNode(
|
|
|
|
IXMLDOMNamedNodeMap *iface,
|
|
|
|
IXMLDOMNode** nextItem)
|
|
|
|
{
|
2006-12-28 16:22:31 +01:00
|
|
|
xmlnodemap *This = impl_from_IXMLDOMNamedNodeMap( iface );
|
|
|
|
|
2010-02-17 07:40:40 +01:00
|
|
|
TRACE("(%p)->(%p: %d)\n", This, nextItem, This->iterator);
|
2006-12-28 16:22:31 +01:00
|
|
|
|
2011-11-12 22:45:10 +01:00
|
|
|
return This->funcs->next_node(This->node, &This->iterator, nextItem);
|
2005-08-08 17:04:00 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI xmlnodemap_reset(
|
|
|
|
IXMLDOMNamedNodeMap *iface )
|
|
|
|
{
|
2006-12-28 16:22:31 +01:00
|
|
|
xmlnodemap *This = impl_from_IXMLDOMNamedNodeMap( iface );
|
|
|
|
|
2012-01-08 22:58:06 +01:00
|
|
|
TRACE("(%p)->(%d)\n", This, This->iterator);
|
2006-12-28 16:22:31 +01:00
|
|
|
|
|
|
|
This->iterator = 0;
|
|
|
|
|
|
|
|
return S_OK;
|
2005-08-08 17:04:00 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI xmlnodemap__newEnum(
|
|
|
|
IXMLDOMNamedNodeMap *iface,
|
2012-07-03 08:06:59 +02:00
|
|
|
IUnknown** enumv)
|
2005-08-08 17:04:00 +02:00
|
|
|
{
|
2010-02-17 07:40:40 +01:00
|
|
|
xmlnodemap *This = impl_from_IXMLDOMNamedNodeMap( iface );
|
2012-07-03 08:06:59 +02:00
|
|
|
TRACE("(%p)->(%p)\n", This, enumv);
|
|
|
|
return create_enumvariant((IUnknown*)iface, TRUE, &nodemap_enumvariant, (IEnumVARIANT**)enumv);
|
2005-08-08 17:04:00 +02:00
|
|
|
}
|
|
|
|
|
2012-01-08 22:58:06 +01:00
|
|
|
static const struct IXMLDOMNamedNodeMapVtbl XMLDOMNamedNodeMapVtbl =
|
2005-08-08 17:04:00 +02:00
|
|
|
{
|
|
|
|
xmlnodemap_QueryInterface,
|
|
|
|
xmlnodemap_AddRef,
|
|
|
|
xmlnodemap_Release,
|
|
|
|
xmlnodemap_GetTypeInfoCount,
|
|
|
|
xmlnodemap_GetTypeInfo,
|
|
|
|
xmlnodemap_GetIDsOfNames,
|
|
|
|
xmlnodemap_Invoke,
|
|
|
|
xmlnodemap_getNamedItem,
|
|
|
|
xmlnodemap_setNamedItem,
|
|
|
|
xmlnodemap_removeNamedItem,
|
|
|
|
xmlnodemap_get_item,
|
|
|
|
xmlnodemap_get_length,
|
|
|
|
xmlnodemap_getQualifiedItem,
|
|
|
|
xmlnodemap_removeQualifiedItem,
|
|
|
|
xmlnodemap_nextNode,
|
|
|
|
xmlnodemap_reset,
|
|
|
|
xmlnodemap__newEnum,
|
|
|
|
};
|
|
|
|
|
2006-02-10 15:14:33 +01:00
|
|
|
static HRESULT WINAPI support_error_QueryInterface(
|
|
|
|
ISupportErrorInfo *iface,
|
|
|
|
REFIID riid, void** ppvObject )
|
|
|
|
{
|
|
|
|
xmlnodemap *This = impl_from_ISupportErrorInfo( iface );
|
2011-11-22 21:02:54 +01:00
|
|
|
TRACE("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppvObject);
|
2010-12-16 01:04:17 +01:00
|
|
|
return IXMLDOMNamedNodeMap_QueryInterface(&This->IXMLDOMNamedNodeMap_iface, riid, ppvObject);
|
2006-02-10 15:14:33 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI support_error_AddRef(
|
|
|
|
ISupportErrorInfo *iface )
|
|
|
|
{
|
|
|
|
xmlnodemap *This = impl_from_ISupportErrorInfo( iface );
|
2010-12-16 01:04:17 +01:00
|
|
|
return IXMLDOMNamedNodeMap_AddRef(&This->IXMLDOMNamedNodeMap_iface);
|
2006-02-10 15:14:33 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI support_error_Release(
|
|
|
|
ISupportErrorInfo *iface )
|
|
|
|
{
|
|
|
|
xmlnodemap *This = impl_from_ISupportErrorInfo( iface );
|
2010-12-16 01:04:17 +01:00
|
|
|
return IXMLDOMNamedNodeMap_Release(&This->IXMLDOMNamedNodeMap_iface);
|
2006-02-10 15:14:33 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI support_error_InterfaceSupportsErrorInfo(
|
|
|
|
ISupportErrorInfo *iface,
|
|
|
|
REFIID riid )
|
|
|
|
{
|
2011-11-22 21:02:54 +01:00
|
|
|
xmlnodemap *This = impl_from_ISupportErrorInfo( iface );
|
|
|
|
TRACE("(%p)->(%s)\n", This, debugstr_guid(riid));
|
|
|
|
return IsEqualGUID(riid, &IID_IXMLDOMNamedNodeMap) ? S_OK : S_FALSE;
|
2006-02-10 15:14:33 +01:00
|
|
|
}
|
|
|
|
|
2012-01-08 22:58:06 +01:00
|
|
|
static const struct ISupportErrorInfoVtbl SupportErrorInfoVtbl =
|
2006-02-10 15:14:33 +01:00
|
|
|
{
|
|
|
|
support_error_QueryInterface,
|
|
|
|
support_error_AddRef,
|
|
|
|
support_error_Release,
|
|
|
|
support_error_InterfaceSupportsErrorInfo
|
|
|
|
};
|
|
|
|
|
2011-11-04 16:59:05 +01:00
|
|
|
static HRESULT xmlnodemap_get_dispid(IUnknown *iface, BSTR name, DWORD flags, DISPID *dispid)
|
|
|
|
{
|
|
|
|
WCHAR *ptr;
|
|
|
|
int idx = 0;
|
|
|
|
|
|
|
|
for(ptr = name; *ptr && isdigitW(*ptr); ptr++)
|
|
|
|
idx = idx*10 + (*ptr-'0');
|
|
|
|
if(*ptr)
|
|
|
|
return DISP_E_UNKNOWNNAME;
|
|
|
|
|
|
|
|
*dispid = DISPID_DOM_COLLECTION_BASE + idx;
|
|
|
|
TRACE("ret %x\n", *dispid);
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT xmlnodemap_invoke(IUnknown *iface, DISPID id, LCID lcid, WORD flags, DISPPARAMS *params,
|
|
|
|
VARIANT *res, EXCEPINFO *ei)
|
|
|
|
{
|
|
|
|
xmlnodemap *This = impl_from_IXMLDOMNamedNodeMap( (IXMLDOMNamedNodeMap*)iface );
|
|
|
|
|
|
|
|
TRACE("(%p)->(%x %x %x %p %p %p)\n", This, id, lcid, flags, params, res, ei);
|
|
|
|
|
|
|
|
V_VT(res) = VT_DISPATCH;
|
|
|
|
V_DISPATCH(res) = NULL;
|
|
|
|
|
|
|
|
if (id < DISPID_DOM_COLLECTION_BASE || id > DISPID_DOM_COLLECTION_MAX)
|
|
|
|
return DISP_E_UNKNOWNNAME;
|
|
|
|
|
|
|
|
switch(flags)
|
|
|
|
{
|
|
|
|
case INVOKE_PROPERTYGET:
|
|
|
|
{
|
|
|
|
IXMLDOMNode *disp = NULL;
|
|
|
|
|
|
|
|
IXMLDOMNamedNodeMap_get_item(&This->IXMLDOMNamedNodeMap_iface, id - DISPID_DOM_COLLECTION_BASE, &disp);
|
|
|
|
V_DISPATCH(res) = (IDispatch*)disp;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
default:
|
|
|
|
{
|
|
|
|
FIXME("unimplemented flags %x\n", flags);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
TRACE("ret %p\n", V_DISPATCH(res));
|
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static const dispex_static_data_vtbl_t xmlnodemap_dispex_vtbl = {
|
|
|
|
xmlnodemap_get_dispid,
|
|
|
|
xmlnodemap_invoke
|
|
|
|
};
|
|
|
|
|
|
|
|
static const tid_t xmlnodemap_iface_tids[] = {
|
|
|
|
IXMLDOMNamedNodeMap_tid,
|
|
|
|
0
|
|
|
|
};
|
|
|
|
|
|
|
|
static dispex_static_data_t xmlnodemap_dispex = {
|
|
|
|
&xmlnodemap_dispex_vtbl,
|
|
|
|
IXMLDOMNamedNodeMap_tid,
|
|
|
|
NULL,
|
|
|
|
xmlnodemap_iface_tids
|
|
|
|
};
|
|
|
|
|
2011-11-12 22:45:10 +01:00
|
|
|
IXMLDOMNamedNodeMap *create_nodemap(xmlNodePtr node, const struct nodemap_funcs *funcs)
|
2005-08-08 17:04:00 +02:00
|
|
|
{
|
2011-11-04 16:59:05 +01:00
|
|
|
xmlnodemap *This;
|
2005-08-08 17:04:00 +02:00
|
|
|
|
2011-11-04 16:59:05 +01:00
|
|
|
This = heap_alloc( sizeof *This );
|
|
|
|
if ( !This )
|
2005-08-18 12:48:13 +02:00
|
|
|
return NULL;
|
2005-08-08 17:04:00 +02:00
|
|
|
|
2012-01-08 22:58:06 +01:00
|
|
|
This->IXMLDOMNamedNodeMap_iface.lpVtbl = &XMLDOMNamedNodeMapVtbl;
|
|
|
|
This->ISupportErrorInfo_iface.lpVtbl = &SupportErrorInfoVtbl;
|
2011-11-04 16:59:05 +01:00
|
|
|
This->node = node;
|
|
|
|
This->ref = 1;
|
|
|
|
This->iterator = 0;
|
2012-07-03 08:06:59 +02:00
|
|
|
This->enumvariant = NULL;
|
2011-11-12 22:45:10 +01:00
|
|
|
This->funcs = funcs;
|
2011-11-04 16:59:05 +01:00
|
|
|
|
|
|
|
init_dispex(&This->dispex, (IUnknown*)&This->IXMLDOMNamedNodeMap_iface, &xmlnodemap_dispex);
|
2005-08-08 17:04:00 +02:00
|
|
|
|
2011-03-10 19:56:51 +01:00
|
|
|
xmldoc_add_ref(node->doc);
|
2005-08-08 17:04:00 +02:00
|
|
|
|
2011-11-04 16:59:05 +01:00
|
|
|
return &This->IXMLDOMNamedNodeMap_iface;
|
2005-08-08 17:04:00 +02:00
|
|
|
}
|
2005-08-08 20:01:52 +02:00
|
|
|
|
|
|
|
#endif
|