cryptnet: Fix compilation on systems that don't support nameless unions.
[wine/gsoc_dplay.git] / dlls / msxml3 / parseerror.c
blobf70ed5278e178ff66e4adbe9dc9d1aed6305de79
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 #include <assert.h>
28 #include "windef.h"
29 #include "winbase.h"
30 #include "winerror.h"
31 #include "winuser.h"
32 #include "ole2.h"
33 #include "msxml2.h"
35 #include "msxml_private.h"
37 #include "wine/debug.h"
39 WINE_DEFAULT_DEBUG_CHANNEL(msxml);
41 typedef struct
43 const struct IXMLDOMParseErrorVtbl *lpVtbl;
44 LONG ref;
45 LONG code, line, linepos, filepos;
46 BSTR url, reason, srcText;
47 } parse_error_t;
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,
56 REFIID riid,
57 void** ppvObject )
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 ) )
65 *ppvObject = iface;
67 else
69 FIXME("interface %s not implemented\n", debugstr_guid(riid));
70 return E_NOINTERFACE;
73 IXMLDOMParseError_AddRef( iface );
75 return S_OK;
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);
84 return ref;
87 static ULONG WINAPI parseError_Release(
88 IXMLDOMParseError *iface )
90 parse_error_t *This = impl_from_IXMLDOMParseError( iface );
91 ULONG ref;
93 ref = InterlockedDecrement( &This->ref );
94 TRACE("(%p) ref now %d\n", This, ref);
95 if ( ref == 0 )
97 SysFreeString(This->url);
98 SysFreeString(This->reason);
99 SysFreeString(This->srcText);
100 HeapFree( GetProcessHeap(), 0, This );
103 return ref;
106 static HRESULT WINAPI parseError_GetTypeInfoCount(
107 IXMLDOMParseError *iface,
108 UINT* pctinfo )
110 FIXME("\n");
111 return E_NOTIMPL;
114 static HRESULT WINAPI parseError_GetTypeInfo(
115 IXMLDOMParseError *iface,
116 UINT iTInfo,
117 LCID lcid,
118 ITypeInfo** ppTInfo )
120 FIXME("\n");
121 return E_NOTIMPL;
124 static HRESULT WINAPI parseError_GetIDsOfNames(
125 IXMLDOMParseError *iface,
126 REFIID riid,
127 LPOLESTR* rgszNames,
128 UINT cNames,
129 LCID lcid,
130 DISPID* rgDispId )
132 FIXME("\n");
133 return E_NOTIMPL;
136 static HRESULT WINAPI parseError_Invoke(
137 IXMLDOMParseError *iface,
138 DISPID dispIdMember,
139 REFIID riid,
140 LCID lcid,
141 WORD wFlags,
142 DISPPARAMS* pDispParams,
143 VARIANT* pVarResult,
144 EXCEPINFO* pExcepInfo,
145 UINT* puArgErr )
147 FIXME("\n");
148 return E_NOTIMPL;
151 static HRESULT WINAPI parseError_get_errorCode(
152 IXMLDOMParseError *iface,
153 long *code )
155 parse_error_t *This = impl_from_IXMLDOMParseError( iface );
156 TRACE("(%p)->(%p)\n", This, code);
158 *code = This->code;
160 if(This->code == 0)
161 return S_FALSE;
163 return S_OK;
166 static HRESULT WINAPI parseError_get_url(
167 IXMLDOMParseError *iface,
168 BSTR *url )
170 FIXME("\n");
171 return E_NOTIMPL;
174 static HRESULT WINAPI parseError_get_reason(
175 IXMLDOMParseError *iface,
176 BSTR *reason )
178 parse_error_t *This = impl_from_IXMLDOMParseError( iface );
179 TRACE("(%p)->(%p)\n", This, reason);
181 if(!This->reason)
183 *reason = NULL;
184 return S_FALSE;
186 *reason = SysAllocString(This->reason);
187 return S_OK;
190 static HRESULT WINAPI parseError_get_srcText(
191 IXMLDOMParseError *iface,
192 BSTR *srcText )
194 FIXME("\n");
195 return E_NOTIMPL;
198 static HRESULT WINAPI parseError_get_line(
199 IXMLDOMParseError *iface,
200 long *line )
202 FIXME("\n");
203 return E_NOTIMPL;
206 static HRESULT WINAPI parseError_get_linepos(
207 IXMLDOMParseError *iface,
208 long *linepos )
210 FIXME("\n");
211 return E_NOTIMPL;
214 static HRESULT WINAPI parseError_get_filepos(
215 IXMLDOMParseError *iface,
216 long *filepos )
218 FIXME("\n");
219 return E_NOTIMPL;
222 static const struct IXMLDOMParseErrorVtbl parseError_vtbl =
224 parseError_QueryInterface,
225 parseError_AddRef,
226 parseError_Release,
227 parseError_GetTypeInfoCount,
228 parseError_GetTypeInfo,
229 parseError_GetIDsOfNames,
230 parseError_Invoke,
231 parseError_get_errorCode,
232 parseError_get_url,
233 parseError_get_reason,
234 parseError_get_srcText,
235 parseError_get_line,
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 )
243 parse_error_t *This;
245 This = HeapAlloc( GetProcessHeap(), 0, sizeof(*This) );
246 if ( !This )
247 return NULL;
249 This->lpVtbl = &parseError_vtbl;
250 This->ref = 1;
252 This->code = code;
253 This->url = url;
254 This->reason = reason;
255 This->srcText = srcText;
256 This->line = line;
257 This->linepos = linepos;
258 This->filepos = filepos;
260 return (IXMLDOMParseError*) &This->lpVtbl;