Home | Info | Community | Development | myReactOS | Contact Us
ReactOS Development > Doxygenparseerror.c
Go to the documentation of this file.
00001 /* 00002 * ParseError implementation 00003 * 00004 * Copyright 2005 Huw Davies 00005 * 00006 * This library is free software; you can redistribute it and/or 00007 * modify it under the terms of the GNU Lesser General Public 00008 * License as published by the Free Software Foundation; either 00009 * version 2.1 of the License, or (at your option) any later version. 00010 * 00011 * This library is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00014 * Lesser General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU Lesser General Public 00017 * License along with this library; if not, write to the Free Software 00018 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA 00019 */ 00020 00021 00022 #define COBJMACROS 00023 00024 #include "config.h" 00025 00026 #include <stdarg.h> 00027 #include <assert.h> 00028 #include "windef.h" 00029 #include "winbase.h" 00030 #include "winerror.h" 00031 #include "winuser.h" 00032 #include "ole2.h" 00033 #include "msxml2.h" 00034 00035 #include "msxml_private.h" 00036 00037 #include "wine/debug.h" 00038 00039 WINE_DEFAULT_DEBUG_CHANNEL(msxml); 00040 00041 typedef struct 00042 { 00043 const struct IXMLDOMParseErrorVtbl *lpVtbl; 00044 LONG ref; 00045 LONG code, line, linepos, filepos; 00046 BSTR url, reason, srcText; 00047 } parse_error_t; 00048 00049 static inline parse_error_t *impl_from_IXMLDOMParseError( IXMLDOMParseError *iface ) 00050 { 00051 return (parse_error_t *)((char*)iface - FIELD_OFFSET(parse_error_t, lpVtbl)); 00052 } 00053 00054 static HRESULT WINAPI parseError_QueryInterface( 00055 IXMLDOMParseError *iface, 00056 REFIID riid, 00057 void** ppvObject ) 00058 { 00059 TRACE("(%p)->(%s %p)\n", iface, debugstr_guid(riid), ppvObject); 00060 00061 if ( IsEqualGUID( riid, &IID_IUnknown ) || 00062 IsEqualGUID( riid, &IID_IDispatch ) || 00063 IsEqualGUID( riid, &IID_IXMLDOMParseError ) ) 00064 { 00065 *ppvObject = iface; 00066 } 00067 else 00068 { 00069 FIXME("interface %s not implemented\n", debugstr_guid(riid)); 00070 return E_NOINTERFACE; 00071 } 00072 00073 IXMLDOMParseError_AddRef( iface ); 00074 00075 return S_OK; 00076 } 00077 00078 static ULONG WINAPI parseError_AddRef( 00079 IXMLDOMParseError *iface ) 00080 { 00081 parse_error_t *This = impl_from_IXMLDOMParseError( iface ); 00082 ULONG ref = InterlockedIncrement( &This->ref ); 00083 TRACE("(%p) ref now %d\n", This, ref); 00084 return ref; 00085 } 00086 00087 static ULONG WINAPI parseError_Release( 00088 IXMLDOMParseError *iface ) 00089 { 00090 parse_error_t *This = impl_from_IXMLDOMParseError( iface ); 00091 ULONG ref; 00092 00093 ref = InterlockedDecrement( &This->ref ); 00094 TRACE("(%p) ref now %d\n", This, ref); 00095 if ( ref == 0 ) 00096 { 00097 SysFreeString(This->url); 00098 SysFreeString(This->reason); 00099 SysFreeString(This->srcText); 00100 heap_free( This ); 00101 } 00102 00103 return ref; 00104 } 00105 00106 static HRESULT WINAPI parseError_GetTypeInfoCount( 00107 IXMLDOMParseError *iface, 00108 UINT* pctinfo ) 00109 { 00110 parse_error_t *This = impl_from_IXMLDOMParseError( iface ); 00111 00112 TRACE("(%p)->(%p)\n", This, pctinfo); 00113 00114 *pctinfo = 1; 00115 00116 return S_OK; 00117 } 00118 00119 static HRESULT WINAPI parseError_GetTypeInfo( 00120 IXMLDOMParseError *iface, 00121 UINT iTInfo, 00122 LCID lcid, 00123 ITypeInfo** ppTInfo ) 00124 { 00125 parse_error_t *This = impl_from_IXMLDOMParseError( iface ); 00126 HRESULT hr; 00127 00128 TRACE("(%p)->(%u %u %p)\n", This, iTInfo, lcid, ppTInfo); 00129 00130 hr = get_typeinfo(IXMLDOMParseError_tid, ppTInfo); 00131 00132 return hr; 00133 } 00134 00135 static HRESULT WINAPI parseError_GetIDsOfNames( 00136 IXMLDOMParseError *iface, 00137 REFIID riid, 00138 LPOLESTR* rgszNames, 00139 UINT cNames, 00140 LCID lcid, 00141 DISPID* rgDispId ) 00142 { 00143 parse_error_t *This = impl_from_IXMLDOMParseError( iface ); 00144 ITypeInfo *typeinfo; 00145 HRESULT hr; 00146 00147 TRACE("(%p)->(%s %p %u %u %p)\n", This, debugstr_guid(riid), rgszNames, cNames, 00148 lcid, rgDispId); 00149 00150 if(!rgszNames || cNames == 0 || !rgDispId) 00151 return E_INVALIDARG; 00152 00153 hr = get_typeinfo(IXMLDOMParseError_tid, &typeinfo); 00154 if(SUCCEEDED(hr)) 00155 { 00156 hr = ITypeInfo_GetIDsOfNames(typeinfo, rgszNames, cNames, rgDispId); 00157 ITypeInfo_Release(typeinfo); 00158 } 00159 00160 return hr; 00161 } 00162 00163 static HRESULT WINAPI parseError_Invoke( 00164 IXMLDOMParseError *iface, 00165 DISPID dispIdMember, 00166 REFIID riid, 00167 LCID lcid, 00168 WORD wFlags, 00169 DISPPARAMS* pDispParams, 00170 VARIANT* pVarResult, 00171 EXCEPINFO* pExcepInfo, 00172 UINT* puArgErr ) 00173 { 00174 parse_error_t *This = impl_from_IXMLDOMParseError( iface ); 00175 ITypeInfo *typeinfo; 00176 HRESULT hr; 00177 00178 TRACE("(%p)->(%d %s %d %d %p %p %p %p)\n", This, dispIdMember, debugstr_guid(riid), 00179 lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr); 00180 00181 hr = get_typeinfo(IXMLDOMParseError_tid, &typeinfo); 00182 if(SUCCEEDED(hr)) 00183 { 00184 hr = ITypeInfo_Invoke(typeinfo, &(This->lpVtbl), dispIdMember, wFlags, pDispParams, 00185 pVarResult, pExcepInfo, puArgErr); 00186 ITypeInfo_Release(typeinfo); 00187 } 00188 00189 return hr; 00190 } 00191 00192 static HRESULT WINAPI parseError_get_errorCode( 00193 IXMLDOMParseError *iface, 00194 LONG *code ) 00195 { 00196 parse_error_t *This = impl_from_IXMLDOMParseError( iface ); 00197 TRACE("(%p)->(%p)\n", This, code); 00198 00199 *code = This->code; 00200 00201 if(This->code == 0) 00202 return S_FALSE; 00203 00204 return S_OK; 00205 } 00206 00207 static HRESULT WINAPI parseError_get_url( 00208 IXMLDOMParseError *iface, 00209 BSTR *url ) 00210 { 00211 parse_error_t *This = impl_from_IXMLDOMParseError( iface ); 00212 FIXME("(%p)->(%p)\n", This, url); 00213 return E_NOTIMPL; 00214 } 00215 00216 static HRESULT WINAPI parseError_get_reason( 00217 IXMLDOMParseError *iface, 00218 BSTR *reason ) 00219 { 00220 parse_error_t *This = impl_from_IXMLDOMParseError( iface ); 00221 TRACE("(%p)->(%p)\n", This, reason); 00222 00223 if(!This->reason) 00224 { 00225 *reason = NULL; 00226 return S_FALSE; 00227 } 00228 *reason = SysAllocString(This->reason); 00229 return S_OK; 00230 } 00231 00232 static HRESULT WINAPI parseError_get_srcText( 00233 IXMLDOMParseError *iface, 00234 BSTR *srcText ) 00235 { 00236 parse_error_t *This = impl_from_IXMLDOMParseError( iface ); 00237 FIXME("(%p)->(%p)\n", This, srcText); 00238 return E_NOTIMPL; 00239 } 00240 00241 static HRESULT WINAPI parseError_get_line( 00242 IXMLDOMParseError *iface, 00243 LONG *line ) 00244 { 00245 parse_error_t *This = impl_from_IXMLDOMParseError( iface ); 00246 FIXME("(%p)->(%p)\n", This, line); 00247 return E_NOTIMPL; 00248 } 00249 00250 static HRESULT WINAPI parseError_get_linepos( 00251 IXMLDOMParseError *iface, 00252 LONG *linepos ) 00253 { 00254 parse_error_t *This = impl_from_IXMLDOMParseError( iface ); 00255 FIXME("(%p)->(%p)\n", This, linepos); 00256 return E_NOTIMPL; 00257 } 00258 00259 static HRESULT WINAPI parseError_get_filepos( 00260 IXMLDOMParseError *iface, 00261 LONG *filepos ) 00262 { 00263 parse_error_t *This = impl_from_IXMLDOMParseError( iface ); 00264 FIXME("(%p)->(%p)\n", This, filepos); 00265 return E_NOTIMPL; 00266 } 00267 00268 static const struct IXMLDOMParseErrorVtbl parseError_vtbl = 00269 { 00270 parseError_QueryInterface, 00271 parseError_AddRef, 00272 parseError_Release, 00273 parseError_GetTypeInfoCount, 00274 parseError_GetTypeInfo, 00275 parseError_GetIDsOfNames, 00276 parseError_Invoke, 00277 parseError_get_errorCode, 00278 parseError_get_url, 00279 parseError_get_reason, 00280 parseError_get_srcText, 00281 parseError_get_line, 00282 parseError_get_linepos, 00283 parseError_get_filepos 00284 }; 00285 00286 IXMLDOMParseError *create_parseError( LONG code, BSTR url, BSTR reason, BSTR srcText, 00287 LONG line, LONG linepos, LONG filepos ) 00288 { 00289 parse_error_t *This; 00290 00291 This = heap_alloc( sizeof(*This) ); 00292 if ( !This ) 00293 return NULL; 00294 00295 This->lpVtbl = &parseError_vtbl; 00296 This->ref = 1; 00297 00298 This->code = code; 00299 This->url = url; 00300 This->reason = reason; 00301 This->srcText = srcText; 00302 This->line = line; 00303 This->linepos = linepos; 00304 This->filepos = filepos; 00305 00306 return (IXMLDOMParseError*) &This->lpVtbl; 00307 } Generated on Fri May 25 2012 04:23:28 for ReactOS by
1.7.6.1
|