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
34 #include "msxml_private.h"
36 #include "wine/debug.h"
38 WINE_DEFAULT_DEBUG_CHANNEL(msxml);
42 const struct IXMLDOMParseErrorVtbl *lpVtbl;
44 LONG code, line, linepos, filepos;
45 BSTR url, reason, srcText;
48 static inline parse_error_t *impl_from_IXMLDOMParseError( IXMLDOMParseError *iface )
50 return (parse_error_t *)((char*)iface - FIELD_OFFSET(parse_error_t, lpVtbl));
53 static HRESULT WINAPI parseError_QueryInterface(
54 IXMLDOMParseError *iface,
58 TRACE("(%p)->(%s %p)\n", iface, debugstr_guid(riid), ppvObject);
60 if ( IsEqualGUID( riid, &IID_IUnknown ) ||
61 IsEqualGUID( riid, &IID_IDispatch ) ||
62 IsEqualGUID( riid, &IID_IXMLDOMParseError ) )
68 FIXME("interface %s not implemented\n", debugstr_guid(riid));
72 IXMLDOMParseError_AddRef( iface );
77 static ULONG WINAPI parseError_AddRef(
78 IXMLDOMParseError *iface )
80 parse_error_t *This = impl_from_IXMLDOMParseError( iface );
81 ULONG ref = InterlockedIncrement( &This->ref );
82 TRACE("(%p) ref now %d\n", This, ref);
86 static ULONG WINAPI parseError_Release(
87 IXMLDOMParseError *iface )
89 parse_error_t *This = impl_from_IXMLDOMParseError( iface );
92 ref = InterlockedDecrement( &This->ref );
93 TRACE("(%p) ref now %d\n", This, ref);
96 SysFreeString(This->url);
97 SysFreeString(This->reason);
98 SysFreeString(This->srcText);
105 static HRESULT WINAPI parseError_GetTypeInfoCount(
106 IXMLDOMParseError *iface,
109 parse_error_t *This = impl_from_IXMLDOMParseError( iface );
111 TRACE("(%p)->(%p)\n", This, pctinfo);
118 static HRESULT WINAPI parseError_GetTypeInfo(
119 IXMLDOMParseError *iface,
122 ITypeInfo** ppTInfo )
124 parse_error_t *This = impl_from_IXMLDOMParseError( iface );
127 TRACE("(%p)->(%u %u %p)\n", This, iTInfo, lcid, ppTInfo);
129 hr = get_typeinfo(IXMLDOMParseError_tid, ppTInfo);
134 static HRESULT WINAPI parseError_GetIDsOfNames(
135 IXMLDOMParseError *iface,
142 parse_error_t *This = impl_from_IXMLDOMParseError( iface );
146 TRACE("(%p)->(%s %p %u %u %p)\n", This, debugstr_guid(riid), rgszNames, cNames,
149 if(!rgszNames || cNames == 0 || !rgDispId)
152 hr = get_typeinfo(IXMLDOMParseError_tid, &typeinfo);
155 hr = ITypeInfo_GetIDsOfNames(typeinfo, rgszNames, cNames, rgDispId);
156 ITypeInfo_Release(typeinfo);
162 static HRESULT WINAPI parseError_Invoke(
163 IXMLDOMParseError *iface,
168 DISPPARAMS* pDispParams,
170 EXCEPINFO* pExcepInfo,
173 parse_error_t *This = impl_from_IXMLDOMParseError( iface );
177 TRACE("(%p)->(%d %s %d %d %p %p %p %p)\n", This, dispIdMember, debugstr_guid(riid),
178 lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
180 hr = get_typeinfo(IXMLDOMParseError_tid, &typeinfo);
183 hr = ITypeInfo_Invoke(typeinfo, &(This->lpVtbl), dispIdMember, wFlags, pDispParams,
184 pVarResult, pExcepInfo, puArgErr);
185 ITypeInfo_Release(typeinfo);
191 static HRESULT WINAPI parseError_get_errorCode(
192 IXMLDOMParseError *iface,
195 parse_error_t *This = impl_from_IXMLDOMParseError( iface );
196 TRACE("(%p)->(%p)\n", This, code);
206 static HRESULT WINAPI parseError_get_url(
207 IXMLDOMParseError *iface,
210 parse_error_t *This = impl_from_IXMLDOMParseError( iface );
211 FIXME("(%p)->(%p)\n", This, url);
215 static HRESULT WINAPI parseError_get_reason(
216 IXMLDOMParseError *iface,
219 parse_error_t *This = impl_from_IXMLDOMParseError( iface );
220 TRACE("(%p)->(%p)\n", This, reason);
227 *reason = SysAllocString(This->reason);
231 static HRESULT WINAPI parseError_get_srcText(
232 IXMLDOMParseError *iface,
235 parse_error_t *This = impl_from_IXMLDOMParseError( iface );
236 FIXME("(%p)->(%p)\n", This, srcText);
240 static HRESULT WINAPI parseError_get_line(
241 IXMLDOMParseError *iface,
244 parse_error_t *This = impl_from_IXMLDOMParseError( iface );
245 FIXME("(%p)->(%p)\n", This, line);
249 static HRESULT WINAPI parseError_get_linepos(
250 IXMLDOMParseError *iface,
253 parse_error_t *This = impl_from_IXMLDOMParseError( iface );
254 FIXME("(%p)->(%p)\n", This, linepos);
258 static HRESULT WINAPI parseError_get_filepos(
259 IXMLDOMParseError *iface,
262 parse_error_t *This = impl_from_IXMLDOMParseError( iface );
263 FIXME("(%p)->(%p)\n", This, filepos);
267 static const struct IXMLDOMParseErrorVtbl parseError_vtbl =
269 parseError_QueryInterface,
272 parseError_GetTypeInfoCount,
273 parseError_GetTypeInfo,
274 parseError_GetIDsOfNames,
276 parseError_get_errorCode,
278 parseError_get_reason,
279 parseError_get_srcText,
281 parseError_get_linepos,
282 parseError_get_filepos
285 IXMLDOMParseError *create_parseError( LONG code, BSTR url, BSTR reason, BSTR srcText,
286 LONG line, LONG linepos, LONG filepos )
290 This = heap_alloc( sizeof(*This) );
294 This->lpVtbl = &parseError_vtbl;
299 This->reason = reason;
300 This->srcText = srcText;
302 This->linepos = linepos;
303 This->filepos = filepos;
305 return (IXMLDOMParseError*) &This->lpVtbl;