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
29 #include "msxml_dispex.h"
31 #include "wine/debug.h"
33 WINE_DEFAULT_DEBUG_CHANNEL(msxml
);
38 IXMLDOMParseError2 IXMLDOMParseError2_iface
;
40 LONG code
, line
, linepos
, filepos
;
41 BSTR url
, reason
, srcText
;
44 static inline parse_error_t
*impl_from_IXMLDOMParseError2( IXMLDOMParseError2
*iface
)
46 return CONTAINING_RECORD(iface
, parse_error_t
, IXMLDOMParseError2_iface
);
49 static HRESULT WINAPI
parseError_QueryInterface(
50 IXMLDOMParseError2
*iface
,
54 parse_error_t
*This
= impl_from_IXMLDOMParseError2( iface
);
56 TRACE("(%p)->(%s %p)\n", This
, debugstr_guid(riid
), ppvObject
);
58 if ( IsEqualGUID( riid
, &IID_IUnknown
) ||
59 IsEqualGUID( riid
, &IID_IDispatch
) ||
60 IsEqualGUID( riid
, &IID_IXMLDOMParseError
) ||
61 IsEqualGUID( riid
, &IID_IXMLDOMParseError2
) )
65 else if (dispex_query_interface(&This
->dispex
, riid
, ppvObject
))
67 return *ppvObject
? S_OK
: E_NOINTERFACE
;
71 FIXME("interface %s not implemented\n", debugstr_guid(riid
));
76 IXMLDOMParseError2_AddRef( iface
);
81 static ULONG WINAPI
parseError_AddRef(
82 IXMLDOMParseError2
*iface
)
84 parse_error_t
*This
= impl_from_IXMLDOMParseError2( iface
);
85 ULONG ref
= InterlockedIncrement( &This
->ref
);
86 TRACE("%p, refcount %lu.\n", iface
, ref
);
90 static ULONG WINAPI
parseError_Release(
91 IXMLDOMParseError2
*iface
)
93 parse_error_t
*This
= impl_from_IXMLDOMParseError2( iface
);
94 ULONG ref
= InterlockedDecrement( &This
->ref
);
96 TRACE("%p, refcount %lu.\n", iface
, ref
);
100 SysFreeString(This
->url
);
101 SysFreeString(This
->reason
);
102 SysFreeString(This
->srcText
);
109 static HRESULT WINAPI
parseError_GetTypeInfoCount(
110 IXMLDOMParseError2
*iface
,
113 parse_error_t
*This
= impl_from_IXMLDOMParseError2( iface
);
114 return IDispatchEx_GetTypeInfoCount(&This
->dispex
.IDispatchEx_iface
, pctinfo
);
117 static HRESULT WINAPI
parseError_GetTypeInfo(
118 IXMLDOMParseError2
*iface
,
121 ITypeInfo
** ppTInfo
)
123 parse_error_t
*This
= impl_from_IXMLDOMParseError2( iface
);
124 return IDispatchEx_GetTypeInfo(&This
->dispex
.IDispatchEx_iface
,
125 iTInfo
, lcid
, ppTInfo
);
128 static HRESULT WINAPI
parseError_GetIDsOfNames(
129 IXMLDOMParseError2
*iface
,
136 parse_error_t
*This
= impl_from_IXMLDOMParseError2( iface
);
137 return IDispatchEx_GetIDsOfNames(&This
->dispex
.IDispatchEx_iface
,
138 riid
, rgszNames
, cNames
, lcid
, rgDispId
);
141 static HRESULT WINAPI
parseError_Invoke(
142 IXMLDOMParseError2
*iface
,
147 DISPPARAMS
* pDispParams
,
149 EXCEPINFO
* pExcepInfo
,
152 parse_error_t
*This
= impl_from_IXMLDOMParseError2( iface
);
153 return IDispatchEx_Invoke(&This
->dispex
.IDispatchEx_iface
,
154 dispIdMember
, riid
, lcid
, wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
157 static HRESULT WINAPI
parseError_get_errorCode(
158 IXMLDOMParseError2
*iface
,
161 parse_error_t
*This
= impl_from_IXMLDOMParseError2( iface
);
162 TRACE("(%p)->(%p)\n", This
, code
);
172 static HRESULT WINAPI
parseError_get_url(
173 IXMLDOMParseError2
*iface
,
176 parse_error_t
*This
= impl_from_IXMLDOMParseError2( iface
);
177 FIXME("(%p)->(%p)\n", This
, url
);
181 static HRESULT WINAPI
parseError_get_reason(
182 IXMLDOMParseError2
*iface
,
185 parse_error_t
*This
= impl_from_IXMLDOMParseError2( iface
);
186 TRACE("(%p)->(%p)\n", This
, reason
);
193 *reason
= SysAllocString(This
->reason
);
197 static HRESULT WINAPI
parseError_get_srcText(
198 IXMLDOMParseError2
*iface
,
201 parse_error_t
*This
= impl_from_IXMLDOMParseError2( iface
);
203 TRACE("(%p)->(%p)\n", This
, srcText
);
205 if (!srcText
) return E_INVALIDARG
;
207 *srcText
= SysAllocString(This
->srcText
);
212 static HRESULT WINAPI
parseError_get_line(
213 IXMLDOMParseError2
*iface
,
216 parse_error_t
*This
= impl_from_IXMLDOMParseError2( iface
);
218 TRACE("%p, %p.\n", This
, line
);
220 if (!line
) return E_INVALIDARG
;
226 static HRESULT WINAPI
parseError_get_linepos(
227 IXMLDOMParseError2
*iface
,
230 parse_error_t
*This
= impl_from_IXMLDOMParseError2( iface
);
232 TRACE("(%p)->(%p)\n", This
, linepos
);
234 if (!linepos
) return E_INVALIDARG
;
236 *linepos
= This
->linepos
;
240 static HRESULT WINAPI
parseError_get_filepos(
241 IXMLDOMParseError2
*iface
,
244 parse_error_t
*This
= impl_from_IXMLDOMParseError2( iface
);
245 FIXME("(%p)->(%p)\n", This
, filepos
);
249 static HRESULT WINAPI
parseError_get_errorXPath(
250 IXMLDOMParseError2
*iface
,
253 parse_error_t
*This
= impl_from_IXMLDOMParseError2( iface
);
254 FIXME("(%p)->(%p)\n", This
, xpathexpr
);
258 static HRESULT WINAPI
parseError_get_AllErrors(
259 IXMLDOMParseError2
*iface
,
260 IXMLDOMParseErrorCollection
**allErrors
)
262 parse_error_t
*This
= impl_from_IXMLDOMParseError2( iface
);
263 FIXME("(%p)->(%p)\n", This
, allErrors
);
267 static HRESULT WINAPI
parseError_errorParameters(
268 IXMLDOMParseError2
*iface
,
272 parse_error_t
*This
= impl_from_IXMLDOMParseError2( iface
);
273 FIXME("(%p)->(%p)\n", This
, param
);
277 static HRESULT WINAPI
parseError_get_errorParametersCount(
278 IXMLDOMParseError2
*iface
,
281 parse_error_t
*This
= impl_from_IXMLDOMParseError2( iface
);
282 FIXME("(%p)->(%p)\n", This
, count
);
286 static const struct IXMLDOMParseError2Vtbl XMLDOMParseError2Vtbl
=
288 parseError_QueryInterface
,
291 parseError_GetTypeInfoCount
,
292 parseError_GetTypeInfo
,
293 parseError_GetIDsOfNames
,
295 parseError_get_errorCode
,
297 parseError_get_reason
,
298 parseError_get_srcText
,
300 parseError_get_linepos
,
301 parseError_get_filepos
,
302 parseError_get_errorXPath
,
303 parseError_get_AllErrors
,
304 parseError_errorParameters
,
305 parseError_get_errorParametersCount
308 static const tid_t parseError_iface_tids
[] = {
309 IXMLDOMParseError2_tid
,
313 static dispex_static_data_t parseError_dispex
= {
315 IXMLDOMParseError2_tid
,
317 parseError_iface_tids
320 IXMLDOMParseError
*create_parseError( LONG code
, BSTR url
, BSTR reason
, BSTR srcText
,
321 LONG line
, LONG linepos
, LONG filepos
)
325 This
= heap_alloc( sizeof(*This
) );
329 This
->IXMLDOMParseError2_iface
.lpVtbl
= &XMLDOMParseError2Vtbl
;
334 This
->reason
= reason
;
335 This
->srcText
= srcText
;
337 This
->linepos
= linepos
;
338 This
->filepos
= filepos
;
340 init_dispex(&This
->dispex
, (IUnknown
*)&This
->IXMLDOMParseError2_iface
, &parseError_dispex
);
342 return (IXMLDOMParseError
*)&This
->IXMLDOMParseError2_iface
;