UDK 3.2.7 C/C++ API Reference
|
00001 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ 00002 /************************************************************************* 00003 * 00004 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 00005 * 00006 * Copyright 2000, 2010 Oracle and/or its affiliates. 00007 * 00008 * OpenOffice.org - a multi-platform office productivity suite 00009 * 00010 * This file is part of OpenOffice.org. 00011 * 00012 * OpenOffice.org is free software: you can redistribute it and/or modify 00013 * it under the terms of the GNU Lesser General Public License version 3 00014 * only, as published by the Free Software Foundation. 00015 * 00016 * OpenOffice.org is distributed in the hope that it will be useful, 00017 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00018 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00019 * GNU Lesser General Public License version 3 for more details 00020 * (a copy is included in the LICENSE file that accompanied this code). 00021 * 00022 * You should have received a copy of the GNU Lesser General Public License 00023 * version 3 along with OpenOffice.org. If not, see 00024 * <http://www.openoffice.org/license.html> 00025 * for a copy of the LGPLv3 License. 00026 * 00027 ************************************************************************/ 00028 #ifndef _CPPUHELPER_IMPLBASE2_HXX_ 00029 #define _CPPUHELPER_IMPLBASE2_HXX_ 00030 00031 #include <cppuhelper/implbase_ex.hxx> 00032 #include <rtl/instance.hxx> 00033 00034 namespace cppu 00035 { 00037 00038 struct class_data2 00039 { 00040 sal_Int16 m_nTypes; 00041 sal_Bool m_storedTypeRefs; 00042 sal_Bool m_storedId; 00043 sal_Int8 m_id[ 16 ]; 00044 type_entry m_typeEntries[ 2 + 1 ]; 00045 }; 00046 00047 template< typename Ifc1, typename Ifc2, typename Impl > struct ImplClassData2 00048 { 00049 class_data* operator ()() 00050 { 00051 static class_data2 s_cd = 00052 { 00053 2 +1, sal_False, sal_False, 00054 { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, 00055 { 00056 { { Ifc1::static_type }, ((sal_IntPtr)(Ifc1 *) (Impl *) 16) - 16 }, 00057 { { Ifc2::static_type }, ((sal_IntPtr)(Ifc2 *) (Impl *) 16) - 16 }, 00058 { { com::sun::star::lang::XTypeProvider::static_type }, ((sal_IntPtr)(com::sun::star::lang::XTypeProvider *) (Impl *) 16) - 16 } 00059 } 00060 }; 00061 return reinterpret_cast< class_data * >(&s_cd); 00062 } 00063 }; 00064 00066 00075 template< class Ifc1, class Ifc2 > 00076 class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE ImplHelper2 00077 : public com::sun::star::lang::XTypeProvider 00078 , public Ifc1, public Ifc2 00079 { 00080 struct cd : public rtl::StaticAggregate< class_data, ImplClassData2 < Ifc1, Ifc2, ImplHelper2<Ifc1, Ifc2> > > {}; 00081 public: 00082 virtual com::sun::star::uno::Any SAL_CALL queryInterface( com::sun::star::uno::Type const & rType ) throw (com::sun::star::uno::RuntimeException) 00083 { return ImplHelper_query( rType, cd::get(), this ); } 00084 virtual com::sun::star::uno::Sequence< com::sun::star::uno::Type > SAL_CALL getTypes() throw (com::sun::star::uno::RuntimeException) 00085 { return ImplHelper_getTypes( cd::get() ); } 00086 virtual com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (com::sun::star::uno::RuntimeException) 00087 { return ImplHelper_getImplementationId( cd::get() ); } 00088 00089 #if !defined _MSC_VER // public -> protected changes mangled names there 00090 protected: 00091 #endif 00092 ~ImplHelper2() throw () {} 00093 }; 00102 template< class Ifc1, class Ifc2 > 00103 class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE WeakImplHelper2 00104 : public OWeakObject 00105 , public com::sun::star::lang::XTypeProvider 00106 , public Ifc1, public Ifc2 00107 { 00108 struct cd : public rtl::StaticAggregate< class_data, ImplClassData2 < Ifc1, Ifc2, WeakImplHelper2<Ifc1, Ifc2> > > {}; 00109 public: 00110 virtual com::sun::star::uno::Any SAL_CALL queryInterface( com::sun::star::uno::Type const & rType ) throw (com::sun::star::uno::RuntimeException) 00111 { return WeakImplHelper_query( rType, cd::get(), this, (OWeakObject *)this ); } 00112 virtual void SAL_CALL acquire() throw () 00113 { OWeakObject::acquire(); } 00114 virtual void SAL_CALL release() throw () 00115 { OWeakObject::release(); } 00116 virtual com::sun::star::uno::Sequence< com::sun::star::uno::Type > SAL_CALL getTypes() throw (com::sun::star::uno::RuntimeException) 00117 { return WeakImplHelper_getTypes( cd::get() ); } 00118 virtual com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (com::sun::star::uno::RuntimeException) 00119 { return ImplHelper_getImplementationId( cd::get() ); } 00120 }; 00134 template< class Ifc1, class Ifc2 > 00135 class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE WeakAggImplHelper2 00136 : public OWeakAggObject 00137 , public com::sun::star::lang::XTypeProvider 00138 , public Ifc1, public Ifc2 00139 { 00140 struct cd : public rtl::StaticAggregate< class_data, ImplClassData2 < Ifc1, Ifc2, WeakAggImplHelper2<Ifc1, Ifc2> > > {}; 00141 public: 00142 virtual com::sun::star::uno::Any SAL_CALL queryInterface( com::sun::star::uno::Type const & rType ) throw (com::sun::star::uno::RuntimeException) 00143 { return OWeakAggObject::queryInterface( rType ); } 00144 virtual com::sun::star::uno::Any SAL_CALL queryAggregation( com::sun::star::uno::Type const & rType ) throw (com::sun::star::uno::RuntimeException) 00145 { return WeakAggImplHelper_queryAgg( rType, cd::get(), this, (OWeakAggObject *)this ); } 00146 virtual void SAL_CALL acquire() throw () 00147 { OWeakAggObject::acquire(); } 00148 virtual void SAL_CALL release() throw () 00149 { OWeakAggObject::release(); } 00150 virtual com::sun::star::uno::Sequence< com::sun::star::uno::Type > SAL_CALL getTypes() throw (com::sun::star::uno::RuntimeException) 00151 { return WeakAggImplHelper_getTypes( cd::get() ); } 00152 virtual com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (com::sun::star::uno::RuntimeException) 00153 { return ImplHelper_getImplementationId( cd::get() ); } 00154 }; 00171 template< class BaseClass, class Ifc1, class Ifc2 > 00172 class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE ImplInheritanceHelper2 00173 : public BaseClass 00174 , public Ifc1, public Ifc2 00175 { 00176 struct cd : public rtl::StaticAggregate< class_data, ImplClassData2 < Ifc1, Ifc2, ImplInheritanceHelper2<BaseClass, Ifc1, Ifc2> > > {}; 00177 protected: 00178 template< typename T1 > 00179 explicit ImplInheritanceHelper2(T1 const & arg1): BaseClass(arg1) {} 00180 template< typename T1, typename T2 > 00181 ImplInheritanceHelper2(T1 const & arg1, T2 const & arg2): 00182 BaseClass(arg1, arg2) {} 00183 template< typename T1, typename T2, typename T3 > 00184 ImplInheritanceHelper2( 00185 T1 const & arg1, T2 const & arg2, T3 const & arg3): 00186 BaseClass(arg1, arg2, arg3) {} 00187 template< typename T1, typename T2, typename T3, typename T4 > 00188 ImplInheritanceHelper2( 00189 T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4): 00190 BaseClass(arg1, arg2, arg3, arg4) {} 00191 template< 00192 typename T1, typename T2, typename T3, typename T4, typename T5 > 00193 ImplInheritanceHelper2( 00194 T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4, 00195 T5 const & arg5): 00196 BaseClass(arg1, arg2, arg3, arg4, arg5) {} 00197 template< 00198 typename T1, typename T2, typename T3, typename T4, typename T5, 00199 typename T6 > 00200 ImplInheritanceHelper2( 00201 T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4, 00202 T5 const & arg5, T6 const & arg6): 00203 BaseClass(arg1, arg2, arg3, arg4, arg5, arg6) {} 00204 public: 00205 ImplInheritanceHelper2() {} 00206 virtual com::sun::star::uno::Any SAL_CALL queryInterface( com::sun::star::uno::Type const & rType ) throw (com::sun::star::uno::RuntimeException) 00207 { 00208 com::sun::star::uno::Any aRet( ImplHelper_queryNoXInterface( rType, cd::get(), this ) ); 00209 if (aRet.hasValue()) 00210 return aRet; 00211 return BaseClass::queryInterface( rType ); 00212 } 00213 virtual void SAL_CALL acquire() throw () 00214 { BaseClass::acquire(); } 00215 virtual void SAL_CALL release() throw () 00216 { BaseClass::release(); } 00217 virtual com::sun::star::uno::Sequence< com::sun::star::uno::Type > SAL_CALL getTypes() throw (com::sun::star::uno::RuntimeException) 00218 { return ImplInhHelper_getTypes( cd::get(), BaseClass::getTypes() ); } 00219 virtual com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (com::sun::star::uno::RuntimeException) 00220 { return ImplHelper_getImplementationId( cd::get() ); } 00221 }; 00239 template< class BaseClass, class Ifc1, class Ifc2 > 00240 class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE AggImplInheritanceHelper2 00241 : public BaseClass 00242 , public Ifc1, public Ifc2 00243 { 00244 struct cd : public rtl::StaticAggregate< class_data, ImplClassData2 < Ifc1, Ifc2, AggImplInheritanceHelper2<BaseClass, Ifc1, Ifc2> > > {}; 00245 protected: 00246 template< typename T1 > 00247 explicit AggImplInheritanceHelper2(T1 const & arg1): BaseClass(arg1) {} 00248 template< typename T1, typename T2 > 00249 AggImplInheritanceHelper2(T1 const & arg1, T2 const & arg2): 00250 BaseClass(arg1, arg2) {} 00251 template< typename T1, typename T2, typename T3 > 00252 AggImplInheritanceHelper2( 00253 T1 const & arg1, T2 const & arg2, T3 const & arg3): 00254 BaseClass(arg1, arg2, arg3) {} 00255 template< typename T1, typename T2, typename T3, typename T4 > 00256 AggImplInheritanceHelper2( 00257 T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4): 00258 BaseClass(arg1, arg2, arg3, arg4) {} 00259 template< 00260 typename T1, typename T2, typename T3, typename T4, typename T5 > 00261 AggImplInheritanceHelper2( 00262 T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4, 00263 T5 const & arg5): 00264 BaseClass(arg1, arg2, arg3, arg4, arg5) {} 00265 template< 00266 typename T1, typename T2, typename T3, typename T4, typename T5, 00267 typename T6 > 00268 AggImplInheritanceHelper2( 00269 T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4, 00270 T5 const & arg5, T6 const & arg6): 00271 BaseClass(arg1, arg2, arg3, arg4, arg5, arg6) {} 00272 public: 00273 AggImplInheritanceHelper2() {} 00274 virtual com::sun::star::uno::Any SAL_CALL queryInterface( com::sun::star::uno::Type const & rType ) throw (com::sun::star::uno::RuntimeException) 00275 { return BaseClass::queryInterface( rType ); } 00276 virtual com::sun::star::uno::Any SAL_CALL queryAggregation( com::sun::star::uno::Type const & rType ) throw (com::sun::star::uno::RuntimeException) 00277 { 00278 com::sun::star::uno::Any aRet( ImplHelper_queryNoXInterface( rType, cd::get(), this ) ); 00279 if (aRet.hasValue()) 00280 return aRet; 00281 return BaseClass::queryAggregation( rType ); 00282 } 00283 virtual void SAL_CALL acquire() throw () 00284 { BaseClass::acquire(); } 00285 virtual void SAL_CALL release() throw () 00286 { BaseClass::release(); } 00287 virtual com::sun::star::uno::Sequence< com::sun::star::uno::Type > SAL_CALL getTypes() throw (com::sun::star::uno::RuntimeException) 00288 { return ImplInhHelper_getTypes( cd::get(), BaseClass::getTypes() ); } 00289 virtual com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (com::sun::star::uno::RuntimeException) 00290 { return ImplHelper_getImplementationId( cd::get() ); } 00291 }; 00292 } 00293 00294 #endif 00295 00296 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */