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
);
100 HeapFree( GetProcessHeap(), 0, This
);
106 static HRESULT WINAPI
parseError_GetTypeInfoCount(
107 IXMLDOMParseError
*iface
,
114 static HRESULT WINAPI
parseError_GetTypeInfo(
115 IXMLDOMParseError
*iface
,
118 ITypeInfo
** ppTInfo
)
124 static HRESULT WINAPI
parseError_GetIDsOfNames(
125 IXMLDOMParseError
*iface
,
136 static HRESULT WINAPI
parseError_Invoke(
137 IXMLDOMParseError
*iface
,
142 DISPPARAMS
* pDispParams
,
144 EXCEPINFO
* pExcepInfo
,
151 static HRESULT WINAPI
parseError_get_errorCode(
152 IXMLDOMParseError
*iface
,
155 parse_error_t
*This
= impl_from_IXMLDOMParseError( iface
);
156 TRACE("(%p)->(%p)\n", This
, code
);
166 static HRESULT WINAPI
parseError_get_url(
167 IXMLDOMParseError
*iface
,
174 static HRESULT WINAPI
parseError_get_reason(
175 IXMLDOMParseError
*iface
,
178 parse_error_t
*This
= impl_from_IXMLDOMParseError( iface
);
179 TRACE("(%p)->(%p)\n", This
, reason
);
186 *reason
= SysAllocString(This
->reason
);
190 static HRESULT WINAPI
parseError_get_srcText(
191 IXMLDOMParseError
*iface
,
198 static HRESULT WINAPI
parseError_get_line(
199 IXMLDOMParseError
*iface
,
206 static HRESULT WINAPI
parseError_get_linepos(
207 IXMLDOMParseError
*iface
,
214 static HRESULT WINAPI
parseError_get_filepos(
215 IXMLDOMParseError
*iface
,
222 static const struct IXMLDOMParseErrorVtbl parseError_vtbl
=
224 parseError_QueryInterface
,
227 parseError_GetTypeInfoCount
,
228 parseError_GetTypeInfo
,
229 parseError_GetIDsOfNames
,
231 parseError_get_errorCode
,
233 parseError_get_reason
,
234 parseError_get_srcText
,
236 parseError_get_linepos
,
237 parseError_get_filepos
240 IXMLDOMParseError
*create_parseError( LONG code
, BSTR url
, BSTR reason
, BSTR srcText
,
241 LONG line
, LONG linepos
, LONG filepos
)
245 This
= HeapAlloc( GetProcessHeap(), 0, sizeof(*This
) );
249 This
->lpVtbl
= &parseError_vtbl
;
254 This
->reason
= reason
;
255 This
->srcText
= srcText
;
257 This
->linepos
= linepos
;
258 This
->filepos
= filepos
;
260 return (IXMLDOMParseError
*) &This
->lpVtbl
;