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
28 # include <libxml/parser.h>
29 # include <libxml/xmlerror.h>
39 #include "msxml_private.h"
41 #include "wine/debug.h"
43 WINE_DEFAULT_DEBUG_CHANNEL(msxml
);
48 IXMLDOMParseError IXMLDOMParseError_iface
;
50 LONG code
, line
, linepos
, filepos
;
51 BSTR url
, reason
, srcText
;
54 static inline parse_error_t
*impl_from_IXMLDOMParseError( IXMLDOMParseError
*iface
)
56 return CONTAINING_RECORD(iface
, parse_error_t
, IXMLDOMParseError_iface
);
59 static HRESULT WINAPI
parseError_QueryInterface(
60 IXMLDOMParseError
*iface
,
64 parse_error_t
*This
= impl_from_IXMLDOMParseError( iface
);
66 TRACE("(%p)->(%s %p)\n", This
, debugstr_guid(riid
), ppvObject
);
68 if ( IsEqualGUID( riid
, &IID_IUnknown
) ||
69 IsEqualGUID( riid
, &IID_IDispatch
) ||
70 IsEqualGUID( riid
, &IID_IXMLDOMParseError
) )
74 else if (dispex_query_interface(&This
->dispex
, riid
, ppvObject
))
76 return *ppvObject
? S_OK
: E_NOINTERFACE
;
80 FIXME("interface %s not implemented\n", debugstr_guid(riid
));
85 IXMLDOMParseError_AddRef( iface
);
90 static ULONG WINAPI
parseError_AddRef(
91 IXMLDOMParseError
*iface
)
93 parse_error_t
*This
= impl_from_IXMLDOMParseError( iface
);
94 ULONG ref
= InterlockedIncrement( &This
->ref
);
95 TRACE("(%p)->(%d)\n", This
, ref
);
99 static ULONG WINAPI
parseError_Release(
100 IXMLDOMParseError
*iface
)
102 parse_error_t
*This
= impl_from_IXMLDOMParseError( iface
);
103 ULONG ref
= InterlockedDecrement( &This
->ref
);
105 TRACE("(%p)->(%d)\n", This
, ref
);
108 SysFreeString(This
->url
);
109 SysFreeString(This
->reason
);
110 SysFreeString(This
->srcText
);
111 release_dispex(&This
->dispex
);
118 static HRESULT WINAPI
parseError_GetTypeInfoCount(
119 IXMLDOMParseError
*iface
,
122 parse_error_t
*This
= impl_from_IXMLDOMParseError( iface
);
124 TRACE("(%p)->(%p)\n", This
, pctinfo
);
131 static HRESULT WINAPI
parseError_GetTypeInfo(
132 IXMLDOMParseError
*iface
,
135 ITypeInfo
** ppTInfo
)
137 parse_error_t
*This
= impl_from_IXMLDOMParseError( iface
);
139 TRACE("(%p)->(%u %u %p)\n", This
, iTInfo
, lcid
, ppTInfo
);
141 return get_typeinfo(IXMLDOMParseError_tid
, ppTInfo
);
144 static HRESULT WINAPI
parseError_GetIDsOfNames(
145 IXMLDOMParseError
*iface
,
152 parse_error_t
*This
= impl_from_IXMLDOMParseError( iface
);
156 TRACE("(%p)->(%s %p %u %u %p)\n", This
, debugstr_guid(riid
), rgszNames
, cNames
,
159 if(!rgszNames
|| cNames
== 0 || !rgDispId
)
162 hr
= get_typeinfo(IXMLDOMParseError_tid
, &typeinfo
);
165 hr
= ITypeInfo_GetIDsOfNames(typeinfo
, rgszNames
, cNames
, rgDispId
);
166 ITypeInfo_Release(typeinfo
);
172 static HRESULT WINAPI
parseError_Invoke(
173 IXMLDOMParseError
*iface
,
178 DISPPARAMS
* pDispParams
,
180 EXCEPINFO
* pExcepInfo
,
183 parse_error_t
*This
= impl_from_IXMLDOMParseError( iface
);
187 TRACE("(%p)->(%d %s %d %d %p %p %p %p)\n", This
, dispIdMember
, debugstr_guid(riid
),
188 lcid
, wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
190 hr
= get_typeinfo(IXMLDOMParseError_tid
, &typeinfo
);
193 hr
= ITypeInfo_Invoke(typeinfo
, &This
->IXMLDOMParseError_iface
, dispIdMember
, wFlags
,
194 pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
195 ITypeInfo_Release(typeinfo
);
201 static HRESULT WINAPI
parseError_get_errorCode(
202 IXMLDOMParseError
*iface
,
205 parse_error_t
*This
= impl_from_IXMLDOMParseError( iface
);
206 TRACE("(%p)->(%p)\n", This
, code
);
216 static HRESULT WINAPI
parseError_get_url(
217 IXMLDOMParseError
*iface
,
220 parse_error_t
*This
= impl_from_IXMLDOMParseError( iface
);
221 FIXME("(%p)->(%p)\n", This
, url
);
225 static HRESULT WINAPI
parseError_get_reason(
226 IXMLDOMParseError
*iface
,
229 parse_error_t
*This
= impl_from_IXMLDOMParseError( iface
);
230 TRACE("(%p)->(%p)\n", This
, reason
);
237 *reason
= SysAllocString(This
->reason
);
241 static HRESULT WINAPI
parseError_get_srcText(
242 IXMLDOMParseError
*iface
,
245 parse_error_t
*This
= impl_from_IXMLDOMParseError( iface
);
246 FIXME("(%p)->(%p)\n", This
, srcText
);
250 static HRESULT WINAPI
parseError_get_line(
251 IXMLDOMParseError
*iface
,
254 parse_error_t
*This
= impl_from_IXMLDOMParseError( iface
);
256 TRACE("(%p)->(%p): stub\n", This
, line
);
258 if (!line
) return E_INVALIDARG
;
264 static HRESULT WINAPI
parseError_get_linepos(
265 IXMLDOMParseError
*iface
,
268 parse_error_t
*This
= impl_from_IXMLDOMParseError( iface
);
270 TRACE("(%p)->(%p)\n", This
, linepos
);
272 if (!linepos
) return E_INVALIDARG
;
274 *linepos
= This
->linepos
;
278 static HRESULT WINAPI
parseError_get_filepos(
279 IXMLDOMParseError
*iface
,
282 parse_error_t
*This
= impl_from_IXMLDOMParseError( iface
);
283 FIXME("(%p)->(%p)\n", This
, filepos
);
287 static const struct IXMLDOMParseErrorVtbl parseError_vtbl
=
289 parseError_QueryInterface
,
292 parseError_GetTypeInfoCount
,
293 parseError_GetTypeInfo
,
294 parseError_GetIDsOfNames
,
296 parseError_get_errorCode
,
298 parseError_get_reason
,
299 parseError_get_srcText
,
301 parseError_get_linepos
,
302 parseError_get_filepos
305 static const tid_t parseError_iface_tids
[] = {
306 IXMLDOMParseError_tid
,
310 static dispex_static_data_t parseError_dispex
= {
312 IXMLDOMParseError_tid
,
314 parseError_iface_tids
317 IXMLDOMParseError
*create_parseError( LONG code
, BSTR url
, BSTR reason
, BSTR srcText
,
318 LONG line
, LONG linepos
, LONG filepos
)
322 This
= heap_alloc( sizeof(*This
) );
326 This
->IXMLDOMParseError_iface
.lpVtbl
= &parseError_vtbl
;
331 This
->reason
= reason
;
332 This
->srcText
= srcText
;
334 This
->linepos
= linepos
;
335 This
->filepos
= filepos
;
337 init_dispex(&This
->dispex
, (IUnknown
*)&This
->IXMLDOMParseError_iface
, &parseError_dispex
);
339 return &This
->IXMLDOMParseError_iface
;