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
35 #include "msxml_private.h"
37 #include "wine/debug.h"
39 WINE_DEFAULT_DEBUG_CHANNEL(msxml
);
43 const struct IXMLDOMParseErrorVtbl
*lpVtbl
;
45 LONG code
, line
, linepos
, filepos
;
46 BSTR url
, reason
, srcText
;
49 static inline parse_error_t
*impl_from_IXMLDOMParseError( IXMLDOMParseError
*iface
)
51 return (parse_error_t
*)((char*)iface
- FIELD_OFFSET(parse_error_t
, lpVtbl
));
54 static HRESULT WINAPI
parseError_QueryInterface(
55 IXMLDOMParseError
*iface
,
59 TRACE("(%p)->(%s %p)\n", iface
, debugstr_guid(riid
), ppvObject
);
61 if ( IsEqualGUID( riid
, &IID_IUnknown
) ||
62 IsEqualGUID( riid
, &IID_IDispatch
) ||
63 IsEqualGUID( riid
, &IID_IXMLDOMParseError
) )
69 FIXME("interface %s not implemented\n", debugstr_guid(riid
));
73 IXMLDOMParseError_AddRef( iface
);
78 static ULONG WINAPI
parseError_AddRef(
79 IXMLDOMParseError
*iface
)
81 parse_error_t
*This
= impl_from_IXMLDOMParseError( iface
);
82 ULONG ref
= InterlockedIncrement( &This
->ref
);
83 TRACE("(%p) ref now %d\n", This
, ref
);
87 static ULONG WINAPI
parseError_Release(
88 IXMLDOMParseError
*iface
)
90 parse_error_t
*This
= impl_from_IXMLDOMParseError( iface
);
93 ref
= InterlockedDecrement( &This
->ref
);
94 TRACE("(%p) ref now %d\n", This
, ref
);
97 SysFreeString(This
->url
);
98 SysFreeString(This
->reason
);
99 SysFreeString(This
->srcText
);
106 static HRESULT WINAPI
parseError_GetTypeInfoCount(
107 IXMLDOMParseError
*iface
,
110 parse_error_t
*This
= impl_from_IXMLDOMParseError( iface
);
112 TRACE("(%p)->(%p)\n", This
, pctinfo
);
119 static HRESULT WINAPI
parseError_GetTypeInfo(
120 IXMLDOMParseError
*iface
,
123 ITypeInfo
** ppTInfo
)
125 parse_error_t
*This
= impl_from_IXMLDOMParseError( iface
);
128 TRACE("(%p)->(%u %u %p)\n", This
, iTInfo
, lcid
, ppTInfo
);
130 hr
= get_typeinfo(IXMLDOMParseError_tid
, ppTInfo
);
135 static HRESULT WINAPI
parseError_GetIDsOfNames(
136 IXMLDOMParseError
*iface
,
143 parse_error_t
*This
= impl_from_IXMLDOMParseError( iface
);
147 TRACE("(%p)->(%s %p %u %u %p)\n", This
, debugstr_guid(riid
), rgszNames
, cNames
,
150 if(!rgszNames
|| cNames
== 0 || !rgDispId
)
153 hr
= get_typeinfo(IXMLDOMParseError_tid
, &typeinfo
);
156 hr
= ITypeInfo_GetIDsOfNames(typeinfo
, rgszNames
, cNames
, rgDispId
);
157 ITypeInfo_Release(typeinfo
);
163 static HRESULT WINAPI
parseError_Invoke(
164 IXMLDOMParseError
*iface
,
169 DISPPARAMS
* pDispParams
,
171 EXCEPINFO
* pExcepInfo
,
174 parse_error_t
*This
= impl_from_IXMLDOMParseError( iface
);
178 TRACE("(%p)->(%d %s %d %d %p %p %p %p)\n", This
, dispIdMember
, debugstr_guid(riid
),
179 lcid
, wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
181 hr
= get_typeinfo(IXMLDOMParseError_tid
, &typeinfo
);
184 hr
= ITypeInfo_Invoke(typeinfo
, &(This
->lpVtbl
), dispIdMember
, wFlags
, pDispParams
,
185 pVarResult
, pExcepInfo
, puArgErr
);
186 ITypeInfo_Release(typeinfo
);
192 static HRESULT WINAPI
parseError_get_errorCode(
193 IXMLDOMParseError
*iface
,
196 parse_error_t
*This
= impl_from_IXMLDOMParseError( iface
);
197 TRACE("(%p)->(%p)\n", This
, code
);
207 static HRESULT WINAPI
parseError_get_url(
208 IXMLDOMParseError
*iface
,
211 parse_error_t
*This
= impl_from_IXMLDOMParseError( iface
);
212 FIXME("(%p)->(%p)\n", This
, url
);
216 static HRESULT WINAPI
parseError_get_reason(
217 IXMLDOMParseError
*iface
,
220 parse_error_t
*This
= impl_from_IXMLDOMParseError( iface
);
221 TRACE("(%p)->(%p)\n", This
, reason
);
228 *reason
= SysAllocString(This
->reason
);
232 static HRESULT WINAPI
parseError_get_srcText(
233 IXMLDOMParseError
*iface
,
236 parse_error_t
*This
= impl_from_IXMLDOMParseError( iface
);
237 FIXME("(%p)->(%p)\n", This
, srcText
);
241 static HRESULT WINAPI
parseError_get_line(
242 IXMLDOMParseError
*iface
,
245 parse_error_t
*This
= impl_from_IXMLDOMParseError( iface
);
246 FIXME("(%p)->(%p)\n", This
, line
);
250 static HRESULT WINAPI
parseError_get_linepos(
251 IXMLDOMParseError
*iface
,
254 parse_error_t
*This
= impl_from_IXMLDOMParseError( iface
);
255 FIXME("(%p)->(%p)\n", This
, linepos
);
259 static HRESULT WINAPI
parseError_get_filepos(
260 IXMLDOMParseError
*iface
,
263 parse_error_t
*This
= impl_from_IXMLDOMParseError( iface
);
264 FIXME("(%p)->(%p)\n", This
, filepos
);
268 static const struct IXMLDOMParseErrorVtbl parseError_vtbl
=
270 parseError_QueryInterface
,
273 parseError_GetTypeInfoCount
,
274 parseError_GetTypeInfo
,
275 parseError_GetIDsOfNames
,
277 parseError_get_errorCode
,
279 parseError_get_reason
,
280 parseError_get_srcText
,
282 parseError_get_linepos
,
283 parseError_get_filepos
286 IXMLDOMParseError
*create_parseError( LONG code
, BSTR url
, BSTR reason
, BSTR srcText
,
287 LONG line
, LONG linepos
, LONG filepos
)
291 This
= heap_alloc( sizeof(*This
) );
295 This
->lpVtbl
= &parseError_vtbl
;
300 This
->reason
= reason
;
301 This
->srcText
= srcText
;
303 This
->linepos
= linepos
;
304 This
->filepos
= filepos
;
306 return (IXMLDOMParseError
*) &This
->lpVtbl
;