ReactOS 0.4.16-dev-2208-g6350669
selection.c File Reference
#include <stdarg.h>
#include <libxml/parser.h>
#include <libxml/xmlerror.h>
#include <libxml/xpath.h>
#include <libxml/xpathInternals.h>
#include "windef.h"
#include "winbase.h"
#include "winuser.h"
#include "ole2.h"
#include "msxml6.h"
#include "msxml2did.h"
#include "msxml_private.h"
#include "wine/debug.h"
Include dependency graph for selection.c:

Go to the source code of this file.

Classes

struct  enumvariant
 
struct  domselection
 

Macros

#define COBJMACROS
 
#define XSLPATTERN_CHECK_ARGS(n)
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (msxml)
 
int registerNamespaces (xmlXPathContextPtr ctxt)
 
xmlCharXSLPattern_to_XPath (xmlXPathContextPtr ctxt, xmlChar const *xslpat_str)
 
static HRESULT selection_get_item (IUnknown *iface, LONG index, VARIANT *item)
 
static HRESULT selection_next (IUnknown *iface)
 
static domselectionimpl_from_IXMLDOMSelection (IXMLDOMSelection *iface)
 
static enumvariantimpl_from_IEnumVARIANT (IEnumVARIANT *iface)
 
static HRESULT WINAPI domselection_QueryInterface (IXMLDOMSelection *iface, REFIID riid, void **ppvObject)
 
static ULONG WINAPI domselection_AddRef (IXMLDOMSelection *iface)
 
static ULONG WINAPI domselection_Release (IXMLDOMSelection *iface)
 
static HRESULT WINAPI domselection_GetTypeInfoCount (IXMLDOMSelection *iface, UINT *pctinfo)
 
static HRESULT WINAPI domselection_GetTypeInfo (IXMLDOMSelection *iface, UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo)
 
