2 * ParseError implementation
4 * Copyright 2005 Huw Davies
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.
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.
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
26 IXMLDOMParseError2 IXMLDOMParseError2_iface
;
28 LONG code
, line
, linepos
, filepos
;
29 BSTR url
, reason
, srcText
;
32 static inline parse_error_t
*impl_from_IXMLDOMParseError2( IXMLDOMParseError2
*iface
)
34 return CONTAINING_RECORD(iface
, parse_error_t
, IXMLDOMParseError2_iface
);
37 static HRESULT WINAPI
parseError_QueryInterface(
38 IXMLDOMParseError2
*iface
,
42 parse_error_t
*This
= impl_from_IXMLDOMParseError2( iface
);
44 TRACE("(%p)->(%s %p)\n", This
, debugstr_guid(riid
), ppvObject
);
46 if ( IsEqualGUID( riid
, &IID_IUnknown
) ||
47 IsEqualGUID( riid
, &IID_IDispatch
) ||
48 IsEqualGUID( riid
, &IID_IXMLDOMParseError
) ||
49 IsEqualGUID( riid
, &IID_IXMLDOMParseError2
) )
53 else if (dispex_query_interface(&This
->dispex
, riid
, ppvObject
))
55 return *ppvObject
? S_OK
: E_NOINTERFACE
;
59 FIXME("interface %s not implemented\n", debugstr_guid(riid
));
64 IXMLDOMParseError2_AddRef( iface
);
69 static ULONG WINAPI
parseError_AddRef(
70 IXMLDOMParseError2
*iface
)
72 parse_error_t
*This
= impl_from_IXMLDOMParseError2( iface
);
73 ULONG ref
= InterlockedIncrement( &This
->ref
);
74 TRACE("(%p)->(%d)\n", This
, ref
);
78 static ULONG WINAPI
parseError_Release(
79 IXMLDOMParseError2
*iface
)
81 parse_error_t
*This
= impl_from_IXMLDOMParseError2( iface
);
82 ULONG ref
= InterlockedDecrement( &This
->ref
);
84 TRACE("(%p)->(%d)\n", This
, ref
);
87 SysFreeString(This
->url
);
88 SysFreeString(This
->reason
);
89 SysFreeString(This
->srcText
);
96 static HRESULT WINAPI
parseError_GetTypeInfoCount(
97 IXMLDOMParseError2
*iface
,
100 parse_error_t
*This
= impl_from_IXMLDOMParseError2( iface
);
101 return IDispatchEx_GetTypeInfoCount(&This
->dispex
.IDispatchEx_iface
, pctinfo
);
104 static HRESULT WINAPI
parseError_GetTypeInfo(
105 IXMLDOMParseError2
*iface
,
108 ITypeInfo
** ppTInfo
)
110 parse_error_t
*This
= impl_from_IXMLDOMParseError2( iface
);
111 return IDispatchEx_GetTypeInfo(&This
->dispex
.IDispatchEx_iface
,
112 iTInfo
, lcid
, ppTInfo
);
115 static HRESULT WINAPI
parseError_GetIDsOfNames(
116 IXMLDOMParseError2
*iface
,
123 parse_error_t
*This
= impl_from_IXMLDOMParseError2( iface
);
124 return IDispatchEx_GetIDsOfNames(&This
->dispex
.IDispatchEx_iface
,
125 riid
, rgszNames
, cNames
, lcid
, rgDispId
);
128 static HRESULT WINAPI
parseError_Invoke(
129 IXMLDOMParseError2
*iface
,
134 DISPPARAMS
* pDispParams
,
136 EXCEPINFO
* pExcepInfo
,
139 parse_error_t
*This
= impl_from_IXMLDOMParseError2( iface
);
140 return IDispatchEx_Invoke(&This
->dispex
.IDispatchEx_iface
,
141 dispIdMember
, riid
, lcid
, wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
144 static HRESULT WINAPI
parseError_get_errorCode(
145 IXMLDOMParseError2
*iface
,
148 parse_error_t
*This
= impl_from_IXMLDOMParseError2( iface
);
149 TRACE("(%p)->(%p)\n", This
, code
);
159 static HRESULT WINAPI
parseError_get_url(
160 IXMLDOMParseError2
*iface
,
163 parse_error_t
*This
= impl_from_IXMLDOMParseError2( iface
);
164 FIXME("(%p)->(%p)\n", This
, url
);
168 static HRESULT WINAPI
parseError_get_reason(
169 IXMLDOMParseError2
*iface
,
172 parse_error_t
*This
= impl_from_IXMLDOMParseError2( iface
);
173 TRACE("(%p)->(%p)\n", This
, reason
);
180 *reason
= SysAllocString(This
->reason
);
184 static HRESULT WINAPI
parseError_get_srcText(
185 IXMLDOMParseError2
*iface
,
188 parse_error_t
*This
= impl_from_IXMLDOMParseError2( iface
);
190 TRACE("(%p)->(%p)\n", This
, srcText
);
192 if (!srcText
) return E_INVALIDARG
;
194 *srcText
= SysAllocString(This
->srcText
);
199 static HRESULT WINAPI
parseError_get_line(
200 IXMLDOMParseError2
*iface
,
203 parse_error_t
*This
= impl_from_IXMLDOMParseError2( iface
);
205 TRACE("(%p)->(%p): stub\n", This
, line
);
207 if (!line
) return E_INVALIDARG
;
213 static HRESULT WINAPI
parseError_get_linepos(
214 IXMLDOMParseError2
*iface
,
217 parse_error_t
*This
= impl_from_IXMLDOMParseError2( iface
);
219 TRACE("(%p)->(%p)\n", This
, linepos
);
221 if (!linepos
) return E_INVALIDARG
;
223 *linepos
= This
->linepos
;
227 static HRESULT WINAPI
parseError_get_filepos(
228 IXMLDOMParseError2
*iface
,
231 parse_error_t
*This
= impl_from_IXMLDOMParseError2( iface
);
232 FIXME("(%p)->(%p)\n", This
, filepos
);
236 static HRESULT WINAPI
parseError_get_errorXPath(
237 IXMLDOMParseError2
*iface
,
240 parse_error_t
*This
= impl_from_IXMLDOMParseError2( iface
);
241 FIXME("(%p)->(%p)\n", This
, xpathexpr
);
245 static HRESULT WINAPI
parseError_get_AllErrors(
246 IXMLDOMParseError2
*iface
,
247 IXMLDOMParseErrorCollection
**allErrors
)
249 parse_error_t
*This
= impl_from_IXMLDOMParseError2( iface
);
250 FIXME("(%p)->(%p)\n", This
, allErrors
);
254 static HRESULT WINAPI
parseError_errorParameters(
255 IXMLDOMParseError2
*iface
,
259 parse_error_t
*This
= impl_from_IXMLDOMParseError2( iface
);
260 FIXME("(%p)->(%p)\n", This
, param
);
264 static HRESULT WINAPI
parseError_get_errorParametersCount(
265 IXMLDOMParseError2
*iface
,
268 parse_error_t
*This
= impl_from_IXMLDOMParseError2( iface
);
269 FIXME("(%p)->(%p)\n", This
, count
);
273 static const struct IXMLDOMParseError2Vtbl XMLDOMParseError2Vtbl
=
275 parseError_QueryInterface
,
278 parseError_GetTypeInfoCount
,
279 parseError_GetTypeInfo
,
280 parseError_GetIDsOfNames
,
282 parseError_get_errorCode
,
284 parseError_get_reason
,
285 parseError_get_srcText
,
287 parseError_get_linepos
,
288 parseError_get_filepos
,
289 parseError_get_errorXPath
,
290 parseError_get_AllErrors
,
291 parseError_errorParameters
,
292 parseError_get_errorParametersCount
295 static const tid_t parseError_iface_tids
[] = {
296 IXMLDOMParseError2_tid
,
300 static dispex_static_data_t parseError_dispex
= {
302 IXMLDOMParseError2_tid
,
304 parseError_iface_tids
307 IXMLDOMParseError
*create_parseError( LONG code
, BSTR url
, BSTR reason
, BSTR srcText
,
308 LONG line
, LONG linepos
, LONG filepos
)
312 This
= heap_alloc( sizeof(*This
) );
316 This
->IXMLDOMParseError2_iface
.lpVtbl
= &XMLDOMParseError2Vtbl
;
321 This
->reason
= reason
;
322 This
->srcText
= srcText
;
324 This
->linepos
= linepos
;
325 This
->filepos
= filepos
;
327 init_dispex(&This
->dispex
, (IUnknown
*)&This
->IXMLDOMParseError2_iface
, &parseError_dispex
);
329 return (IXMLDOMParseError
*)&This
->IXMLDOMParseError2_iface
;