ReactOS Fundraising Campaign 2012
 
€ 4,410 / € 30,000

Information | Donate

Home | Info | Community | Development | myReactOS | Contact Us

  1. Home
  2. Community
  3. Development
  4. myReactOS
  5. Fundraiser 2012

  1. Main Page
  2. Alphabetical List
  3. Data Structures
  4. Directories
  5. File List
  6. Data Fields
  7. Globals
  8. Related Pages

ReactOS Development > Doxygen

schema.c
Go to the documentation of this file.
00001 /*
00002  * Schema cache implementation
00003  *
00004  * Copyright 2007 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 #define COBJMACROS
00022 
00023 #include "config.h"
00024 
00025 #include <stdarg.h>
00026 #include "windef.h"
00027 #include "winbase.h"
00028 #include "winuser.h"
00029 #include "ole2.h"
00030 #include "msxml2.h"
00031 
00032 #include "wine/debug.h"
00033 
00034 #include "msxml_private.h"
00035 
00036 WINE_DEFAULT_DEBUG_CHANNEL(msxml);
00037 
00038 
00039 typedef struct
00040 {
00041     const struct IXMLDOMSchemaCollectionVtbl *lpVtbl;
00042     LONG ref;
00043 } schema_t;
00044 
00045 static inline schema_t *impl_from_IXMLDOMSchemaCollection( IXMLDOMSchemaCollection *iface )
00046 {
00047     return (schema_t *)((char*)iface - FIELD_OFFSET(schema_t, lpVtbl));
00048 }
00049 
00050 static HRESULT WINAPI schema_cache_QueryInterface( IXMLDOMSchemaCollection *iface, REFIID riid, void** ppvObject )
00051 {
00052     schema_t *This = impl_from_IXMLDOMSchemaCollection( iface );
00053 
00054     TRACE("(%p)->(%s %p)\n", This, debugstr_guid( riid ), ppvObject );
00055 
00056     if ( IsEqualIID( riid, &IID_IUnknown ) ||
00057          IsEqualIID( riid, &IID_IDispatch ) ||
00058          IsEqualIID( riid, &IID_IXMLDOMSchemaCollection ) )
00059     {
00060         *ppvObject = iface;
00061     }
00062     else
00063     {
00064         FIXME("interface %s not implemented\n", debugstr_guid(riid));
00065         return E_NOINTERFACE;
00066     }
00067 
00068     IXMLDOMSchemaCollection_AddRef( iface );
00069 
00070     return S_OK;
00071 }
00072 
00073 static ULONG WINAPI schema_cache_AddRef( IXMLDOMSchemaCollection *iface )
00074 {
00075     schema_t *This = impl_from_IXMLDOMSchemaCollection( iface );
00076     LONG ref = InterlockedIncrement( &This->ref );
00077     TRACE("%p new ref %d\n", This, ref);
00078     return ref;
00079 }
00080 
00081 static ULONG WINAPI schema_cache_Release( IXMLDOMSchemaCollection *iface )
00082 {
00083     schema_t *This = impl_from_IXMLDOMSchemaCollection( iface );
00084     LONG ref = InterlockedDecrement( &This->ref );
00085     TRACE("%p new ref %d\n", This, ref);
00086 
00087     if ( ref == 0 )
00088     {
00089         heap_free( This );
00090     }
00091 
00092     return ref;
00093 }
00094 
00095 static HRESULT WINAPI schema_cache_GetTypeInfoCount( IXMLDOMSchemaCollection *iface, UINT* pctinfo )
00096 {
00097     schema_t *This = impl_from_IXMLDOMSchemaCollection( iface );
00098 
00099     TRACE("(%p)->(%p)\n", This, pctinfo);
00100 
00101     *pctinfo = 1;
00102 
00103     return S_OK;
00104 }
00105 
00106 static HRESULT WINAPI schema_cache_GetTypeInfo( IXMLDOMSchemaCollection *iface,
00107                                                 UINT iTInfo, LCID lcid, ITypeInfo** ppTInfo )
00108 {
00109     schema_t *This = impl_from_IXMLDOMSchemaCollection( iface );
00110     HRESULT hr;
00111 
00112     TRACE("(%p)->(%u %u %p)\n", This, iTInfo, lcid, ppTInfo);
00113 
00114     hr = get_typeinfo(IXMLDOMSchemaCollection_tid, ppTInfo);
00115 
00116     return hr;
00117 }
00118 
00119 static HRESULT WINAPI schema_cache_GetIDsOfNames( IXMLDOMSchemaCollection *iface,
00120                                                   REFIID riid,
00121                                                   LPOLESTR* rgszNames,
00122                                                   UINT cNames,
00123                                                   LCID lcid,
00124                                                   DISPID* rgDispId )
00125 {
00126     schema_t *This = impl_from_IXMLDOMSchemaCollection( iface );
00127     ITypeInfo *typeinfo;
00128     HRESULT hr;
00129 
00130     TRACE("(%p)->(%s %p %u %u %p)\n", This, debugstr_guid(riid), rgszNames, cNames,
00131           lcid, rgDispId);
00132 
00133     if(!rgszNames || cNames == 0 || !rgDispId)
00134         return E_INVALIDARG;
00135 
00136     hr = get_typeinfo(IXMLDOMSchemaCollection_tid, &typeinfo);
00137     if(SUCCEEDED(hr))
00138     {
00139         hr = ITypeInfo_GetIDsOfNames(typeinfo, rgszNames, cNames, rgDispId);
00140         ITypeInfo_Release(typeinfo);
00141     }
00142 
00143     return hr;
00144 }
00145 
00146 static HRESULT WINAPI schema_cache_Invoke( IXMLDOMSchemaCollection *iface,
00147                                            DISPID dispIdMember,
00148                                            REFIID riid,
00149                                            LCID lcid,
00150                                            WORD wFlags,
00151                                            DISPPARAMS* pDispParams,
00152                                            VARIANT* pVarResult,
00153                                            EXCEPINFO* pExcepInfo,
00154                                            UINT* puArgErr )
00155 {
00156     schema_t *This = impl_from_IXMLDOMSchemaCollection( iface );
00157     ITypeInfo *typeinfo;
00158     HRESULT hr;
00159 
00160     TRACE("(%p)->(%d %s %d %d %p %p %p %p)\n", This, dispIdMember, debugstr_guid(riid),
00161           lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
00162 
00163     hr = get_typeinfo(IXMLDOMSchemaCollection_tid, &typeinfo);
00164     if(SUCCEEDED(hr))
00165     {
00166         hr = ITypeInfo_Invoke(typeinfo, &(This->lpVtbl), dispIdMember, wFlags, pDispParams,
00167                 pVarResult, pExcepInfo, puArgErr);
00168         ITypeInfo_Release(typeinfo);
00169     }
00170 
00171     return hr;
00172 }
00173 
00174 static HRESULT WINAPI schema_cache_add( IXMLDOMSchemaCollection *iface, BSTR uri, VARIANT var )
00175 {
00176     FIXME("(%p)->(%s, var(vt %x)): stub\n", iface, debugstr_w(uri), V_VT(&var));
00177     return S_OK;
00178 }
00179 
00180 static HRESULT WINAPI schema_cache_get( IXMLDOMSchemaCollection *iface, BSTR uri, IXMLDOMNode **node )
00181 {
00182     FIXME("stub\n");
00183     return E_NOTIMPL;
00184 }
00185 
00186 static HRESULT WINAPI schema_cache_remove( IXMLDOMSchemaCollection *iface, BSTR uri )
00187 {
00188     FIXME("stub\n");
00189     return E_NOTIMPL;
00190 }
00191 
00192 static HRESULT WINAPI schema_cache_get_length( IXMLDOMSchemaCollection *iface, LONG *length )
00193 {
00194     FIXME("stub\n");
00195     return E_NOTIMPL;
00196 }
00197 
00198 static HRESULT WINAPI schema_cache_get_namespaceURI( IXMLDOMSchemaCollection *iface, LONG index, BSTR *len )
00199 {
00200     FIXME("stub\n");
00201     return E_NOTIMPL;
00202 }
00203 
00204 static HRESULT WINAPI schema_cache_addCollection( IXMLDOMSchemaCollection *iface, IXMLDOMSchemaCollection *otherCollection )
00205 {
00206     FIXME("stub\n");
00207     return E_NOTIMPL;
00208 }
00209 
00210 static HRESULT WINAPI schema_cache_get__newEnum( IXMLDOMSchemaCollection *iface, IUnknown **ppUnk )
00211 {
00212     FIXME("stub\n");
00213     return E_NOTIMPL;
00214 }
00215 
00216 static const struct IXMLDOMSchemaCollectionVtbl schema_vtbl =
00217 {
00218     schema_cache_QueryInterface,
00219     schema_cache_AddRef,
00220     schema_cache_Release,
00221     schema_cache_GetTypeInfoCount,
00222     schema_cache_GetTypeInfo,
00223     schema_cache_GetIDsOfNames,
00224     schema_cache_Invoke,
00225     schema_cache_add,
00226     schema_cache_get,
00227     schema_cache_remove,
00228     schema_cache_get_length,
00229     schema_cache_get_namespaceURI,
00230     schema_cache_addCollection,
00231     schema_cache_get__newEnum
00232 };
00233 
00234 HRESULT SchemaCache_create(IUnknown *pUnkOuter, LPVOID *ppObj)
00235 {
00236     schema_t *schema = heap_alloc( sizeof (*schema) );
00237     if( !schema )
00238         return E_OUTOFMEMORY;
00239 
00240     schema->lpVtbl = &schema_vtbl;
00241     schema->ref = 1;
00242 
00243     *ppObj = &schema->lpVtbl;
00244     return S_OK;
00245 }

Generated on Thu May 24 2012 04:25:49 for ReactOS by doxygen 1.7.6.1

ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.