Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
03ad0acf
Commit
03ad0acf
authored
Jul 01, 2012
by
Nikolay Sivov
Committed by
Alexandre Julliard
Jul 02, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msxml3: Add IEnumVARIANT support for IXMLDOMNodeList.
parent
27eedd5f
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
79 additions
and
19 deletions
+79
-19
msxml_private.h
dlls/msxml3/msxml_private.h
+8
-0
nodelist.c
dlls/msxml3/nodelist.c
+27
-4
selection.c
dlls/msxml3/selection.c
+4
-12
domdoc.c
dlls/msxml3/tests/domdoc.c
+40
-3
No files found.
dlls/msxml3/msxml_private.h
View file @
03ad0acf
...
...
@@ -256,6 +256,13 @@ struct nodemap_funcs
HRESULT
(
*
next_node
)(
const
xmlNodePtr
,
LONG
*
,
IXMLDOMNode
**
);
};
/* used by IEnumVARIANT to access outer object items */
struct
enumvariant_funcs
{
HRESULT
(
*
get_item
)(
IUnknown
*
,
LONG
,
IDispatch
**
);
HRESULT
(
*
next
)(
IUnknown
*
);
};
/* constructors */
extern
IUnknown
*
create_domdoc
(
xmlNodePtr
)
DECLSPEC_HIDDEN
;
extern
IUnknown
*
create_xmldoc
(
void
)
DECLSPEC_HIDDEN
;
...
...
@@ -273,6 +280,7 @@ extern IUnknown *create_doc_fragment( xmlNodePtr ) DECLSPEC_HIDDEN;
extern
IUnknown
*
create_doc_entity_ref
(
xmlNodePtr
)
DECLSPEC_HIDDEN
;
extern
IUnknown
*
create_doc_type
(
xmlNodePtr
)
DECLSPEC_HIDDEN
;
extern
HRESULT
create_selection
(
xmlNodePtr
,
xmlChar
*
,
IXMLDOMNodeList
**
)
DECLSPEC_HIDDEN
;
extern
HRESULT
create_enumvariant
(
IUnknown
*
,
BOOL
,
const
struct
enumvariant_funcs
*
,
IEnumVARIANT
**
)
DECLSPEC_HIDDEN
;
/* data accessors */
xmlNodePtr
xmlNodePtr_from_domnode
(
IXMLDOMNode
*
iface
,
xmlElementType
type
)
DECLSPEC_HIDDEN
;
...
...
dlls/msxml3/nodelist.c
View file @
03ad0acf
...
...
@@ -52,15 +52,26 @@ WINE_DEFAULT_DEBUG_CHANNEL(msxml);
#ifdef HAVE_LIBXML2
typedef
struct
_xmlnodelist
typedef
struct
{
DispatchEx
dispex
;
IXMLDOMNodeList
IXMLDOMNodeList_iface
;
LONG
ref
;
xmlNodePtr
parent
;
xmlNodePtr
current
;
IEnumVARIANT
*
enumvariant
;
}
xmlnodelist
;
static
HRESULT
nodelist_get_item
(
IUnknown
*
iface
,
LONG
index
,
IDispatch
**
item
)
{
return
IXMLDOMNodeList_get_item
((
IXMLDOMNodeList
*
)
iface
,
index
,
(
IXMLDOMNode
**
)
item
);
}
static
const
struct
enumvariant_funcs
nodelist_enumvariant
=
{
nodelist_get_item
,
NULL
};
static
inline
xmlnodelist
*
impl_from_IXMLDOMNodeList
(
IXMLDOMNodeList
*
iface
)
{
return
CONTAINING_RECORD
(
iface
,
xmlnodelist
,
IXMLDOMNodeList_iface
);
...
...
@@ -81,6 +92,16 @@ static HRESULT WINAPI xmlnodelist_QueryInterface(
{
*
ppvObject
=
iface
;
}
else
if
(
IsEqualGUID
(
riid
,
&
IID_IEnumVARIANT
))
{
if
(
!
This
->
enumvariant
)
{
HRESULT
hr
=
create_enumvariant
((
IUnknown
*
)
iface
,
FALSE
,
&
nodelist_enumvariant
,
&
This
->
enumvariant
);
if
(
FAILED
(
hr
))
return
hr
;
}
return
IEnumVARIANT_QueryInterface
(
This
->
enumvariant
,
&
IID_IEnumVARIANT
,
ppvObject
);
}
else
if
(
dispex_query_interface
(
&
This
->
dispex
,
riid
,
ppvObject
))
{
return
*
ppvObject
?
S_OK
:
E_NOINTERFACE
;
...
...
@@ -116,6 +137,7 @@ static ULONG WINAPI xmlnodelist_Release(
if
(
ref
==
0
)
{
xmldoc_release
(
This
->
parent
->
doc
);
if
(
This
->
enumvariant
)
IEnumVARIANT_Release
(
This
->
enumvariant
);
heap_free
(
This
);
}
...
...
@@ -261,11 +283,11 @@ static HRESULT WINAPI xmlnodelist_reset(
static
HRESULT
WINAPI
xmlnodelist__newEnum
(
IXMLDOMNodeList
*
iface
,
IUnknown
**
ppUnk
)
IUnknown
**
enumv
)
{
xmlnodelist
*
This
=
impl_from_IXMLDOMNodeList
(
iface
);
FIXME
(
"(%p)->(%p)
\n
"
,
This
,
ppUnk
);
return
E_NOTIMPL
;
TRACE
(
"(%p)->(%p)
\n
"
,
This
,
enumv
);
return
create_enumvariant
((
IUnknown
*
)
iface
,
TRUE
,
&
nodelist_enumvariant
,
(
IEnumVARIANT
**
)
enumv
)
;
}
static
const
struct
IXMLDOMNodeListVtbl
xmlnodelist_vtbl
=
...
...
@@ -362,6 +384,7 @@ IXMLDOMNodeList* create_children_nodelist( xmlNodePtr node )
This
->
ref
=
1
;
This
->
parent
=
node
;
This
->
current
=
node
->
children
;
This
->
enumvariant
=
NULL
;
xmldoc_add_ref
(
node
->
doc
);
init_dispex
(
&
This
->
dispex
,
(
IUnknown
*
)
&
This
->
IXMLDOMNodeList_iface
,
&
xmlnodelist_dispex
);
...
...
dlls/msxml3/selection.c
View file @
03ad0acf
...
...
@@ -59,12 +59,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(msxml);
int
registerNamespaces
(
xmlXPathContextPtr
ctxt
);
xmlChar
*
XSLPattern_to_XPath
(
xmlXPathContextPtr
ctxt
,
xmlChar
const
*
xslpat_str
);
struct
enumvariant_funcs
{
HRESULT
(
*
get_item
)(
IUnknown
*
,
LONG
,
IDispatch
**
);
HRESULT
(
*
next
)(
IUnknown
*
);
};
typedef
struct
{
IEnumVARIANT
IEnumVARIANT_iface
;
...
...
@@ -117,8 +111,6 @@ static inline enumvariant *impl_from_IEnumVARIANT( IEnumVARIANT *iface )
return
CONTAINING_RECORD
(
iface
,
enumvariant
,
IEnumVARIANT_iface
);
}
static
HRESULT
create_enumvariant
(
IUnknown
*
,
BOOL
,
IEnumVARIANT
**
);
static
HRESULT
WINAPI
domselection_QueryInterface
(
IXMLDOMSelection
*
iface
,
REFIID
riid
,
...
...
@@ -141,7 +133,7 @@ static HRESULT WINAPI domselection_QueryInterface(
{
if
(
!
This
->
enumvariant
)
{
HRESULT
hr
=
create_enumvariant
((
IUnknown
*
)
iface
,
FALSE
,
&
This
->
enumvariant
);
HRESULT
hr
=
create_enumvariant
((
IUnknown
*
)
iface
,
FALSE
,
&
selection_enumvariant
,
&
This
->
enumvariant
);
if
(
FAILED
(
hr
))
return
hr
;
}
...
...
@@ -316,7 +308,7 @@ static HRESULT WINAPI domselection_get__newEnum(
TRACE
(
"(%p)->(%p)
\n
"
,
This
,
enumv
);
return
create_enumvariant
((
IUnknown
*
)
iface
,
TRUE
,
(
IEnumVARIANT
**
)
enumv
);
return
create_enumvariant
((
IUnknown
*
)
iface
,
TRUE
,
&
selection_enumvariant
,
(
IEnumVARIANT
**
)
enumv
);
}
static
HRESULT
WINAPI
domselection_get_expr
(
...
...
@@ -577,7 +569,7 @@ static const struct IEnumVARIANTVtbl EnumVARIANTVtbl =
enumvariant_Clone
};
static
HRESULT
create_enumvariant
(
IUnknown
*
outer
,
BOOL
own
,
IEnumVARIANT
**
penum
)
HRESULT
create_enumvariant
(
IUnknown
*
outer
,
BOOL
own
,
const
struct
enumvariant_funcs
*
funcs
,
IEnumVARIANT
**
penum
)
{
enumvariant
*
This
;
...
...
@@ -589,7 +581,7 @@ static HRESULT create_enumvariant(IUnknown *outer, BOOL own, IEnumVARIANT **penu
This
->
outer
=
outer
;
This
->
own
=
own
;
This
->
pos
=
0
;
This
->
funcs
=
&
selection_enumvariant
;
This
->
funcs
=
funcs
;
if
(
This
->
own
)
IUnknown_AddRef
(
This
->
outer
);
...
...
dlls/msxml3/tests/domdoc.c
View file @
03ad0acf
...
...
@@ -4130,6 +4130,7 @@ static void test_get_childNodes(void)
IXMLDOMElement
*
element
;
IUnknown
*
unk1
,
*
unk2
;
HRESULT
hr
;
VARIANT
v
;
BSTR
str
;
LONG
len
;
...
...
@@ -4153,8 +4154,7 @@ static void test_get_childNodes(void)
/* refcount tests for IEnumVARIANT support */
EXPECT_REF
(
node_list
,
1
);
hr
=
IXMLDOMNodeList_QueryInterface
(
node_list
,
&
IID_IEnumVARIANT
,
(
void
**
)
&
enum1
);
if
(
hr
==
S_OK
)
{
EXPECT_HR
(
hr
,
S_OK
);
EXPECT_REF
(
node_list
,
1
);
EXPECT_REF
(
enum1
,
2
);
...
...
@@ -4199,8 +4199,45 @@ if (hr == S_OK)
IEnumVARIANT_Release
(
enum3
);
IEnumVARIANT_Release
(
enum2
);
/* iteration tests */
hr
=
IXMLDOMNodeList_get_item
(
node_list
,
0
,
&
node
);
EXPECT_HR
(
hr
,
S_OK
);
hr
=
IXMLDOMNode_get_nodeName
(
node
,
&
str
);
EXPECT_HR
(
hr
,
S_OK
);
ok
(
!
lstrcmpW
(
str
,
_bstr_
(
"bs"
)),
"got %s
\n
"
,
wine_dbgstr_w
(
str
));
SysFreeString
(
str
);
IXMLDOMNode_Release
(
node
);
hr
=
IXMLDOMNodeList_nextNode
(
node_list
,
&
node
);
EXPECT_HR
(
hr
,
S_OK
);
hr
=
IXMLDOMNode_get_nodeName
(
node
,
&
str
);
EXPECT_HR
(
hr
,
S_OK
);
ok
(
!
lstrcmpW
(
str
,
_bstr_
(
"bs"
)),
"got %s
\n
"
,
wine_dbgstr_w
(
str
));
SysFreeString
(
str
);
IXMLDOMNode_Release
(
node
);
V_VT
(
&
v
)
=
VT_EMPTY
;
hr
=
IEnumVARIANT_Next
(
enum1
,
1
,
&
v
,
NULL
);
EXPECT_HR
(
hr
,
S_OK
);
ok
(
V_VT
(
&
v
)
==
VT_DISPATCH
,
"got var type %d
\n
"
,
V_VT
(
&
v
));
hr
=
IDispatch_QueryInterface
(
V_DISPATCH
(
&
v
),
&
IID_IXMLDOMNode
,
(
void
**
)
&
node
);
EXPECT_HR
(
hr
,
S_OK
);
hr
=
IXMLDOMNode_get_nodeName
(
node
,
&
str
);
EXPECT_HR
(
hr
,
S_OK
);
ok
(
!
lstrcmpW
(
str
,
_bstr_
(
"bs"
)),
"got node name %s
\n
"
,
wine_dbgstr_w
(
str
));
SysFreeString
(
str
);
IXMLDOMNode_Release
(
node
);
VariantClear
(
&
v
);
hr
=
IXMLDOMNodeList_nextNode
(
node_list
,
&
node
);
EXPECT_HR
(
hr
,
S_OK
);
hr
=
IXMLDOMNode_get_nodeName
(
node
,
&
str
);
EXPECT_HR
(
hr
,
S_OK
);
ok
(
!
lstrcmpW
(
str
,
_bstr_
(
"pr"
)),
"got %s
\n
"
,
wine_dbgstr_w
(
str
));
SysFreeString
(
str
);
IXMLDOMNode_Release
(
node
);
IEnumVARIANT_Release
(
enum1
);
}
hr
=
IXMLDOMNodeList_get_item
(
node_list
,
2
,
&
node
);
EXPECT_HR
(
hr
,
S_OK
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment