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
);
47 IXMLDOMParseError IXMLDOMParseError_iface
;
49 LONG code
, line
, linepos
, filepos
;
50 BSTR url
, reason
, srcText
;
53 static inline parse_error_t
*impl_from_IXMLDOMParseError( IXMLDOMParseError
*iface
)
55 return CONTAINING_RECORD(iface
, parse_error_t
, IXMLDOMParseError_iface
);
58 static HRESULT WINAPI
parseError_QueryInterface(
59 IXMLDOMParseError
*iface
,
63 TRACE("(%p)->(%s %p)\n", iface
, debugstr_guid(riid
), ppvObject
);
65 if ( IsEqualGUID( riid
, &IID_IUnknown
) ||
66 IsEqualGUID( riid
, &IID_IDispatch
) ||
67 IsEqualGUID( riid
, &IID_IXMLDOMParseError
) )
73 FIXME("interface %s not implemented\n", debugstr_guid(riid
));
78 IXMLDOMParseError_AddRef( iface
);
83 static ULONG WINAPI
parseError_AddRef(
84 IXMLDOMParseError
*iface
)
86 parse_error_t
*This
= impl_from_IXMLDOMParseError( iface
);
87 ULONG ref
= InterlockedIncrement( &This
->ref
);
88 TRACE("(%p) ref now %d\n", This
, ref
);
92 static ULONG WINAPI
parseError_Release(
93 IXMLDOMParseError
*iface
)
95 parse_error_t
*This
= impl_from_IXMLDOMParseError( iface
);
98 ref
= InterlockedDecrement( &This
->ref
);
99 TRACE("(%p) ref now %d\n", This
, ref
);
102 SysFreeString(This
->url
);
103 SysFreeString(This
->reason
);
104 SysFreeString(This
->srcText
);
111 static HRESULT WINAPI
parseError_GetTypeInfoCount(
112 IXMLDOMParseError
*iface
,
115 parse_error_t
*This
= impl_from_IXMLDOMParseError( iface
);
117 TRACE("(%p)->(%p)\n", This
, pctinfo
);
124 static HRESULT WINAPI
parseError_GetTypeInfo(
125 IXMLDOMParseError
*iface
,
128 ITypeInfo
** ppTInfo
)
130 parse_error_t
*This
= impl_from_IXMLDOMParseError( iface
);
133 TRACE("(%p)->(%u %u %p)\n", This
, iTInfo
, lcid
, ppTInfo
);
135 hr
= get_typeinfo(IXMLDOMParseError_tid
, ppTInfo
);
140 static HRESULT WINAPI
parseError_GetIDsOfNames(
141 IXMLDOMParseError
*iface
,
148 parse_error_t
*This
= impl_from_IXMLDOMParseError( iface
);
152 TRACE("(%p)->(%s %p %u %u %p)\n", This
, debugstr_guid(riid
), rgszNames
, cNames
,
155 if(!rgszNames
|| cNames
== 0 || !rgDispId
)
158 hr
= get_typeinfo(IXMLDOMParseError_tid
, &typeinfo
);
161 hr
= ITypeInfo_GetIDsOfNames(typeinfo
, rgszNames
, cNames
, rgDispId
);
162 ITypeInfo_Release(typeinfo
);
168 static HRESULT WINAPI
parseError_Invoke(
169 IXMLDOMParseError
*iface
,
174 DISPPARAMS
* pDispParams
,
176 EXCEPINFO
* pExcepInfo
,
179 parse_error_t
*This
= impl_from_IXMLDOMParseError( iface
);
183 TRACE("(%p)->(%d %s %d %d %p %p %p %p)\n", This
, dispIdMember
, debugstr_guid(riid
),
184 lcid
, wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
186 hr
= get_typeinfo(IXMLDOMParseError_tid
, &typeinfo
);
189 hr
= ITypeInfo_Invoke(typeinfo
, &This
->IXMLDOMParseError_iface
, dispIdMember
, wFlags
,
190 pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
191 ITypeInfo_Release(typeinfo
);
197 static HRESULT WINAPI
parseError_get_errorCode(
198 IXMLDOMParseError
*iface
,
201 parse_error_t
*This
= impl_from_IXMLDOMParseError( iface
);
202 TRACE("(%p)->(%p)\n", This
, code
);
212 static HRESULT WINAPI
parseError_get_url(
213 IXMLDOMParseError
*iface
,
216 parse_error_t
*This
= impl_from_IXMLDOMParseError( iface
);
217 FIXME("(%p)->(%p)\n", This
, url
);
221 static HRESULT WINAPI
parseError_get_reason(
222 IXMLDOMParseError
*iface
,
225 parse_error_t
*This
= impl_from_IXMLDOMParseError( iface
);
226 TRACE("(%p)->(%p)\n", This
, reason
);
233 *reason
= SysAllocString(This
->reason
);
237 static HRESULT WINAPI
parseError_get_srcText(
238 IXMLDOMParseError
*iface
,
241 parse_error_t
*This
= impl_from_IXMLDOMParseError( iface
);
242 FIXME("(%p)->(%p)\n", This
, srcText
);
246 static HRESULT WINAPI
parseError_get_line(
247 IXMLDOMParseError
*iface
,
250 parse_error_t
*This
= impl_from_IXMLDOMParseError( iface
);
251 FIXME("(%p)->(%p)\n", This
, line
);
255 static HRESULT WINAPI
parseError_get_linepos(
256 IXMLDOMParseError
*iface
,
259 parse_error_t
*This
= impl_from_IXMLDOMParseError( iface
);
260 FIXME("(%p)->(%p)\n", This
, linepos
);
264 static HRESULT WINAPI
parseError_get_filepos(
265 IXMLDOMParseError
*iface
,
268 parse_error_t
*This
= impl_from_IXMLDOMParseError( iface
);
269 FIXME("(%p)->(%p)\n", This
, filepos
);
273 static const struct IXMLDOMParseErrorVtbl parseError_vtbl
=
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
291 IXMLDOMParseError
*create_parseError( LONG code
, BSTR url
, BSTR reason
, BSTR srcText
,
292 LONG line
, LONG linepos
, LONG filepos
)
296 This
= heap_alloc( sizeof(*This
) );
300 This
->IXMLDOMParseError_iface
.lpVtbl
= &parseError_vtbl
;
305 This
->reason
= reason
;
306 This
->srcText
= srcText
;
308 This
->linepos
= linepos
;
309 This
->filepos
= filepos
;
311 return &This
->IXMLDOMParseError_iface
;