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 parse_error_t
*This
= impl_from_IXMLDOMParseError( iface
);
65 TRACE("(%p)->(%s %p)\n", This
, debugstr_guid(riid
), ppvObject
);
67 if ( IsEqualGUID( riid
, &IID_IUnknown
) ||
68 IsEqualGUID( riid
, &IID_IDispatch
) ||
69 IsEqualGUID( riid
, &IID_IXMLDOMParseError
) )
75 FIXME("interface %s not implemented\n", debugstr_guid(riid
));
80 IXMLDOMParseError_AddRef( iface
);
85 static ULONG WINAPI
parseError_AddRef(
86 IXMLDOMParseError
*iface
)
88 parse_error_t
*This
= impl_from_IXMLDOMParseError( iface
);
89 ULONG ref
= InterlockedIncrement( &This
->ref
);
90 TRACE("(%p)->(%d)\n", This
, ref
);
94 static ULONG WINAPI
parseError_Release(
95 IXMLDOMParseError
*iface
)
97 parse_error_t
*This
= impl_from_IXMLDOMParseError( iface
);
98 ULONG ref
= InterlockedDecrement( &This
->ref
);
100 TRACE("(%p)->(%d)\n", This
, ref
);
103 SysFreeString(This
->url
);
104 SysFreeString(This
->reason
);
105 SysFreeString(This
->srcText
);
112 static HRESULT WINAPI
parseError_GetTypeInfoCount(
113 IXMLDOMParseError
*iface
,
116 parse_error_t
*This
= impl_from_IXMLDOMParseError( iface
);
118 TRACE("(%p)->(%p)\n", This
, pctinfo
);
125 static HRESULT WINAPI
parseError_GetTypeInfo(
126 IXMLDOMParseError
*iface
,
129 ITypeInfo
** ppTInfo
)
131 parse_error_t
*This
= impl_from_IXMLDOMParseError( iface
);
134 TRACE("(%p)->(%u %u %p)\n", This
, iTInfo
, lcid
, ppTInfo
);
136 hr
= get_typeinfo(IXMLDOMParseError_tid
, ppTInfo
);
141 static HRESULT WINAPI
parseError_GetIDsOfNames(
142 IXMLDOMParseError
*iface
,
149 parse_error_t
*This
= impl_from_IXMLDOMParseError( iface
);
153 TRACE("(%p)->(%s %p %u %u %p)\n", This
, debugstr_guid(riid
), rgszNames
, cNames
,
156 if(!rgszNames
|| cNames
== 0 || !rgDispId
)
159 hr
= get_typeinfo(IXMLDOMParseError_tid
, &typeinfo
);
162 hr
= ITypeInfo_GetIDsOfNames(typeinfo
, rgszNames
, cNames
, rgDispId
);
163 ITypeInfo_Release(typeinfo
);
169 static HRESULT WINAPI
parseError_Invoke(
170 IXMLDOMParseError
*iface
,
175 DISPPARAMS
* pDispParams
,
177 EXCEPINFO
* pExcepInfo
,
180 parse_error_t
*This
= impl_from_IXMLDOMParseError( iface
);
184 TRACE("(%p)->(%d %s %d %d %p %p %p %p)\n", This
, dispIdMember
, debugstr_guid(riid
),
185 lcid
, wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
187 hr
= get_typeinfo(IXMLDOMParseError_tid
, &typeinfo
);
190 hr
= ITypeInfo_Invoke(typeinfo
, &This
->IXMLDOMParseError_iface
, dispIdMember
, wFlags
,
191 pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
192 ITypeInfo_Release(typeinfo
);
198 static HRESULT WINAPI
parseError_get_errorCode(
199 IXMLDOMParseError
*iface
,
202 parse_error_t
*This
= impl_from_IXMLDOMParseError( iface
);
203 TRACE("(%p)->(%p)\n", This
, code
);
213 static HRESULT WINAPI
parseError_get_url(
214 IXMLDOMParseError
*iface
,
217 parse_error_t
*This
= impl_from_IXMLDOMParseError( iface
);
218 FIXME("(%p)->(%p)\n", This
, url
);
222 static HRESULT WINAPI
parseError_get_reason(
223 IXMLDOMParseError
*iface
,
226 parse_error_t
*This
= impl_from_IXMLDOMParseError( iface
);
227 TRACE("(%p)->(%p)\n", This
, reason
);
234 *reason
= SysAllocString(This
->reason
);
238 static HRESULT WINAPI
parseError_get_srcText(
239 IXMLDOMParseError
*iface
,
242 parse_error_t
*This
= impl_from_IXMLDOMParseError( iface
);
243 FIXME("(%p)->(%p)\n", This
, srcText
);
247 static HRESULT WINAPI
parseError_get_line(
248 IXMLDOMParseError
*iface
,
251 parse_error_t
*This
= impl_from_IXMLDOMParseError( iface
);
252 FIXME("(%p)->(%p)\n", This
, line
);
256 static HRESULT WINAPI
parseError_get_linepos(
257 IXMLDOMParseError
*iface
,
260 parse_error_t
*This
= impl_from_IXMLDOMParseError( iface
);
261 FIXME("(%p)->(%p)\n", This
, linepos
);
265 static HRESULT WINAPI
parseError_get_filepos(
266 IXMLDOMParseError
*iface
,
269 parse_error_t
*This
= impl_from_IXMLDOMParseError( iface
);
270 FIXME("(%p)->(%p)\n", This
, filepos
);
274 static const struct IXMLDOMParseErrorVtbl parseError_vtbl
=
276 parseError_QueryInterface
,
279 parseError_GetTypeInfoCount
,
280 parseError_GetTypeInfo
,
281 parseError_GetIDsOfNames
,
283 parseError_get_errorCode
,
285 parseError_get_reason
,
286 parseError_get_srcText
,
288 parseError_get_linepos
,
289 parseError_get_filepos
292 IXMLDOMParseError
*create_parseError( LONG code
, BSTR url
, BSTR reason
, BSTR srcText
,
293 LONG line
, LONG linepos
, LONG filepos
)
297 This
= heap_alloc( sizeof(*This
) );
301 This
->IXMLDOMParseError_iface
.lpVtbl
= &parseError_vtbl
;
306 This
->reason
= reason
;
307 This
->srcText
= srcText
;
309 This
->linepos
= linepos
;
310 This
->filepos
= filepos
;
312 return &This
->IXMLDOMParseError_iface
;