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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 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 ) )
68 IXMLDOMParseError_AddRef( iface );
73 static ULONG WINAPI parseError_AddRef(
74 IXMLDOMParseError *iface )
76 parse_error_t *This = impl_from_IXMLDOMParseError( iface );
77 ULONG ref = InterlockedIncrement( &This->ref );
78 TRACE("(%p) ref now %ld\n", This, ref);
82 static ULONG WINAPI parseError_Release(
83 IXMLDOMParseError *iface )
85 parse_error_t *This = impl_from_IXMLDOMParseError( iface );
88 ref = InterlockedDecrement( &This->ref );
89 TRACE("(%p) ref now %ld\n", This, ref);
92 SysFreeString(This->url);
93 SysFreeString(This->reason);
94 SysFreeString(This->srcText);
95 HeapFree( GetProcessHeap(), 0, This );
101 static HRESULT WINAPI parseError_GetTypeInfoCount(
102 IXMLDOMParseError *iface,
109 static HRESULT WINAPI parseError_GetTypeInfo(
110 IXMLDOMParseError *iface,
113 ITypeInfo** ppTInfo )
119 static HRESULT WINAPI parseError_GetIDsOfNames(
120 IXMLDOMParseError *iface,
131 static HRESULT WINAPI parseError_Invoke(
132 IXMLDOMParseError *iface,
137 DISPPARAMS* pDispParams,
139 EXCEPINFO* pExcepInfo,
146 static HRESULT WINAPI parseError_get_errorCode(
147 IXMLDOMParseError *iface,
150 parse_error_t *This = impl_from_IXMLDOMParseError( iface );
151 TRACE("(%p)->(%p)\n", This, code);
161 static HRESULT WINAPI parseError_get_url(
162 IXMLDOMParseError *iface,
169 static HRESULT WINAPI parseError_get_reason(
170 IXMLDOMParseError *iface,
177 static HRESULT WINAPI parseError_get_srcText(
178 IXMLDOMParseError *iface,
185 static HRESULT WINAPI parseError_get_line(
186 IXMLDOMParseError *iface,
193 static HRESULT WINAPI parseError_get_linepos(
194 IXMLDOMParseError *iface,
201 static HRESULT WINAPI parseError_get_filepos(
202 IXMLDOMParseError *iface,
209 static const struct IXMLDOMParseErrorVtbl parseError_vtbl =
211 parseError_QueryInterface,
214 parseError_GetTypeInfoCount,
215 parseError_GetTypeInfo,
216 parseError_GetIDsOfNames,
218 parseError_get_errorCode,
220 parseError_get_reason,
221 parseError_get_srcText,
223 parseError_get_linepos,
224 parseError_get_filepos
227 IXMLDOMParseError *create_parseError( LONG code, BSTR url, BSTR reason, BSTR srcText,
228 LONG line, LONG linepos, LONG filepos )
232 This = HeapAlloc( GetProcessHeap(), 0, sizeof(*This) );
236 This->lpVtbl = &parseError_vtbl;
241 This->reason = reason;
242 This->srcText = srcText;
244 This->linepos = linepos;
245 This->filepos = filepos;
247 return (IXMLDOMParseError*) &This->lpVtbl;