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
33 #include "msxml_private.h"
35 #include "wine/debug.h"
37 WINE_DEFAULT_DEBUG_CHANNEL(msxml);
41 const struct IXMLDOMParseErrorVtbl *lpVtbl;
43 LONG code, line, linepos, filepos;
44 BSTR url, reason, srcText;
47 static inline parse_error_t *impl_from_IXMLDOMParseError( IXMLDOMParseError *iface )
49 return (parse_error_t *)((char*)iface - FIELD_OFFSET(parse_error_t, lpVtbl));
52 static HRESULT WINAPI parseError_QueryInterface(
53 IXMLDOMParseError *iface,
57 TRACE("%p %s %p\n", iface, debugstr_guid(riid), ppvObject);
59 if ( IsEqualGUID( riid, &IID_IUnknown ) ||
60 IsEqualGUID( riid, &IID_IDispatch ) ||
61 IsEqualGUID( riid, &IID_IXMLDOMParseError ) )
67 FIXME("interface %s not implemented\n", debugstr_guid(riid));
71 IXMLDOMParseError_AddRef( iface );
76 static ULONG WINAPI parseError_AddRef(
77 IXMLDOMParseError *iface )
79 parse_error_t *This = impl_from_IXMLDOMParseError( iface );
80 ULONG ref = InterlockedIncrement( &This->ref );
81 TRACE("(%p) ref now %d\n", This, ref);
85 static ULONG WINAPI parseError_Release(
86 IXMLDOMParseError *iface )
88 parse_error_t *This = impl_from_IXMLDOMParseError( iface );
91 ref = InterlockedDecrement( &This->ref );
92 TRACE("(%p) ref now %d\n", This, ref);
95 SysFreeString(This->url);
96 SysFreeString(This->reason);
97 SysFreeString(This->srcText);
98 HeapFree( GetProcessHeap(), 0, This );
104 static HRESULT WINAPI parseError_GetTypeInfoCount(
105 IXMLDOMParseError *iface,
112 static HRESULT WINAPI parseError_GetTypeInfo(
113 IXMLDOMParseError *iface,
116 ITypeInfo** ppTInfo )
122 static HRESULT WINAPI parseError_GetIDsOfNames(
123 IXMLDOMParseError *iface,
134 static HRESULT WINAPI parseError_Invoke(
135 IXMLDOMParseError *iface,
140 DISPPARAMS* pDispParams,
142 EXCEPINFO* pExcepInfo,
149 static HRESULT WINAPI parseError_get_errorCode(
150 IXMLDOMParseError *iface,
153 parse_error_t *This = impl_from_IXMLDOMParseError( iface );
154 TRACE("(%p)->(%p)\n", This, code);
164 static HRESULT WINAPI parseError_get_url(
165 IXMLDOMParseError *iface,
172 static HRESULT WINAPI parseError_get_reason(
173 IXMLDOMParseError *iface,
176 parse_error_t *This = impl_from_IXMLDOMParseError( iface );
177 TRACE("(%p)->(%p)\n", This, reason);
184 *reason = SysAllocString(This->reason);
188 static HRESULT WINAPI parseError_get_srcText(
189 IXMLDOMParseError *iface,
196 static HRESULT WINAPI parseError_get_line(
197 IXMLDOMParseError *iface,
204 static HRESULT WINAPI parseError_get_linepos(
205 IXMLDOMParseError *iface,
212 static HRESULT WINAPI parseError_get_filepos(
213 IXMLDOMParseError *iface,
220 static const struct IXMLDOMParseErrorVtbl parseError_vtbl =
222 parseError_QueryInterface,
225 parseError_GetTypeInfoCount,
226 parseError_GetTypeInfo,
227 parseError_GetIDsOfNames,
229 parseError_get_errorCode,
231 parseError_get_reason,
232 parseError_get_srcText,
234 parseError_get_linepos,
235 parseError_get_filepos
238 IXMLDOMParseError *create_parseError( LONG code, BSTR url, BSTR reason, BSTR srcText,
239 LONG line, LONG linepos, LONG filepos )
243 This = HeapAlloc( GetProcessHeap(), 0, sizeof(*This) );
247 This->lpVtbl = &parseError_vtbl;
252 This->reason = reason;
253 This->srcText = srcText;
255 This->linepos = linepos;
256 This->filepos = filepos;
258 return (IXMLDOMParseError*) &This->lpVtbl;