UDK 3.2.7 C/C++ API Reference
cppuhelper/implbase4.hxx
Go to the documentation of this file.
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_IMPLBASE4_HXX_
00029 #define _CPPUHELPER_IMPLBASE4_HXX_
00030 
00031 #include <cppuhelper/implbase_ex.hxx>
00032 #include <rtl/instance.hxx>
00033 
00034 namespace cppu
00035 {
00037 
00038     struct class_data4
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[ 4 + 1 ];
00045     };
00046 
00047     template< typename Ifc1, typename Ifc2, typename Ifc3, typename Ifc4, typename Impl >
00048         struct ImplClassData4
00049     {
00050         class_data* operator ()()
00051         {
00052             static class_data4 s_cd =
00053             {
00054                 4 +1, sal_False, sal_False,
00055                 { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
00056                 {
00057                     { { Ifc1::static_type }, ((sal_IntPtr)(Ifc1 *) (Impl *) 16) - 16 },
00058                     { { Ifc2::static_type }, ((sal_IntPtr)(Ifc2 *) (Impl *) 16) - 16 },
00059                     { { Ifc3::static_type }, ((sal_IntPtr)(Ifc3 *) (Impl *) 16) - 16 },
00060                     { { Ifc4::static_type }, ((sal_IntPtr)(Ifc4 *) (Impl *) 16) - 16 },
00061                     { { com::sun::star::lang::XTypeProvider::static_type }, ((sal_IntPtr)(com::sun::star::lang::XTypeProvider *) (Impl *) 16) - 16 }
00062                 }
00063             };
00064             return reinterpret_cast< class_data * >(&s_cd);
00065         }
00066     };
00067 
00069 
00078     template< class Ifc1, class Ifc2, class Ifc3, class Ifc4 >
00079     class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE ImplHelper4
00080         : public com::sun::star::lang::XTypeProvider
00081         , public Ifc1, public Ifc2, public Ifc3, public Ifc4
00082     {
00083         struct cd : public rtl::StaticAggregate< class_data, ImplClassData4 < Ifc1, Ifc2, Ifc3, Ifc4, ImplHelper4<Ifc1, Ifc2, Ifc3, Ifc4> > > {};
00084     public:
00085         virtual com::sun::star::uno::Any SAL_CALL queryInterface( com::sun::star::uno::Type const & rType ) throw (com::sun::star::uno::RuntimeException)
00086             { return ImplHelper_query( rType, cd::get(), this ); }
00087         virtual com::sun::star::uno::Sequence< com::sun::star::uno::Type > SAL_CALL getTypes() throw (com::sun::star::uno::RuntimeException)
00088             { return ImplHelper_getTypes( cd::get() ); }
00089         virtual com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (com::sun::star::uno::RuntimeException)
00090             { return ImplHelper_getImplementationId( cd::get() ); }
00091 
00092 #if !defined _MSC_VER // public -> protected changes mangled names there
00093     protected:
00094 #endif
00095         ~ImplHelper4() throw () {}
00096     };
00105     template< class Ifc1, class Ifc2, class Ifc3, class Ifc4 >
00106     class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE WeakImplHelper4
00107         : public OWeakObject
00108         , public com::sun::star::lang::XTypeProvider
00109         , public Ifc1, public Ifc2, public Ifc3, public Ifc4
00110     {
00111         struct cd : public rtl::StaticAggregate< class_data, ImplClassData4 < Ifc1, Ifc2, Ifc3, Ifc4, WeakImplHelper4<Ifc1, Ifc2, Ifc3, Ifc4> > > {};
00112     public:
00113         virtual com::sun::star::uno::Any SAL_CALL queryInterface( com::sun::star::uno::Type const & rType ) throw (com::sun::star::uno::RuntimeException)
00114             { return WeakImplHelper_query( rType, cd::get(), this, (OWeakObject *)this ); }
00115         virtual void SAL_CALL acquire() throw ()
00116             { OWeakObject::acquire(); }
00117         virtual void SAL_CALL release() throw ()
00118             { OWeakObject::release(); }
00119         virtual com::sun::star::uno::Sequence< com::sun::star::uno::Type > SAL_CALL getTypes() throw (com::sun::star::uno::RuntimeException)
00120             { return WeakImplHelper_getTypes( cd::get() ); }
00121         virtual com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (com::sun::star::uno::RuntimeException)
00122             { return ImplHelper_getImplementationId( cd::get() ); }
00123     };
00137     template< class Ifc1, class Ifc2, class Ifc3, class Ifc4 >
00138     class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE WeakAggImplHelper4
00139         : public OWeakAggObject
00140         , public com::sun::star::lang::XTypeProvider
00141         , public Ifc1, public Ifc2, public Ifc3, public Ifc4
00142     {
00143         struct cd : public rtl::StaticAggregate< class_data, ImplClassData4 < Ifc1, Ifc2, Ifc3, Ifc4, WeakAggImplHelper4<Ifc1, Ifc2, Ifc3, Ifc4> > > {};
00144     public:
00145         virtual com::sun::star::uno::Any SAL_CALL queryInterface( com::sun::star::uno::Type const & rType ) throw (com::sun::star::uno::RuntimeException)
00146             { return OWeakAggObject::queryInterface( rType ); }
00147         virtual com::sun::star::uno::Any SAL_CALL queryAggregation( com::sun::star::uno::Type const & rType ) throw (com::sun::star::uno::RuntimeException)
00148             { return WeakAggImplHelper_queryAgg( rType, cd::get(), this, (OWeakAggObject *)this ); }
00149         virtual void SAL_CALL acquire() throw ()
00150             { OWeakAggObject::acquire(); }
00151         virtual void SAL_CALL release() throw ()
00152             { OWeakAggObject::release(); }
00153         virtual com::sun::star::uno::Sequence< com::sun::star::uno::Type > SAL_CALL getTypes() throw (com::sun::star::uno::RuntimeException)
00154             { return WeakAggImplHelper_getTypes( cd::get() ); }
00155         virtual com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (com::sun::star::uno::RuntimeException)
00156             { return ImplHelper_getImplementationId( cd::get() ); }
00157     };
00174     template< class BaseClass, class Ifc1, class Ifc2, class Ifc3, class Ifc4 >
00175     class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE ImplInheritanceHelper4
00176         : public BaseClass
00177         , public Ifc1, public Ifc2, public Ifc3, public Ifc4
00178     {
00179         struct cd : public rtl::StaticAggregate< class_data, ImplClassData4 < Ifc1, Ifc2, Ifc3, Ifc4, ImplInheritanceHelper4<BaseClass, Ifc1, Ifc2, Ifc3, Ifc4> > > {};
00180     protected:
00181         template< typename T1 >
00182         explicit ImplInheritanceHelper4(T1 const & arg1): BaseClass(arg1) {}
00183         template< typename T1, typename T2 >
00184         ImplInheritanceHelper4(T1 const & arg1, T2 const & arg2):
00185             BaseClass(arg1, arg2) {}
00186         template< typename T1, typename T2, typename T3 >
00187         ImplInheritanceHelper4(
00188             T1 const & arg1, T2 const & arg2, T3 const & arg3):
00189             BaseClass(arg1, arg2, arg3) {}
00190         template< typename T1, typename T2, typename T3, typename T4 >
00191         ImplInheritanceHelper4(
00192             T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4):
00193             BaseClass(arg1, arg2, arg3, arg4) {}
00194         template<
00195             typename T1, typename T2, typename T3, typename T4, typename T5 >
00196         ImplInheritanceHelper4(
00197             T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4,
00198             T5 const & arg5):
00199             BaseClass(arg1, arg2, arg3, arg4, arg5) {}
00200         template<
00201             typename T1, typename T2, typename T3, typename T4, typename T5,
00202             typename T6 >
00203         ImplInheritanceHelper4(
00204             T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4,
00205             T5 const & arg5, T6 const & arg6):
00206             BaseClass(arg1, arg2, arg3, arg4, arg5, arg6) {}
00207     public:
00208         ImplInheritanceHelper4() {}
00209         virtual com::sun::star::uno::Any SAL_CALL queryInterface( com::sun::star::uno::Type const & rType ) throw (com::sun::star::uno::RuntimeException)
00210             {
00211                 com::sun::star::uno::Any aRet( ImplHelper_queryNoXInterface( rType, cd::get(), this ) );
00212                 if (aRet.hasValue())
00213                     return aRet;
00214                 return BaseClass::queryInterface( rType );
00215             }
00216         virtual void SAL_CALL acquire() throw ()
00217             { BaseClass::acquire(); }
00218         virtual void SAL_CALL release() throw ()
00219             { BaseClass::release(); }
00220         virtual com::sun::star::uno::Sequence< com::sun::star::uno::Type > SAL_CALL getTypes() throw (com::sun::star::uno::RuntimeException)
00221             { return ImplInhHelper_getTypes( cd::get(), BaseClass::getTypes() ); }
00222         virtual com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (com::sun::star::uno::RuntimeException)
00223             { return ImplHelper_getImplementationId( cd::get() ); }
00224     };
00242     template< class BaseClass, class Ifc1, class Ifc2, class Ifc3, class Ifc4 >
00243     class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE AggImplInheritanceHelper4
00244         : public BaseClass
00245         , public Ifc1, public Ifc2, public Ifc3, public Ifc4
00246     {
00247         struct cd : public rtl::StaticAggregate< class_data, ImplClassData4 < Ifc1, Ifc2, Ifc3, Ifc4, AggImplInheritanceHelper4<BaseClass, Ifc1, Ifc2, Ifc3, Ifc4> > > {};
00248     protected:
00249         template< typename T1 >
00250         explicit AggImplInheritanceHelper4(T1 const & arg1): BaseClass(arg1) {}
00251         template< typename T1, typename T2 >
00252         AggImplInheritanceHelper4(T1 const & arg1, T2 const & arg2):
00253             BaseClass(arg1, arg2) {}
00254         template< typename T1, typename T2, typename T3 >
00255         AggImplInheritanceHelper4(
00256             T1 const & arg1, T2 const & arg2, T3 const & arg3):
00257             BaseClass(arg1, arg2, arg3) {}
00258         template< typename T1, typename T2, typename T3, typename T4 >
00259         AggImplInheritanceHelper4(
00260             T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4):
00261             BaseClass(arg1, arg2, arg3, arg4) {}
00262         template<
00263             typename T1, typename T2, typename T3, typename T4, typename T5 >
00264         AggImplInheritanceHelper4(
00265             T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4,
00266             T5 const & arg5):
00267             BaseClass(arg1, arg2, arg3, arg4, arg5) {}
00268         template<
00269             typename T1, typename T2, typename T3, typename T4, typename T5,
00270             typename T6 >
00271         AggImplInheritanceHelper4(
00272             T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4,
00273             T5 const & arg5, T6 const & arg6):
00274             BaseClass(arg1, arg2, arg3, arg4, arg5, arg6) {}
00275     public:
00276         AggImplInheritanceHelper4() {}
00277         virtual com::sun::star::uno::Any SAL_CALL queryInterface( com::sun::star::uno::Type const & rType ) throw (com::sun::star::uno::RuntimeException)
00278             { return BaseClass::queryInterface( rType ); }
00279         virtual com::sun::star::uno::Any SAL_CALL queryAggregation( com::sun::star::uno::Type const & rType ) throw (com::sun::star::uno::RuntimeException)
00280             {
00281                 com::sun::star::uno::Any aRet( ImplHelper_queryNoXInterface( rType, cd::get(), this ) );
00282                 if (aRet.hasValue())
00283                     return aRet;
00284                 return BaseClass::queryAggregation( rType );
00285             }
00286         virtual void SAL_CALL acquire() throw ()
00287             { BaseClass::acquire(); }
00288         virtual void SAL_CALL release() throw ()
00289             { BaseClass::release(); }
00290         virtual com::sun::star::uno::Sequence< com::sun::star::uno::Type > SAL_CALL getTypes() throw (com::sun::star::uno::RuntimeException)
00291             { return ImplInhHelper_getTypes( cd::get(), BaseClass::getTypes() ); }
00292         virtual com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (com::sun::star::uno::RuntimeException)
00293             { return ImplHelper_getImplementationId( cd::get() ); }
00294     };
00295 }
00296 
00297 #endif
00298 
00299 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines