ReactOS 0.4.16-dev-2206-gc56950d
parseerror.c
Go to the documentation of this file.
1/*
2 * ParseError implementation
3 *
4 * Copyright 2005 Huw Davies
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19 */
20
21
22#define COBJMACROS
23
24#include <stdarg.h>
25
26#include "ole2.h"
27#include "msxml6.h"
28
29#include "msxml_dispex.h"
30
31#include "wine/debug.h"
32
34
35typedef struct
36{
40 LONG code, line, linepos, filepos;
41 BSTR url, reason, srcText;
43
45{
46 return CONTAINING_RECORD(iface, parse_error_t, IXMLDOMParseError2_iface);
47}
48
50 IXMLDOMParseError2 *iface,
52 void** ppvObject )
53{
55
56 TRACE("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppvObject);
57
58 if ( IsEqualGUID( riid, &IID_IUnknown ) ||
60 IsEqualGUID( riid, &IID_IXMLDOMParseError ) ||
61 IsEqualGUID( riid, &IID_IXMLDOMParseError2 ) )
62 {
63 *ppvObject = iface;
64 }
65 else if (dispex_query_interface(&This->dispex, riid, ppvObject))
66 {
67 return *ppvObject ? S_OK : E_NOINTERFACE;
68 }
69 else
70 {
71 FIXME("interface %s not implemented\n", debugstr_guid(riid));
72 *ppvObject = NULL;
73 return E_NOINTERFACE;
74 }
75
76 IXMLDOMParseError2_AddRef( iface );
77
78 return S_OK;
79}
80
82 IXMLDOMParseError2 *iface )
83{
86 TRACE("%p, refcount %lu.\n", iface, ref);
87 return ref;
88}
89
91 IXMLDOMParseError2 *iface )
92{
95
96 TRACE("%p, refcount %lu.\n", iface, ref);
97
98 if (!ref)
99 {
100 SysFreeString(This->url);
101 SysFreeString(This->reason);
102 SysFreeString(This->srcText);
103 free(This);
104 }
105
106 return ref;
107}
108
110 IXMLDOMParseError2 *iface,
111 UINT* pctinfo )
112{
114 return IDispatchEx_GetTypeInfoCount(&This->dispex.IDispatchEx_iface, pctinfo);
115}
116
118 IXMLDOMParseError2 *iface,
119 UINT iTInfo,
120 LCID lcid,
121 ITypeInfo** ppTInfo )
122{
124 return IDispatchEx_GetTypeInfo(&This->dispex.IDispatchEx_iface,
125 iTInfo, lcid, ppTInfo);
126}
127
129 IXMLDOMParseError2 *iface,
130 REFIID riid,
131 LPOLESTR* rgszNames,
132 UINT cNames,
133 LCID lcid,
134 DISPID* rgDispId )
135{
137 return IDispatchEx_GetIDsOfNames(&This->dispex.IDispatchEx_iface,
138 riid, rgszNames, cNames, lcid, rgDispId);
139}
140
142 IXMLDOMParseError2 *iface,
143 DISPID dispIdMember,
144 REFIID riid,
145 LCID lcid,
146 WORD wFlags,
147 DISPPARAMS* pDispParams,
148 VARIANT* pVarResult,
149 EXCEPINFO* pExcepInfo,
150 UINT* puArgErr )
151{
153 return IDispatchEx_Invoke(&This->dispex.IDispatchEx_iface,
154 dispIdMember, riid, lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
155}
156
158 IXMLDOMParseError2 *iface,
159 LONG *code )
160{
162 TRACE("(%p)->(%p)\n", This, code);
163
164 *code = This->code;
165
166 if(This->code == 0)
167 return S_FALSE;
168
169 return S_OK;
170}
171
173 IXMLDOMParseError2 *iface,
174 BSTR *url )
175{
177 FIXME("(%p)->(%p)\n", This, url);
178 return E_NOTIMPL;
179}
180
182 IXMLDOMParseError2 *iface,
183 BSTR *reason )
184{
186 TRACE("(%p)->(%p)\n", This, reason);
187
188 if(!This->reason)
189 {
190 *reason = NULL;
191 return S_FALSE;
192 }
193 *reason = SysAllocString(This->reason);
194 return S_OK;
195}
196
198 IXMLDOMParseError2 *iface,
199 BSTR *srcText )
200{
202
203 TRACE("(%p)->(%p)\n", This, srcText);
204
205 if (!srcText) return E_INVALIDARG;
206
207 *srcText = SysAllocString(This->srcText);
208
209 return S_OK;
210}
211
213 IXMLDOMParseError2 *iface,
214 LONG *line )
215{
217
218 TRACE("%p, %p.\n", This, line);
219
220 if (!line) return E_INVALIDARG;
221
222 *line = This->line;
223 return S_OK;
224}
225
227 IXMLDOMParseError2 *iface,
228 LONG *linepos )
229{
231
232 TRACE("(%p)->(%p)\n", This, linepos);
233
234 if (!linepos) return E_INVALIDARG;
235
236 *linepos = This->linepos;
237 return S_OK;
238}
239
241 IXMLDOMParseError2 *iface,
242 LONG *filepos )
243{
245 FIXME("(%p)->(%p)\n", This, filepos);
246 return E_NOTIMPL;
247}
248
250 IXMLDOMParseError2 *iface,
251 BSTR *xpathexpr)
252{
254 FIXME("(%p)->(%p)\n", This, xpathexpr);
255 return E_NOTIMPL;
256}
257
259 IXMLDOMParseError2 *iface,
260 IXMLDOMParseErrorCollection **allErrors)
261{
263 FIXME("(%p)->(%p)\n", This, allErrors);
264 return E_NOTIMPL;
265}
266
268 IXMLDOMParseError2 *iface,
269 LONG index,
270 BSTR *param)
271{
273 FIXME("(%p)->(%p)\n", This, param);
274 return E_NOTIMPL;
275}
276
278 IXMLDOMParseError2 *iface,
279 LONG *count)
280{
282 FIXME("(%p)->(%p)\n", This, count);
283 return E_NOTIMPL;
284}
285
286static const struct IXMLDOMParseError2Vtbl XMLDOMParseError2Vtbl =
287{
306};
307
308static const tid_t parseError_iface_tids[] = {
310 0
311};
312
314 NULL,
316 NULL,
318};
319
321 LONG line, LONG linepos, LONG filepos )
322{
324
325 This = malloc(sizeof(*This));
326 if ( !This )
327 return NULL;
328
329 This->IXMLDOMParseError2_iface.lpVtbl = &XMLDOMParseError2Vtbl;
330 This->ref = 1;
331
332 This->code = code;
333 This->url = url;
334 This->reason = reason;
335 This->srcText = srcText;
336 This->line = line;
337 This->linepos = linepos;
338 This->filepos = filepos;
339
340 init_dispex(&This->dispex, (IUnknown*)&This->IXMLDOMParseError2_iface, &parseError_dispex);
341
342 return (IXMLDOMParseError*)&This->IXMLDOMParseError2_iface;
343}
#define InterlockedIncrement
Definition: armddk.h:53
#define InterlockedDecrement
Definition: armddk.h:52
#define WINE_DEFAULT_DEBUG_CHANNEL(t)
Definition: precomp.h:23
#define FIXME(fmt,...)
Definition: precomp.h:53
const GUID IID_IUnknown
#define E_INVALIDARG
Definition: ddrawi.h:101
#define E_NOTIMPL
Definition: ddrawi.h:99
#define free
Definition: debug_ros.c:5
#define malloc
Definition: debug_ros.c:4
#define NULL
Definition: types.h:112
static WCHAR reason[MAX_STRING_RESOURCE_LEN]
Definition: object.c:1904
OLECHAR * BSTR
Definition: compat.h:2293
LCID lcid
Definition: locale.c:5656
unsigned short WORD
Definition: ntddk_ex.h:93
GLuint GLuint GLsizei count
Definition: gl.h:1545
GLuint index
Definition: glext.h:6031
GLfloat param
Definition: glext.h:5796
tid_t
Definition: ieframe.h:311
REFIID riid
Definition: atlbase.h:39
#define S_OK
Definition: intsafe.h:52
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_guid
Definition: kernel32.h:35
static const WCHAR url[]
Definition: encode.c:1384
static LPOLESTR
Definition: stg_prop.c:27
static VARIANTARG static DISPID
Definition: ordinal.c:49
BOOL dispex_query_interface(DispatchEx *This, REFIID riid, void **ppv)
Definition: dispex.c:1656
@ IXMLDOMParseError2_tid
Definition: msxml_dispex.h:53
unsigned int UINT
Definition: ndis.h:50
BSTR WINAPI SysAllocString(LPCOLESTR str)
Definition: oleaut.c:238
void WINAPI DECLSPEC_HOTPATCH SysFreeString(BSTR str)
Definition: oleaut.c:271
const GUID IID_IDispatch
static dispex_static_data_t parseError_dispex
Definition: parseerror.c:313
static HRESULT WINAPI parseError_errorParameters(IXMLDOMParseError2 *iface, LONG index, BSTR *param)
Definition: parseerror.c:267
static HRESULT WINAPI parseError_get_errorCode(IXMLDOMParseError2 *iface, LONG *code)
Definition: parseerror.c:157
static HRESULT WINAPI parseError_get_errorXPath(IXMLDOMParseError2 *iface, BSTR *xpathexpr)
Definition: parseerror.c:249
static HRESULT WINAPI parseError_get_linepos(IXMLDOMParseError2 *iface, LONG *linepos)
Definition: parseerror.c:226
static parse_error_t * impl_from_IXMLDOMParseError2(IXMLDOMParseError2 *iface)
Definition: parseerror.c:44
static HRESULT WINAPI parseError_get_reason(IXMLDOMParseError2 *iface, BSTR *reason)
Definition: parseerror.c:181
static HRESULT WINAPI parseError_get_errorParametersCount(IXMLDOMParseError2 *iface, LONG *count)
Definition: parseerror.c:277
static ULONG WINAPI parseError_Release(IXMLDOMParseError2 *iface)
Definition: parseerror.c:90
static HRESULT WINAPI parseError_GetIDsOfNames(IXMLDOMParseError2 *iface, REFIID riid, LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
Definition: parseerror.c:128
IXMLDOMParseError * create_parseError(LONG code, BSTR url, BSTR reason, BSTR srcText, LONG line, LONG linepos, LONG filepos)
Definition: parseerror.c:320
static HRESULT WINAPI parseError_Invoke(IXMLDOMParseError2 *iface, DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
Definition: parseerror.c:141
static HRESULT WINAPI parseError_GetTypeInfoCount(IXMLDOMParseError2 *iface, UINT *pctinfo)
Definition: parseerror.c:109
static HRESULT WINAPI parseError_get_filepos(IXMLDOMParseError2 *iface, LONG *filepos)
Definition: parseerror.c:240
static HRESULT WINAPI parseError_get_srcText(IXMLDOMParseError2 *iface, BSTR *srcText)
Definition: parseerror.c:197
static HRESULT WINAPI parseError_GetTypeInfo(IXMLDOMParseError2 *iface, UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo)
Definition: parseerror.c:117
static HRESULT WINAPI parseError_get_url(IXMLDOMParseError2 *iface, BSTR *url)
Definition: parseerror.c:172
static HRESULT WINAPI parseError_QueryInterface(IXMLDOMParseError2 *iface, REFIID riid, void **ppvObject)
Definition: parseerror.c:49
static ULONG WINAPI parseError_AddRef(IXMLDOMParseError2 *iface)
Definition: parseerror.c:81
static HRESULT WINAPI parseError_get_AllErrors(IXMLDOMParseError2 *iface, IXMLDOMParseErrorCollection **allErrors)
Definition: parseerror.c:258
static HRESULT WINAPI parseError_get_line(IXMLDOMParseError2 *iface, LONG *line)
Definition: parseerror.c:212
static const struct IXMLDOMParseError2Vtbl XMLDOMParseError2Vtbl
Definition: parseerror.c:286
static const tid_t parseError_iface_tids[]
Definition: parseerror.c:308
long LONG
Definition: pedump.c:60
#define IsEqualGUID(rguid1, rguid2)
Definition: guiddef.h:147
#define REFIID
Definition: guiddef.h:118
DWORD LCID
Definition: nls.h:13
#define TRACE(s)
Definition: solgame.cpp:4
Definition: inflate.c:139
Definition: parser.c:49
DispatchEx dispex
Definition: parseerror.c:37
IXMLDOMParseError2 IXMLDOMParseError2_iface
Definition: parseerror.c:38
Definition: send.c:48
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260
uint32_t ULONG
Definition: typedefs.h:59
WINBASEAPI _In_ DWORD _Out_ _In_ WORD wFlags
Definition: wincon_undoc.h:337
#define WINAPI
Definition: msvc.h:6
#define S_FALSE
Definition: winerror.h:3451
#define E_NOINTERFACE
Definition: winerror.h:3479