static HRESULT WINAPI domselection_GetIDsOfNames (IXMLDOMSelection *iface, REFIID riid, LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
 
static HRESULT WINAPI domselection_Invoke (IXMLDOMSelection *iface, DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
 
static HRESULT WINAPI domselection_get_item (IXMLDOMSelection *iface, LONG index, IXMLDOMNode **listItem)
 
static HRESULT WINAPI domselection_get_length (IXMLDOMSelection *iface, LONG *listLength)
 
static HRESULT WINAPI domselection_nextNode (IXMLDOMSelection *iface, IXMLDOMNode **nextItem)
 
static HRESULT WINAPI domselection_reset (IXMLDOMSelection *iface)
 
static HRESULT WINAPI domselection_get__newEnum (IXMLDOMSelection *iface, IUnknown **enumv)
 
static HRESULT WINAPI domselection_get_expr (IXMLDOMSelection *iface, BSTR *p)
 
static HRESULT WINAPI domselection_put_expr (IXMLDOMSelection *iface, BSTR p)
 
static HRESULT WINAPI domselection_get_context (IXMLDOMSelection *iface, IXMLDOMNode **node)
 
static HRESULT WINAPI domselection_putref_context (IXMLDOMSelection *iface, IXMLDOMNode *node)
 
static HRESULT WINAPI domselection_peekNode (IXMLDOMSelection *iface, IXMLDOMNode **node)
 
static HRESULT WINAPI domselection_matches (IXMLDOMSelection *iface, IXMLDOMNode *node, IXMLDOMNode **out_node)
 
static HRESULT WINAPI domselection_removeNext (IXMLDOMSelection *iface, IXMLDOMNode **node)
 
static HRESULT WINAPI domselection_removeAll (IXMLDOMSelection *iface)
 
static HRESULT WINAPI domselection_clone (IXMLDOMSelection *iface, IXMLDOMSelection **node)
 
static HRESULT WINAPI domselection_getProperty (IXMLDOMSelection *iface, BSTR p, VARIANT *var)
 
static HRESULT WINAPI domselection_setProperty (IXMLDOMSelection *iface, BSTR p, VARIANT var)
 
static HRESULT WINAPI enumvariant_QueryInterface (IEnumVARIANT *iface, REFIID riid, void **ppvObject)
 
static ULONG WINAPI enumvariant_AddRef (IEnumVARIANT *iface)
 
static ULONG WINAPI enumvariant_Release (IEnumVARIANT *iface)
 
static HRESULT WINAPI enumvariant_Next (IEnumVARIANT *iface, ULONG celt, VARIANT *var, ULONG *fetched)
 
static HRESULT WINAPI enumvariant_Skip (IEnumVARIANT *iface, ULONG celt)
 
static HRESULT WINAPI enumvariant_Reset (IEnumVARIANT *iface)
 
static HRESULT WINAPI enumvariant_Clone (IEnumVARIANT *iface, IEnumVARIANT **ppenum)
 
HRESULT create_enumvariant (IUnknown *outer, BOOL own, const struct enumvariant_funcs *funcs, IEnumVARIANT **penum)
 
static HRESULT domselection_get_dispid (IUnknown *iface, BSTR name, DWORD flags, DISPID *dispid)
 
static HRESULT domselection_invoke (IUnknown *iface, DISPID id, LCID lcid, WORD flags, DISPPARAMS *params, VARIANT *res, EXCEPINFO *ei)
 
static void XSLPattern_index (xmlXPathParserContextPtr pctx, int nargs)
 
static void XSLPattern_end (xmlXPathParserContextPtr pctx, int nargs)
 
static void XSLPattern_nodeType (xmlXPathParserContextPtr pctx, int nargs)
 
static void XSLPattern_OP_IEq (xmlXPathParserContextPtr pctx, int nargs)
 
static void XSLPattern_OP_INEq (xmlXPathParserContextPtr pctx, int nargs)
 
static void XSLPattern_OP_ILt (xmlXPathParserContextPtr pctx, int nargs)
 
static void XSLPattern_OP_ILEq (xmlXPathParserContextPtr pctx, int nargs)
 
static void XSLPattern_OP_IGt (xmlXPathParserContextPtr pctx, int nargs)
 
static void XSLPattern_OP_IGEq (xmlXPathParserContextPtr pctx, int nargs)
 
static void query_serror (void *ctx, const xmlError *err)
 
HRESULT create_selection (xmlNodePtr node, xmlChar *query, IXMLDOMNodeList **out)
 

Variables

static const struct enumvariant_funcs selection_enumvariant
 
static const struct IXMLDOMSelectionVtbl domselection_vtbl
 
static const struct IEnumVARIANTVtbl EnumVARIANTVtbl
 
static const dispex_static_data_vtbl_t domselection_dispex_vtbl
 
static const tid_t domselection_iface_tids []
 
static dispex_static_data_t domselection_dispex
 

Macro Definition Documentation

◆ COBJMACROS

#define COBJMACROS

Definition at line 23 of file selection.c.

◆ XSLPATTERN_CHECK_ARGS

#define XSLPATTERN_CHECK_ARGS (   n)
Value:
if (nargs != n) { \
FIXME("XSLPattern syntax error: Expected %i arguments, got %i\n", n, nargs); \
xmlXPathSetArityError(pctx); \
return; \
}
GLdouble n
Definition: glext.h:7729

Definition at line 653 of file selection.c.

Function Documentation

◆ create_enumvariant()

HRESULT create_enumvariant ( IUnknown outer,
BOOL  own,
const struct enumvariant_funcs funcs,
IEnumVARIANT **  penum 
)

Definition at line 565 of file selection.c.

566{
568
569 This = malloc(sizeof(enumvariant));
570 if (!This) return E_OUTOFMEMORY;
571
572 This->IEnumVARIANT_iface.lpVtbl = &EnumVARIANTVtbl;
573 This->ref = 0;
574 This->outer = outer;
575 This->own = own;
576 This->pos = 0;
577 This->funcs = funcs;
578
579 if (This->own)
580 IUnknown_AddRef(This->outer);
581
582 *penum = &This->IEnumVARIANT_iface;
583 IEnumVARIANT_AddRef(*penum);
584 return S_OK;
585}
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define malloc
Definition: debug_ros.c:4
#define S_OK
Definition: intsafe.h:52
static const struct IEnumVARIANTVtbl EnumVARIANTVtbl
Definition: selection.c:554
static struct __wine_debug_functions funcs
Definition: debug.c:48

Referenced by domselection_get__newEnum(), domselection_QueryInterface(), schema_cache_get__newEnum(), xmlnodelist__newEnum(), xmlnodelist_QueryInterface(), xmlnodemap__newEnum(), and xmlnodemap_QueryInterface().

◆ create_selection()

HRESULT create_selection ( xmlNodePtr  node,
xmlChar query,
IXMLDOMNodeList **  out 
)

Definition at line 764 of file selection.c.

765{
767 xmlXPathContextPtr ctxt = xmlXPathNewContext(node->doc);
768 HRESULT hr;
769
770 TRACE("(%p, %s, %p)\n", node, debugstr_a((char const*)query), out);
771
772 *out = NULL;
773 if (!This || !ctxt || !query)
774 {
775 xmlXPathFreeContext(ctxt);
776 free(This);
777 return E_OUTOFMEMORY;
778 }
779
780 This->IXMLDOMSelection_iface.lpVtbl = &domselection_vtbl;
781 This->ref = 1;
782 This->resultPos = 0;
783 This->node = node;
784 This->enumvariant = NULL;
785 init_dispex(&This->dispex, (IUnknown*)&This->IXMLDOMSelection_iface, &domselection_dispex);
786 xmldoc_add_ref(This->node->doc);
787
788 ctxt->error = query_serror;
789 ctxt->node = node;
790 registerNamespaces(ctxt);
791 xmlXPathContextSetCache(ctxt, 1, -1, 0);
792
793 if (is_xpathmode(This->node->doc))
794 {
795 xmlXPathRegisterAllFunctions(ctxt);
796 This->result = xmlXPathEvalExpression(query, ctxt);
797 }
798 else
799 {
800 xmlChar* pattern_query = XSLPattern_to_XPath(ctxt, query);
801
802 xmlXPathRegisterFunc(ctxt, (xmlChar const*)"not", xmlXPathNotFunction);
803 xmlXPathRegisterFunc(ctxt, (xmlChar const*)"boolean", xmlXPathBooleanFunction);
804
805 xmlXPathRegisterFunc(ctxt, (xmlChar const*)"index", XSLPattern_index);
806 xmlXPathRegisterFunc(ctxt, (xmlChar const*)"end", XSLPattern_end);
807 xmlXPathRegisterFunc(ctxt, (xmlChar const*)"nodeType", XSLPattern_nodeType);
808
809 xmlXPathRegisterFunc(ctxt, (xmlChar const*)"OP_IEq", XSLPattern_OP_IEq);
810 xmlXPathRegisterFunc(ctxt, (xmlChar const*)"OP_INEq", XSLPattern_OP_INEq);
811 xmlXPathRegisterFunc(ctxt, (xmlChar const*)"OP_ILt", XSLPattern_OP_ILt);
812 xmlXPathRegisterFunc(ctxt, (xmlChar const*)"OP_ILEq", XSLPattern_OP_ILEq);
813 xmlXPathRegisterFunc(ctxt, (xmlChar const*)"OP_IGt", XSLPattern_OP_IGt);
814 xmlXPathRegisterFunc(ctxt, (xmlChar const*)"OP_IGEq", XSLPattern_OP_IGEq);
815
816 This->result = xmlXPathEvalExpression(pattern_query, ctxt);
817 xmlFree(pattern_query);
818 }
819
820 if (!This->result || This->result->type != XPATH_NODESET)
821 {
822 hr = E_FAIL;
823 goto cleanup;
824 }
825
826 *out = (IXMLDOMNodeList*)&This->IXMLDOMSelection_iface;
827 hr = S_OK;
828 TRACE("found %d matches\n", xmlXPathNodeSetGetLength(This->result->nodesetval));
829
830cleanup:
831 if (FAILED(hr))
832 IXMLDOMSelection_Release( &This->IXMLDOMSelection_iface );
833 xmlXPathFreeContext(ctxt);
834 return hr;
835}
#define E_FAIL
Definition: ddrawi.h:102
#define free
Definition: debug_ros.c:5
#define NULL
Definition: types.h:112
static void cleanup(void)
Definition: main.c:1335
LONG xmldoc_add_ref(xmlDocPtr doc)
Definition: domdoc.c:619
BOOL is_xpathmode(const xmlDocPtr doc)
Definition: domdoc.c:225
#define FAILED(hr)
Definition: intsafe.h:51
HRESULT init_dispex(jsdisp_t *dispex, script_ctx_t *ctx, const builtin_info_t *builtin_info, jsdisp_t *prototype)
Definition: dispex.c:919
#define debugstr_a
Definition: kernel32.h:31
static void XSLPattern_nodeType(xmlXPathParserContextPtr pctx, int nargs)
Definition: selection.c:681
static void XSLPattern_OP_INEq(xmlXPathParserContextPtr pctx, int nargs)
Definition: selection.c:699
static void XSLPattern_end(xmlXPathParserContextPtr pctx, int nargs)
Definition: selection.c:669
static void query_serror(void *ctx, const xmlError *err)
Definition: selection.c:759
int registerNamespaces(xmlXPathContextPtr ctxt)
Definition: domdoc.c:235
static void XSLPattern_index(xmlXPathParserContextPtr pctx, int nargs)
Definition: selection.c:661
static void XSLPattern_OP_IGEq(xmlXPathParserContextPtr pctx, int nargs)
Definition: selection.c:747
static dispex_static_data_t domselection_dispex
Definition: selection.c:646
static void XSLPattern_OP_IGt(xmlXPathParserContextPtr pctx, int nargs)
Definition: selection.c:735
static void XSLPattern_OP_ILEq(xmlXPathParserContextPtr pctx, int nargs)
Definition: selection.c:723
static void XSLPattern_OP_ILt(xmlXPathParserContextPtr pctx, int nargs)
Definition: selection.c:711
static void XSLPattern_OP_IEq(xmlXPathParserContextPtr pctx, int nargs)
Definition: selection.c:687
xmlChar * XSLPattern_to_XPath(xmlXPathContextPtr ctxt, xmlChar const *xslpat_str)
static const struct IXMLDOMSelectionVtbl domselection_vtbl
Definition: selection.c:409
xmlFreeFunc xmlFree
Definition: globals.c:184
HRESULT hr
Definition: shlfolder.c:183
#define TRACE(s)
Definition: solgame.cpp:4
Definition: dlist.c:348
wchar_t tm const _CrtWcstime_Writes_and_advances_ptr_ count wchar_t ** out
Definition: wcsftime.cpp:383
unsigned char xmlChar
Definition: xmlstring.h:28

Referenced by domdoc_getElementsByTagName(), domelem_getElementsByTagName(), and node_select_nodes().

◆ domselection_AddRef()

static ULONG WINAPI domselection_AddRef ( IXMLDOMSelection iface)
static

Definition at line 153 of file selection.c.

155{
158 TRACE("%p, refcount %lu.\n", iface, ref);
159 return ref;
160}
#define InterlockedIncrement
Definition: armddk.h:53
static domselection * impl_from_IXMLDOMSelection(IXMLDOMSelection *iface)
Definition: selection.c:99
Definition: send.c:48
uint32_t ULONG
Definition: typedefs.h:59

◆ domselection_clone()

static HRESULT WINAPI domselection_clone ( IXMLDOMSelection iface,
IXMLDOMSelection **  node 
)
static

Definition at line 380 of file selection.c.

383{
385 FIXME("(%p)->(%p)\n", This, node);
386 return E_NOTIMPL;
387}
#define FIXME(fmt,...)
Definition: precomp.h:53
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ domselection_get__newEnum()

static HRESULT WINAPI domselection_get__newEnum ( IXMLDOMSelection iface,
IUnknown **  enumv 
)
static

Definition at line 297 of file selection.c.

300{
302
303 TRACE("(%p)->(%p)\n", This, enumv);
304
306}
#define TRUE
Definition: types.h:120
HRESULT create_enumvariant(IUnknown *outer, BOOL own, const struct enumvariant_funcs *funcs, IEnumVARIANT **penum)
Definition: selection.c:565
static const struct enumvariant_funcs selection_enumvariant
Definition: selection.c:94

◆ domselection_get_context()

static HRESULT WINAPI domselection_get_context ( IXMLDOMSelection iface,
IXMLDOMNode **  node 
)
static

Definition at line 326 of file selection.c.

329{
331 FIXME("(%p)->(%p)\n", This, node);
332 return E_NOTIMPL;
333}

◆ domselection_get_dispid()

static HRESULT domselection_get_dispid ( IUnknown iface,
BSTR  name,
DWORD  flags,
DISPID dispid 
)
static

Definition at line 587 of file selection.c.

588{
589 WCHAR *ptr;
590 int idx = 0;
591
592 for(ptr = name; *ptr >= '0' && *ptr <= '9'; ptr++)
593 idx = idx*10 + (*ptr-'0');
594 if(*ptr)
595 return DISP_E_UNKNOWNNAME;
596
598 TRACE("ret %lx\n", *dispid);
599 return S_OK;
600}
unsigned int idx
Definition: utils.c:41
static PVOID ptr
Definition: dispmode.c:27
#define DISPID_DOM_COLLECTION_BASE
Definition: msxml2did.h:70
Definition: name.c:39
#define DISP_E_UNKNOWNNAME
Definition: winerror.h:3618
__wchar_t WCHAR
Definition: xmlstorage.h:180

◆ domselection_get_expr()

static HRESULT WINAPI domselection_get_expr ( IXMLDOMSelection iface,
BSTR p 
)
static

Definition at line 308 of file selection.c.

311{
313 FIXME("(%p)->(%p)\n", This, p);
314 return E_NOTIMPL;
315}
GLfloat GLfloat p
Definition: glext.h:8902

◆ domselection_get_item()

static HRESULT WINAPI domselection_get_item ( IXMLDOMSelection iface,
LONG  index,
IXMLDOMNode **  listItem 
)
static

Definition at line 228 of file selection.c.

232{
234
235 TRACE("%p, %ld, %p.\n", iface, index, listItem);
236
237 if(!listItem)
238 return E_INVALIDARG;
239
240 *listItem = NULL;
241
242 if (index < 0 || index >= xmlXPathNodeSetGetLength(This->result->nodesetval))
243 return S_FALSE;
244
245 *listItem = create_node(xmlXPathNodeSetItem(This->result->nodesetval, index));
246 This->resultPos = index + 1;
247
248 return S_OK;
249}
#define E_INVALIDARG
Definition: ddrawi.h:101
GLuint index
Definition: glext.h:6031
static HRESULT create_node(HTMLDocumentNode *, nsIDOMNode *, HTMLDOMNode **)
Definition: htmlnode.c:1216
#define S_FALSE
Definition: winerror.h:3451

◆ domselection_get_length()

static HRESULT WINAPI domselection_get_length ( IXMLDOMSelection iface,
LONG listLength 
)
static

Definition at line 251 of file selection.c.

254{
256
257 TRACE("(%p)->(%p)\n", This, listLength);
258
259 if(!listLength)
260 return E_INVALIDARG;
261
262 *listLength = xmlXPathNodeSetGetLength(This->result->nodesetval);
263 return S_OK;
264}

◆ domselection_GetIDsOfNames()

static HRESULT WINAPI domselection_GetIDsOfNames ( IXMLDOMSelection iface,
REFIID  riid,
LPOLESTR rgszNames,
UINT  cNames,
LCID  lcid,
DISPID rgDispId 
)
static

Definition at line 199 of file selection.c.

206{
208 return IDispatchEx_GetIDsOfNames(&This->dispex.IDispatchEx_iface,
209 riid, rgszNames, cNames, lcid, rgDispId);
210}
LCID lcid
Definition: locale.c:5656
REFIID riid
Definition: atlbase.h:39

◆ domselection_getProperty()

static HRESULT WINAPI domselection_getProperty ( IXMLDOMSelection iface,
BSTR  p,
VARIANT var 
)
static

Definition at line 389 of file selection.c.

393{
395 FIXME("(%p)->(%s %p)\n", This, debugstr_w(p), var);
396 return E_NOTIMPL;
397}
#define debugstr_w
Definition: kernel32.h:32
const char * var
Definition: shader.c:5666

◆ domselection_GetTypeInfo()

static HRESULT WINAPI domselection_GetTypeInfo ( IXMLDOMSelection iface,
UINT  iTInfo,
LCID  lcid,
ITypeInfo **  ppTInfo 
)
static

Definition at line 188 of file selection.c.

193{
195 return IDispatchEx_GetTypeInfo(&This->dispex.IDispatchEx_iface,
196 iTInfo, lcid, ppTInfo);
197}

◆ domselection_GetTypeInfoCount()

static HRESULT WINAPI domselection_GetTypeInfoCount ( IXMLDOMSelection iface,
UINT pctinfo 
)
static

Definition at line 180 of file selection.c.

183{
185 return IDispatchEx_GetTypeInfoCount(&This->dispex.IDispatchEx_iface, pctinfo);
186}

◆ domselection_invoke()

static HRESULT domselection_invoke ( IUnknown iface,
DISPID  id,
LCID  lcid,
WORD  flags,
DISPPARAMS *  params,
VARIANT res,
EXCEPINFO *  ei 
)
static

Definition at line 602 of file selection.c.

604{
606
607 TRACE("%p, %ld, %lx, %x, %p, %p, %p.\n", iface, id, lcid, flags, params, res, ei);
608
611
612 if (id < DISPID_DOM_COLLECTION_BASE || id > DISPID_DOM_COLLECTION_MAX)
613 return DISP_E_UNKNOWNNAME;
614
615 switch(flags)
616 {
617 case INVOKE_PROPERTYGET:
618 {
619 IXMLDOMNode *disp = NULL;
620
621 IXMLDOMSelection_get_item(&This->IXMLDOMSelection_iface, id - DISPID_DOM_COLLECTION_BASE, &disp);
622 V_DISPATCH(res) = (IDispatch*)disp;
623 break;
624 }
625 default:
626 {
627 FIXME("unimplemented flags %x\n", flags);
628 break;
629 }
630 }
631
632 TRACE("ret %p\n", V_DISPATCH(res));
633
634 return S_OK;
635}
@ VT_DISPATCH
Definition: compat.h:2304
GLuint res
Definition: glext.h:9613
GLenum const GLfloat * params
Definition: glext.h:5645
GLbitfield flags
Definition: glext.h:7161
#define DISPID_DOM_COLLECTION_MAX
Definition: msxml2did.h:71
#define V_VT(A)
Definition: oleauto.h:211
#define V_DISPATCH(A)
Definition: oleauto.h:239

◆ domselection_Invoke()

static HRESULT WINAPI domselection_Invoke ( IXMLDOMSelection iface,
DISPID  dispIdMember,
REFIID  riid,
LCID  lcid,
WORD  wFlags,
DISPPARAMS *  pDispParams,
VARIANT pVarResult,
EXCEPINFO *  pExcepInfo,
UINT puArgErr 
)
static

Definition at line 212 of file selection.c.

222{
224 return IDispatchEx_Invoke(&This->dispex.IDispatchEx_iface,
225 dispIdMember, riid, lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
226}
WINBASEAPI _In_ DWORD _Out_ _In_ WORD wFlags
Definition: wincon_undoc.h:337

◆ domselection_matches()

static HRESULT WINAPI domselection_matches ( IXMLDOMSelection iface,
IXMLDOMNode node,
IXMLDOMNode **  out_node 
)
static

Definition at line 353 of file selection.c.

357{
359 FIXME("(%p)->(%p %p)\n", This, node, out_node);
360 return E_NOTIMPL;
361}

◆ domselection_nextNode()

static HRESULT WINAPI domselection_nextNode ( IXMLDOMSelection iface,
IXMLDOMNode **  nextItem 
)
static

Definition at line 266 of file selection.c.

269{
271
272 TRACE("(%p)->(%p)\n", This, nextItem );
273
274 if(!nextItem)
275 return E_INVALIDARG;
276
277 *nextItem = NULL;
278
279 if (This->resultPos >= xmlXPathNodeSetGetLength(This->result->nodesetval))
280 return S_FALSE;
281
282 *nextItem = create_node(xmlXPathNodeSetItem(This->result->nodesetval, This->resultPos));
283 This->resultPos++;
284 return S_OK;
285}

◆ domselection_peekNode()

static HRESULT WINAPI domselection_peekNode ( IXMLDOMSelection iface,
IXMLDOMNode **  node 
)
static

Definition at line 344 of file selection.c.

347{
349 FIXME("(%p)->(%p)\n", This, node);
350 return E_NOTIMPL;
351}

◆ domselection_put_expr()

static HRESULT WINAPI domselection_put_expr ( IXMLDOMSelection iface,
BSTR  p 
)
static

Definition at line 317 of file selection.c.

320{
322 FIXME("(%p)->(%s)\n", This, debugstr_w(p));
323 return E_NOTIMPL;
324}

◆ domselection_putref_context()

static HRESULT WINAPI domselection_putref_context ( IXMLDOMSelection iface,
IXMLDOMNode node 
)
static

Definition at line 335 of file selection.c.

338{
340 FIXME("(%p)->(%p)\n", This, node);
341 return E_NOTIMPL;
342}

◆ domselection_QueryInterface()

static HRESULT WINAPI domselection_QueryInterface ( IXMLDOMSelection iface,
REFIID  riid,
void **  ppvObject 
)
static

Definition at line 109 of file selection.c.

113{
115
116 TRACE("(%p)->(%s %p)\n", iface, debugstr_guid(riid), ppvObject);
117
118 if(!ppvObject)
119 return E_INVALIDARG;
120
121 if ( IsEqualGUID( riid, &IID_IUnknown ) ||
122 IsEqualGUID( riid, &IID_IXMLDOMNodeList ) ||
123 IsEqualGUID( riid, &IID_IXMLDOMSelection ))
124 {
125 *ppvObject = &This->IXMLDOMSelection_iface;
126 }
127 else if (IsEqualGUID( riid, &IID_IEnumVARIANT ))
128 {
129 if (!This->enumvariant)
130 {
132 if (FAILED(hr)) return hr;
133 }
134
135 return IEnumVARIANT_QueryInterface(This->enumvariant, &IID_IEnumVARIANT, ppvObject);
136 }
137 else if (dispex_query_interface(&This->dispex, riid, ppvObject))
138 {
139 return *ppvObject ? S_OK : E_NOINTERFACE;
140 }
141 else
142 {
143 TRACE("interface %s not implemented\n", debugstr_guid(riid));
144 *ppvObject = NULL;
145 return E_NOINTERFACE;
146 }
147
148 IXMLDOMSelection_AddRef( iface );
149
150 return S_OK;
151}
const GUID IID_IUnknown
#define FALSE
Definition: types.h:117
#define debugstr_guid
Definition: kernel32.h:35
BOOL dispex_query_interface(DispatchEx *This, REFIID riid, void **ppv)
Definition: dispex.c:1656
#define IsEqualGUID(rguid1, rguid2)
Definition: guiddef.h:147
#define E_NOINTERFACE
Definition: winerror.h:3479

◆ domselection_Release()

static ULONG WINAPI domselection_Release ( IXMLDOMSelection iface)
static

Definition at line 162 of file selection.c.

164{
167
168 TRACE("%p, refcount %lu.\n", iface, ref);
169 if ( ref == 0 )
170 {
171 xmlXPathFreeObject(This->result);
172 xmldoc_release(This->node->doc);
173 if (This->enumvariant) IEnumVARIANT_Release(This->enumvariant);
174 free(This);
175 }
176
177 return ref;
178}
#define InterlockedDecrement
Definition: armddk.h:52
LONG xmldoc_release(xmlDocPtr doc)
Definition: domdoc.c:653

◆ domselection_removeAll()

static HRESULT WINAPI domselection_removeAll ( IXMLDOMSelection iface)
static

Definition at line 372 of file selection.c.

374{
376 FIXME("(%p)\n", This);
377 return E_NOTIMPL;
378}

◆ domselection_removeNext()

static HRESULT WINAPI domselection_removeNext ( IXMLDOMSelection iface,
IXMLDOMNode **  node 
)
static

Definition at line 363 of file selection.c.

366{
368 FIXME("(%p)->(%p)\n", This, node);
369 return E_NOTIMPL;
370}

◆ domselection_reset()

static HRESULT WINAPI domselection_reset ( IXMLDOMSelection iface)
static

Definition at line 287 of file selection.c.

289{
291
292 TRACE("%p\n", This);
293 This->resultPos = 0;
294 return S_OK;
295}

◆ domselection_setProperty()

static HRESULT WINAPI domselection_setProperty ( IXMLDOMSelection iface,
BSTR  p,
VARIANT  var 
)
static

Definition at line 399 of file selection.c.

403{
405 FIXME("(%p)->(%s %s)\n", This, debugstr_w(p), debugstr_variant(&var));
406 return E_NOTIMPL;
407}
static const char * debugstr_variant(const VARIANT *var)
Definition: container.c:46

◆ enumvariant_AddRef()

static ULONG WINAPI enumvariant_AddRef ( IEnumVARIANT iface)
static

Definition at line 467 of file selection.c.

468{
471 TRACE("%p, refcount %lu.\n", iface, ref);
472 return ref;
473}
static enumvariant * impl_from_IEnumVARIANT(IEnumVARIANT *iface)
Definition: selection.c:104

◆ enumvariant_Clone()

static HRESULT WINAPI enumvariant_Clone ( IEnumVARIANT iface,
IEnumVARIANT **  ppenum 
)
static

Definition at line 546 of file selection.c.

548{
550 FIXME("(%p)->(%p): stub\n", This, ppenum);
551 return E_NOTIMPL;
552}

◆ enumvariant_Next()

static HRESULT WINAPI enumvariant_Next ( IEnumVARIANT iface,
ULONG  celt,
VARIANT var,
ULONG fetched 
)
static

Definition at line 490 of file selection.c.

495{
497 ULONG ret_count = 0;
498
499 TRACE("%p, %lu, %p, %p.\n", iface, celt, var, fetched);
500
501 if (fetched) *fetched = 0;
502
503 if (celt && !var) return E_INVALIDARG;
504
505 for (; celt > 0; celt--, var++, This->pos++)
506 {
507 HRESULT hr = This->funcs->get_item(This->outer, This->pos, var);
508 if (hr != S_OK)
509 {
510 V_VT(var) = VT_EMPTY;
511 break;
512 }
513 ret_count++;
514 }
515
516 if (fetched) *fetched = ret_count;
517
518 /* we need to advance one step more for some reason */
519 if (ret_count)
520 {
521 if (This->funcs->next)
522 This->funcs->next(This->outer);
523 }
524
525 return celt == 0 ? S_OK : S_FALSE;
526}
@ VT_EMPTY
Definition: compat.h:2295

◆ enumvariant_QueryInterface()

static HRESULT WINAPI enumvariant_QueryInterface ( IEnumVARIANT iface,
REFIID  riid,
void **  ppvObject 
)
static

Definition at line 437 of file selection.c.

441{
443
444 TRACE("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppvObject);
445
446 *ppvObject = NULL;
447
449 {
450 if (This->own)
451 *ppvObject = &This->IEnumVARIANT_iface;
452 else
453 return IUnknown_QueryInterface(This->outer, riid, ppvObject);
454 }
455 else if (IsEqualGUID( riid, &IID_IEnumVARIANT ))
456 {
457 *ppvObject = &This->IEnumVARIANT_iface;
458 }
459 else
460 return IUnknown_QueryInterface(This->outer, riid, ppvObject);
461
462 IEnumVARIANT_AddRef( iface );
463
464 return S_OK;
465}

◆ enumvariant_Release()

static ULONG WINAPI enumvariant_Release ( IEnumVARIANT iface)
static

Definition at line 475 of file selection.c.

476{
479
480 TRACE("%p, refcount %lu.\n", iface, ref);
481 if ( ref == 0 )
482 {
483 if (This->own) IUnknown_Release(This->outer);
484 free(This);
485 }
486
487 return ref;
488}

◆ enumvariant_Reset()

static HRESULT WINAPI enumvariant_Reset ( IEnumVARIANT iface)
static

Definition at line 537 of file selection.c.

538{
540
541 TRACE("%p\n", This);
542 This->pos = 0;
543 return S_OK;
544}

◆ enumvariant_Skip()

static HRESULT WINAPI enumvariant_Skip ( IEnumVARIANT iface,
ULONG  celt 
)
static

Definition at line 528 of file selection.c.

531{
532 FIXME("%p, %lu: stub\n", iface, celt);
533
534 return E_NOTIMPL;
535}

◆ impl_from_IEnumVARIANT()

static enumvariant * impl_from_IEnumVARIANT ( IEnumVARIANT iface)
inlinestatic

Definition at line 104 of file selection.c.

105{
106 return CONTAINING_RECORD(iface, enumvariant, IEnumVARIANT_iface);
107}
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260

Referenced by enumvariant_AddRef(), enumvariant_Clone(), enumvariant_Next(), enumvariant_QueryInterface(), enumvariant_Release(), and enumvariant_Reset().

◆ impl_from_IXMLDOMSelection()

◆ query_serror()

static void query_serror ( void ctx,
const xmlError err 
)
static

Definition at line 759 of file selection.c.

760{
761 LIBXML2_CALLBACK_SERROR(domselection_create, err);
762}
#define LIBXML2_CALLBACK_SERROR(caller, err)
#define err(...)

Referenced by create_selection().

◆ registerNamespaces()

int registerNamespaces ( xmlXPathContextPtr  ctxt)

Definition at line 235 of file domdoc.c.

236{
237 int n = 0;
238 const select_ns_entry* ns = NULL;
239 const struct list* pNsList = &properties_from_xmlDocPtr(ctxt->doc)->selectNsList;
240
241 TRACE("(%p)\n", ctxt);
242
244 {
245 xmlXPathRegisterNs(ctxt, ns->prefix, ns->href);
246 ++n;
247 }
248
249 return n;
250}
Definition: list.h:37
static domdoc_properties * properties_from_xmlDocPtr(xmlDocPtr doc)
Definition: domdoc.c:220
uint32_t entry
Definition: isohybrid.c:63
#define LIST_FOR_EACH_ENTRY(elem, list, type, field)
Definition: list.h:198
Definition: domdoc.c:207
struct list selectNsList
Definition: domdoc.c:75
Definition: mxnamespace.c:38
BSTR prefix
Definition: mxnamespace.c:39

Referenced by create_selection().

◆ selection_get_item()

static HRESULT selection_get_item ( IUnknown iface,
LONG  index,
VARIANT item 
)
static

Definition at line 80 of file selection.c.

81{
83 return IXMLDOMSelection_get_item((IXMLDOMSelection*)iface, index, (IXMLDOMNode**)&V_DISPATCH(item));
84}

◆ selection_next()

static HRESULT selection_next ( IUnknown iface)
static

Definition at line 86 of file selection.c.

87{
89 HRESULT hr = IXMLDOMSelection_nextNode((IXMLDOMSelection*)iface, &node);
90 if (hr == S_OK) IXMLDOMNode_Release(node);
91 return hr;
92}

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( msxml  )

◆ XSLPattern_end()

static void XSLPattern_end ( xmlXPathParserContextPtr  pctx,
int  nargs 
)
static

Definition at line 669 of file selection.c.

670{
671 double pos, last;
673
674 xmlXPathPositionFunction(pctx, 0);
675 pos = xmlXPathPopNumber(pctx);
676 xmlXPathLastFunction(pctx, 0);
677 last = xmlXPathPopNumber(pctx);
678 xmlXPathReturnBoolean(pctx, pos == last);
679}
static UINT UINT last
Definition: font.c:45
#define XSLPATTERN_CHECK_ARGS(n)
Definition: selection.c:653

Referenced by create_selection().

◆ XSLPattern_index()

static void XSLPattern_index ( xmlXPathParserContextPtr  pctx,
int  nargs 
)
static

Definition at line 661 of file selection.c.

662{
664
665 xmlXPathPositionFunction(pctx, 0);
666 xmlXPathReturnNumber(pctx, xmlXPathPopNumber(pctx) - 1.0);
667}

Referenced by create_selection().

◆ XSLPattern_nodeType()

static void XSLPattern_nodeType ( xmlXPathParserContextPtr  pctx,
int  nargs 
)
static

Definition at line 681 of file selection.c.

682{
684 xmlXPathReturnNumber(pctx, pctx->context->node->type);
685}

Referenced by create_selection().

◆ XSLPattern_OP_IEq()

static void XSLPattern_OP_IEq ( xmlXPathParserContextPtr  pctx,
int  nargs 
)
static

Definition at line 687 of file selection.c.

688{
689 xmlChar *arg1, *arg2;
691
692 arg2 = xmlXPathPopString(pctx);
693 arg1 = xmlXPathPopString(pctx);
694 xmlXPathReturnBoolean(pctx, xmlStrcasecmp(arg1, arg2) == 0);
695 xmlFree(arg1);
696 xmlFree(arg2);
697}
GLuint GLuint GLuint GLuint arg1
Definition: glext.h:9513
GLuint GLuint GLuint GLuint GLuint GLuint GLuint arg2
Definition: glext.h:9514
XMLPUBFUN int xmlStrcasecmp(const xmlChar *str1, const xmlChar *str2)
Definition: xmlstring.c:277

Referenced by create_selection().

◆ XSLPattern_OP_IGEq()

static void XSLPattern_OP_IGEq ( xmlXPathParserContextPtr  pctx,
int  nargs 
)
static

Definition at line 747 of file selection.c.

748{
749 xmlChar *arg1, *arg2;
751
752 arg2 = xmlXPathPopString(pctx);
753 arg1 = xmlXPathPopString(pctx);
754 xmlXPathReturnBoolean(pctx, xmlStrcasecmp(arg1, arg2) >= 0);
755 xmlFree(arg1);
756 xmlFree(arg2);
757}

Referenced by create_selection().

◆ XSLPattern_OP_IGt()

static void XSLPattern_OP_IGt ( xmlXPathParserContextPtr  pctx,
int  nargs 
)
static

Definition at line 735 of file selection.c.

736{
737 xmlChar *arg1, *arg2;
739
740 arg2 = xmlXPathPopString(pctx);
741 arg1 = xmlXPathPopString(pctx);
742 xmlXPathReturnBoolean(pctx, xmlStrcasecmp(arg1, arg2) > 0);
743 xmlFree(arg1);
744 xmlFree(arg2);
745}

Referenced by create_selection().

◆ XSLPattern_OP_ILEq()

static void XSLPattern_OP_ILEq ( xmlXPathParserContextPtr  pctx,
int  nargs 
)
static

Definition at line 723 of file selection.c.

724{
725 xmlChar *arg1, *arg2;
727
728 arg2 = xmlXPathPopString(pctx);
729 arg1 = xmlXPathPopString(pctx);
730 xmlXPathReturnBoolean(pctx, xmlStrcasecmp(arg1, arg2) <= 0);
731 xmlFree(arg1);
732 xmlFree(arg2);
733}

Referenced by create_selection().

◆ XSLPattern_OP_ILt()

static void XSLPattern_OP_ILt ( xmlXPathParserContextPtr  pctx,
int  nargs 
)
static

Definition at line 711 of file selection.c.

712{
713 xmlChar *arg1, *arg2;
715
716 arg2 = xmlXPathPopString(pctx);
717 arg1 = xmlXPathPopString(pctx);
718 xmlXPathReturnBoolean(pctx, xmlStrcasecmp(arg1, arg2) < 0);
719 xmlFree(arg1);
720 xmlFree(arg2);
721}

Referenced by create_selection().

◆ XSLPattern_OP_INEq()

static void XSLPattern_OP_INEq ( xmlXPathParserContextPtr  pctx,
int  nargs 
)
static

Definition at line 699 of file selection.c.

700{
701 xmlChar *arg1, *arg2;
703
704 arg2 = xmlXPathPopString(pctx);
705 arg1 = xmlXPathPopString(pctx);
706 xmlXPathReturnBoolean(pctx, xmlStrcasecmp(arg1, arg2) != 0);
707 xmlFree(arg1);
708 xmlFree(arg2);
709}

Referenced by create_selection().

◆ XSLPattern_to_XPath()

xmlChar * XSLPattern_to_XPath ( xmlXPathContextPtr  ctxt,
xmlChar const xslpat_str 
)

Referenced by create_selection().

Variable Documentation

◆ domselection_dispex

dispex_static_data_t domselection_dispex
static
Initial value:
= {
}
static const dispex_static_data_vtbl_t domselection_dispex_vtbl
Definition: selection.c:637
static const tid_t domselection_iface_tids[]
Definition: selection.c:642
@ IXMLDOMSelection_tid
Definition: msxml_dispex.h:57

Definition at line 646 of file selection.c.

Referenced by create_selection().

◆ domselection_dispex_vtbl

const dispex_static_data_vtbl_t domselection_dispex_vtbl
static
Initial value:
= {
}
static HRESULT domselection_get_dispid(IUnknown *iface, BSTR name, DWORD flags, DISPID *dispid)
Definition: selection.c:587
static HRESULT domselection_invoke(IUnknown *iface, DISPID id, LCID lcid, WORD flags, DISPPARAMS *params, VARIANT *res, EXCEPINFO *ei)
Definition: selection.c:602

Definition at line 637 of file selection.c.

◆ domselection_iface_tids

const tid_t domselection_iface_tids[]
static
Initial value:

Definition at line 642 of file selection.c.

◆ domselection_vtbl

const struct IXMLDOMSelectionVtbl domselection_vtbl
static
Initial value:
=
{
}
static HRESULT WINAPI domselection_GetTypeInfo(IXMLDOMSelection *iface, UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo)
Definition: selection.c:188
static HRESULT WINAPI domselection_removeNext(IXMLDOMSelection *iface, IXMLDOMNode **node)
Definition: selection.c:363
static HRESULT WINAPI domselection_get_item(IXMLDOMSelection *iface, LONG index, IXMLDOMNode **listItem)
Definition: selection.c:228
static HRESULT WINAPI domselection_putref_context(IXMLDOMSelection *iface, IXMLDOMNode *node)
Definition: selection.c:335
static HRESULT WINAPI domselection_put_expr(IXMLDOMSelection *iface, BSTR p)
Definition: selection.c:317
static HRESULT WINAPI domselection_clone(IXMLDOMSelection *iface, IXMLDOMSelection **node)
Definition: selection.c:380
static HRESULT WINAPI domselection_peekNode(IXMLDOMSelection *iface, IXMLDOMNode **node)
Definition: selection.c:344
static HRESULT WINAPI domselection_QueryInterface(IXMLDOMSelection *iface, REFIID riid, void **ppvObject)
Definition: selection.c:109
static HRESULT WINAPI domselection_get__newEnum(IXMLDOMSelection *iface, IUnknown **enumv)
Definition: selection.c:297
static HRESULT WINAPI domselection_setProperty(IXMLDOMSelection *iface, BSTR p, VARIANT var)
Definition: selection.c:399
static HRESULT WINAPI domselection_GetIDsOfNames(IXMLDOMSelection *iface, REFIID riid, LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
Definition: selection.c:199
static HRESULT WINAPI domselection_matches(IXMLDOMSelection *iface, IXMLDOMNode *node, IXMLDOMNode **out_node)
Definition: selection.c:353
static ULONG WINAPI domselection_AddRef(IXMLDOMSelection *iface)
Definition: selection.c:153
static HRESULT WINAPI domselection_removeAll(IXMLDOMSelection *iface)
Definition: selection.c:372
static HRESULT WINAPI domselection_get_expr(IXMLDOMSelection *iface, BSTR *p)
Definition: selection.c:308
static HRESULT WINAPI domselection_Invoke(IXMLDOMSelection *iface, DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
Definition: selection.c:212
static HRESULT WINAPI domselection_GetTypeInfoCount(IXMLDOMSelection *iface, UINT *pctinfo)
Definition: selection.c:180
static HRESULT WINAPI domselection_reset(IXMLDOMSelection *iface)
Definition: selection.c:287
static HRESULT WINAPI domselection_get_length(IXMLDOMSelection *iface, LONG *listLength)
Definition: selection.c:251
static HRESULT WINAPI domselection_getProperty(IXMLDOMSelection *iface, BSTR p, VARIANT *var)
Definition: selection.c:389
static HRESULT WINAPI domselection_nextNode(IXMLDOMSelection *iface, IXMLDOMNode **nextItem)
Definition: selection.c:266
static HRESULT WINAPI domselection_get_context(IXMLDOMSelection *iface, IXMLDOMNode **node)
Definition: selection.c:326
static ULONG WINAPI domselection_Release(IXMLDOMSelection *iface)
Definition: selection.c:162

Definition at line 409 of file selection.c.

Referenced by create_selection().

◆ EnumVARIANTVtbl

const struct IEnumVARIANTVtbl EnumVARIANTVtbl
static
Initial value:
=
{
}
static HRESULT WINAPI enumvariant_Clone(IEnumVARIANT *iface, IEnumVARIANT **ppenum)
Definition: selection.c:546
static ULONG WINAPI enumvariant_Release(IEnumVARIANT *iface)
Definition: selection.c:475
static HRESULT WINAPI enumvariant_Reset(IEnumVARIANT *iface)
Definition: selection.c:537
static HRESULT WINAPI enumvariant_Skip(IEnumVARIANT *iface, ULONG celt)
Definition: selection.c:528
static HRESULT WINAPI enumvariant_QueryInterface(IEnumVARIANT *iface, REFIID riid, void **ppvObject)
Definition: selection.c:437
static ULONG WINAPI enumvariant_AddRef(IEnumVARIANT *iface)
Definition: selection.c:467
static HRESULT WINAPI enumvariant_Next(IEnumVARIANT *iface, ULONG celt, VARIANT *var, ULONG *fetched)
Definition: selection.c:490

Definition at line 554 of file selection.c.

Referenced by create_enumvariant().

◆ selection_enumvariant

const struct enumvariant_funcs selection_enumvariant
static
Initial value:
= {
}
static HRESULT selection_get_item(IUnknown *iface, LONG index, VARIANT *item)
Definition: selection.c:80
static HRESULT selection_next(IUnknown *iface)
Definition: selection.c:86

Definition at line 94 of file selection.c.

Referenced by domselection_get__newEnum(), and domselection_QueryInterface().