msxml: Add ISupportErrorInfo for named node maps.

This commit is contained in:
Huw Davies 2006-02-10 15:14:33 +01:00 committed by Alexandre Julliard
parent adb1335e4e
commit 5673a58297
2 changed files with 65 additions and 3 deletions

View File

@ -41,6 +41,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(msxml);
typedef struct _xmlnodemap typedef struct _xmlnodemap
{ {
const struct IXMLDOMNamedNodeMapVtbl *lpVtbl; const struct IXMLDOMNamedNodeMapVtbl *lpVtbl;
const struct ISupportErrorInfoVtbl *lpSEIVtbl;
LONG ref; LONG ref;
IXMLDOMNode *node; IXMLDOMNode *node;
} xmlnodemap; } xmlnodemap;
@ -50,19 +51,28 @@ static inline xmlnodemap *impl_from_IXMLDOMNamedNodeMap( IXMLDOMNamedNodeMap *if
return (xmlnodemap *)((char*)iface - FIELD_OFFSET(xmlnodemap, lpVtbl)); return (xmlnodemap *)((char*)iface - FIELD_OFFSET(xmlnodemap, lpVtbl));
} }
static inline xmlnodemap *impl_from_ISupportErrorInfo( ISupportErrorInfo *iface )
{
return (xmlnodemap *)((char*)iface - FIELD_OFFSET(xmlnodemap, lpSEIVtbl));
}
static HRESULT WINAPI xmlnodemap_QueryInterface( static HRESULT WINAPI xmlnodemap_QueryInterface(
IXMLDOMNamedNodeMap *iface, IXMLDOMNamedNodeMap *iface,
REFIID riid, void** ppvObject ) REFIID riid, void** ppvObject )
{ {
xmlnodemap *This = impl_from_IXMLDOMNamedNodeMap( iface );
TRACE("%p %s %p\n", iface, debugstr_guid(riid), ppvObject); TRACE("%p %s %p\n", iface, debugstr_guid(riid), ppvObject);
if( IsEqualGUID( riid, &IID_IXMLDOMElement ) || if( IsEqualGUID( riid, &IID_IUnknown ) ||
IsEqualGUID( riid, &IID_IUnknown ) ||
IsEqualGUID( riid, &IID_IDispatch ) || IsEqualGUID( riid, &IID_IDispatch ) ||
IsEqualGUID( riid, &IID_IXMLDOMNode ) ) IsEqualGUID( riid, &IID_IXMLDOMNamedNodeMap ) )
{ {
*ppvObject = iface; *ppvObject = iface;
} }
else if( IsEqualGUID( riid, &IID_ISupportErrorInfo ))
{
*ppvObject = &This->lpSEIVtbl;
}
else else
{ {
FIXME("interface %s not implemented\n", debugstr_guid(riid)); FIXME("interface %s not implemented\n", debugstr_guid(riid));
@ -321,6 +331,46 @@ static const struct IXMLDOMNamedNodeMapVtbl xmlnodemap_vtbl =
xmlnodemap__newEnum, xmlnodemap__newEnum,
}; };
static HRESULT WINAPI support_error_QueryInterface(
ISupportErrorInfo *iface,
REFIID riid, void** ppvObject )
{
xmlnodemap *This = impl_from_ISupportErrorInfo( iface );
TRACE("%p %s %p\n", iface, debugstr_guid(riid), ppvObject);
return IXMLDOMNamedNodeMap_QueryInterface((IXMLDOMNamedNodeMap*)&This->lpVtbl, riid, ppvObject);
}
static ULONG WINAPI support_error_AddRef(
ISupportErrorInfo *iface )
{
xmlnodemap *This = impl_from_ISupportErrorInfo( iface );
return IXMLDOMNamedNodeMap_AddRef((IXMLDOMNamedNodeMap*)&This->lpVtbl);
}
static ULONG WINAPI support_error_Release(
ISupportErrorInfo *iface )
{
xmlnodemap *This = impl_from_ISupportErrorInfo( iface );
return IXMLDOMNamedNodeMap_Release((IXMLDOMNamedNodeMap*)&This->lpVtbl);
}
static HRESULT WINAPI support_error_InterfaceSupportsErrorInfo(
ISupportErrorInfo *iface,
REFIID riid )
{
FIXME("(%p)->(%s)\n", iface, debugstr_guid(riid));
return S_FALSE;
}
static const struct ISupportErrorInfoVtbl support_error_vtbl =
{
support_error_QueryInterface,
support_error_AddRef,
support_error_Release,
support_error_InterfaceSupportsErrorInfo
};
IXMLDOMNamedNodeMap *create_nodemap( IXMLDOMNode *node ) IXMLDOMNamedNodeMap *create_nodemap( IXMLDOMNode *node )
{ {
xmlnodemap *nodemap; xmlnodemap *nodemap;
@ -330,6 +380,7 @@ IXMLDOMNamedNodeMap *create_nodemap( IXMLDOMNode *node )
return NULL; return NULL;
nodemap->lpVtbl = &xmlnodemap_vtbl; nodemap->lpVtbl = &xmlnodemap_vtbl;
nodemap->lpSEIVtbl = &support_error_vtbl;
nodemap->node = node; nodemap->node = node;
nodemap->ref = 1; nodemap->ref = 1;

View File

@ -347,6 +347,17 @@ void test_domnode( void )
if (map) if (map)
{ {
ISupportErrorInfo *support_error;
r = IXMLDOMNamedNodeMap_QueryInterface( map, &IID_ISupportErrorInfo, (LPVOID*)&support_error );
ok( r == S_OK, "ret %08lx\n", r );
r = ISupportErrorInfo_InterfaceSupportsErrorInfo( support_error, &IID_IXMLDOMNamedNodeMap );
todo_wine
{
ok( r == S_OK, "ret %08lx\n", r );
}
ISupportErrorInfo_Release( support_error );
str = SysAllocString( szdl ); str = SysAllocString( szdl );
r = IXMLDOMNamedNodeMap_getNamedItem( map, str, &node ); r = IXMLDOMNamedNodeMap_getNamedItem( map, str, &node );
ok( r == S_OK, "getNamedItem returned wrong code\n"); ok( r == S_OK, "getNamedItem returned wrong code\n");