wineps: Fix a couple of typos in the path painting function.
[wine/testsucceed.git] / dlls / msxml3 / parseerror.c
blob8e678163cbfaead47823af4a80cc3705e8b0502a
1 /*
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
22 #define COBJMACROS
24 #include "config.h"
26 #include <stdarg.h>
27 #ifdef HAVE_LIBXML2
28 # include <libxml/parser.h>
29 # include <libxml/xmlerror.h>
30 #endif
32 #include "windef.h"
33 #include "winbase.h"
34 #include "winerror.h"
35 #include "winuser.h"
36 #include "ole2.h"
37 #include "msxml6.h"
39 #include "msxml_private.h"
41 #include "wine/debug.h"
43 WINE_DEFAULT_DEBUG_CHANNEL(msxml);
45 typedef struct
47 IXMLDOMParseError IXMLDOMParseError_iface;
48 LONG ref;
49 LONG code, line, linepos, filepos;
50 BSTR url, reason, srcText;
51 } parse_error_t;
53 static inline parse_error_t *impl_from_IXMLDOMParseError( IXMLDOMParseError *iface )
55 return CONTAINING_RECORD(iface, parse_error_t, IXMLDOMParseError_iface);
58 static HRESULT WINAPI parseError_QueryInterface(
59 IXMLDOMParseError *iface,
60 REFIID riid,
61 void** ppvObject )
63 parse_error_t *This = impl_from_IXMLDOMParseError( iface );
65 TRACE("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppvObject);
67 if ( IsEqualGUID( riid, &IID_IUnknown ) ||
68 IsEqualGUID( riid, &IID_IDispatch ) ||
69 IsEqualGUID( riid, &IID_IXMLDOMParseError ) )
71 *ppvObject = iface;
73 else
75 FIXME("interface %s not implemented\n", debugstr_guid(riid));
76 *ppvObject = NULL;
77 return E_NOINTERFACE;
80 IXMLDOMParseError_AddRef( iface );
82 return S_OK;
85 static ULONG WINAPI parseError_AddRef(
86 IXMLDOMParseError *iface )
88 parse_error_t *This = impl_from_IXMLDOMParseError( iface );
89 ULONG ref = InterlockedIncrement( &This->ref );
90 TRACE("(%p)->(%d)\n", This, ref);
91 return ref;
94 static ULONG WINAPI parseError_Release(
95 IXMLDOMParseError *iface )
97 parse_error_t *This = impl_from_IXMLDOMParseError( iface );
98 ULONG ref = InterlockedDecrement( &This->ref );
100 TRACE("(%p)->(%d)\n", This, ref);
101 if ( ref == 0 )
103 SysFreeString(This->url);
104 SysFreeString(This->reason);
105 SysFreeString(This->srcText);
106 heap_free( This );
109 return ref;
112 static HRESULT WINAPI parseError_GetTypeInfoCount(
113 IXMLDOMParseError *iface,
114 UINT* pctinfo )
116 parse_error_t *This = impl_from_IXMLDOMParseError( iface );
118 TRACE("(%p)->(%p)\n", This, pctinfo);
120 *pctinfo = 1;
122 return S_OK;
125 static HRESULT WINAPI parseError_GetTypeInfo(
126 IXMLDOMParseError *iface,
127 UINT iTInfo,
128 LCID lcid,
129 ITypeInfo** ppTInfo )
131 parse_error_t *This = impl_from_IXMLDOMParseError( iface );
132 HRESULT hr;
134 TRACE("(%p)->(%u %u %p)\n", This, iTInfo, lcid, ppTInfo);
136 hr = get_typeinfo(IXMLDOMParseError_tid, ppTInfo);
138 return hr;
141 static HRESULT WINAPI parseError_GetIDsOfNames(
142 IXMLDOMParseError *iface,
143 REFIID riid,
144 LPOLESTR* rgszNames,
145 UINT cNames,
146 LCID lcid,
147 DISPID* rgDispId )
149 parse_error_t *This = impl_from_IXMLDOMParseError( iface );
150 ITypeInfo *typeinfo;
151 HRESULT hr;
153 TRACE("(%p)->(%s %p %u %u %p)\n", This, debugstr_guid(riid), rgszNames, cNames,
154 lcid, rgDispId);
156 if(!rgszNames || cNames == 0 || !rgDispId)
157 return E_INVALIDARG;
159 hr = get_typeinfo(IXMLDOMParseError_tid, &typeinfo);
160 if(SUCCEEDED(hr))
162 hr = ITypeInfo_GetIDsOfNames(typeinfo, rgszNames, cNames, rgDispId);
163 ITypeInfo_Release(typeinfo);
166 return hr;
169 static HRESULT WINAPI parseError_Invoke(
170 IXMLDOMParseError *iface,
171 DISPID dispIdMember,
172 REFIID riid,
173 LCID lcid,
174 WORD wFlags,
175 DISPPARAMS* pDispParams,
176 VARIANT* pVarResult,
177 EXCEPINFO* pExcepInfo,
178 UINT* puArgErr )
180 parse_error_t *This = impl_from_IXMLDOMParseError( iface );
181 ITypeInfo *typeinfo;
182 HRESULT hr;
184 TRACE("(%p)->(%d %s %d %d %p %p %p %p)\n", This, dispIdMember, debugstr_guid(riid),
185 lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
187 hr = get_typeinfo(IXMLDOMParseError_tid, &typeinfo);
188 if(SUCCEEDED(hr))
190 hr = ITypeInfo_Invoke(typeinfo, &This->IXMLDOMParseError_iface, dispIdMember, wFlags,
191 pDispParams, pVarResult, pExcepInfo, puArgErr);
192 ITypeInfo_Release(typeinfo);
195 return hr;
198 static HRESULT WINAPI parseError_get_errorCode(
199 IXMLDOMParseError *iface,
200 LONG *code )
202 parse_error_t *This = impl_from_IXMLDOMParseError( iface );
203 TRACE("(%p)->(%p)\n", This, code);
205 *code = This->code;
207 if(This->code == 0)
208 return S_FALSE;
210 return S_OK;
213 static HRESULT WINAPI parseError_get_url(
214 IXMLDOMParseError *iface,
215 BSTR *url )
217 parse_error_t *This = impl_from_IXMLDOMParseError( iface );
218 FIXME("(%p)->(%p)\n", This, url);
219 return E_NOTIMPL;
222 static HRESULT WINAPI parseError_get_reason(
223 IXMLDOMParseError *iface,
224 BSTR *reason )
226 parse_error_t *This = impl_from_IXMLDOMParseError( iface );
227 TRACE("(%p)->(%p)\n", This, reason);
229 if(!This->reason)
231 *reason = NULL;
232 return S_FALSE;
234 *reason = SysAllocString(This->reason);
235 return S_OK;
238 static HRESULT WINAPI parseError_get_srcText(
239 IXMLDOMParseError *iface,
240 BSTR *srcText )
242 parse_error_t *This = impl_from_IXMLDOMParseError( iface );
243 FIXME("(%p)->(%p)\n", This, srcText);
244 return E_NOTIMPL;
247 static HRESULT WINAPI parseError_get_line(
248 IXMLDOMParseError *iface,
249 LONG *line )
251 parse_error_t *This = impl_from_IXMLDOMParseError( iface );
252 FIXME("(%p)->(%p)\n", This, line);
253 return E_NOTIMPL;
256 static HRESULT WINAPI parseError_get_linepos(
257 IXMLDOMParseError *iface,
258 LONG *linepos )
260 parse_error_t *This = impl_from_IXMLDOMParseError( iface );
261 FIXME("(%p)->(%p)\n", This, linepos);
262 return E_NOTIMPL;
265 static HRESULT WINAPI parseError_get_filepos(
266 IXMLDOMParseError *iface,
267 LONG *filepos )
269 parse_error_t *This = impl_from_IXMLDOMParseError( iface );
270 FIXME("(%p)->(%p)\n", This, filepos);
271 return E_NOTIMPL;
274 static const struct IXMLDOMParseErrorVtbl parseError_vtbl =
276 parseError_QueryInterface,
277 parseError_AddRef,
278 parseError_Release,
279 parseError_GetTypeInfoCount,
280 parseError_GetTypeInfo,
281 parseError_GetIDsOfNames,
282 parseError_Invoke,
283 parseError_get_errorCode,
284 parseError_get_url,
285 parseError_get_reason,
286 parseError_get_srcText,
287 parseError_get_line,
288 parseError_get_linepos,
289 parseError_get_filepos
292 IXMLDOMParseError *create_parseError( LONG code, BSTR url, BSTR reason, BSTR srcText,
293 LONG line, LONG linepos, LONG filepos )
295 parse_error_t *This;
297 This = heap_alloc( sizeof(*This) );
298 if ( !This )
299 return NULL;
301 This->IXMLDOMParseError_iface.lpVtbl = &parseError_vtbl;
302 This->ref = 1;
304 This->code = code;
305 This->url = url;
306 This->reason = reason;
307 This->srcText = srcText;
308 This->line = line;
309 This->linepos = linepos;
310 This->filepos = filepos;
312 return &This->IXMLDOMParseError_iface;