UDK 3.2.7 C/C++ API Reference

cppuhelper/implbase2.hxx

Go to the documentation of this file.
00001 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
00002 /*
00003  * This file is part of the LibreOffice project.
00004  *
00005  * This Source Code Form is subject to the terms of the Mozilla Public
00006  * License, v. 2.0. If a copy of the MPL was not distributed with this
00007  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
00008  *
00009  * This file incorporates work covered by the following license notice:
00010  *
00011  *   Licensed to the Apache Software Foundation (ASF) under one or more
00012  *   contributor license agreements. See the NOTICE file distributed
00013  *   with this work for additional information regarding copyright
00014  *   ownership. The ASF licenses this file to you under the Apache
00015  *   License, Version 2.0 (the "License"); you may not use this file
00016  *   except in compliance with the License. You may obtain a copy of
00017  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
00018  */
00019 #ifndef _CPPUHELPER_IMPLBASE2_HXX_
00020 #define _CPPUHELPER_IMPLBASE2_HXX_
00021 
00022 #include <cppuhelper/implbase_ex.hxx>
00023 #include <rtl/instance.hxx>
00024 
00025 namespace cppu
00026 {
00028 
00029     struct class_data2
00030     {
00031         sal_Int16 m_nTypes;
00032         sal_Bool m_storedTypeRefs;
00033         sal_Bool m_storedId;
00034         sal_Int8 m_id[ 16 ];
00035         type_entry m_typeEntries[ 2 + 1 ];
00036     };
00037 
00038     template< typename Ifc1, typename Ifc2, typename Impl > struct ImplClassData2
00039     {
00040         class_data* operator ()()
00041         {
00042             static class_data2 s_cd =
00043             {
00044                 2 +1, sal_False, sal_False,
00045                 { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
00046                 {
00047                     { { Ifc1::static_type }, ((sal_IntPtr)(Ifc1 *) (Impl *) 16) - 16 },
00048                     { { Ifc2::static_type }, ((sal_IntPtr)(Ifc2 *) (Impl *) 16) - 16 },
00049                     { { com::sun::star::lang::XTypeProvider::static_type }, ((sal_IntPtr)(com::sun::star::lang::XTypeProvider *) (Impl *) 16) - 16 }
00050                 }
00051             };
00052             return reinterpret_cast< class_data * >(&s_cd);
00053         }
00054     };
00055 
00057 
00066     template< class Ifc1, class Ifc2 >
00067     class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE ImplHelper2
00068         : public com::sun::star::lang::XTypeProvider
00069         , public Ifc1, public Ifc2
00070     {
00071         struct cd : public rtl::StaticAggregate< class_data, ImplClassData2 < Ifc1, Ifc2, ImplHelper2<Ifc1, Ifc2> > > {};
00072     public:
00073         virtual com::sun::star::uno::Any SAL_CALL queryInterface( com::sun::star::uno::Type const & rType ) throw (com::sun::star::uno::RuntimeException)
00074             { return ImplHelper_query( rType, cd::get(), this ); }
00075         virtual com::sun::star::uno::Sequence< com::sun::star::uno::Type > SAL_CALL getTypes() throw (com::sun::star::uno::RuntimeException)
00076             { return ImplHelper_getTypes( cd::get() ); }
00077         virtual com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (com::sun::star::uno::RuntimeException)
00078             { return ImplHelper_getImplementationId( cd::get() ); }
00079 
00080 #if !defined _MSC_VER // public -> protected changes mangled names there
00081     protected:
00082 #endif
00083         ~ImplHelper2() throw () {}
00084     };
00093     template< class Ifc1, class Ifc2 >
00094     class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE SAL_DLLPUBLIC_EXPORT WeakImplHelper2
00095         : public OWeakObject
00096         , public com::sun::star::lang::XTypeProvider
00097         , public Ifc1, public Ifc2
00098     {
00099         struct cd : public rtl::StaticAggregate< class_data, ImplClassData2 < Ifc1, Ifc2, WeakImplHelper2<Ifc1, Ifc2> > > {};
00100     public:
00101         virtual com::sun::star::uno::Any SAL_CALL queryInterface( com::sun::star::uno::Type const & rType ) throw (com::sun::star::uno::RuntimeException)
00102             { return WeakImplHelper_query( rType, cd::get(), this, (OWeakObject *)this ); }
00103         virtual void SAL_CALL acquire() throw ()
00104             { OWeakObject::acquire(); }
00105         virtual void SAL_CALL release() throw ()
00106             { OWeakObject::release(); }
00107         virtual com::sun::star::uno::Sequence< com::sun::star::uno::Type > SAL_CALL getTypes() throw (com::sun::star::uno::RuntimeException)
00108             { return WeakImplHelper_getTypes( cd::get() ); }
00109         virtual com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (com::sun::star::uno::RuntimeException)
00110             { return ImplHelper_getImplementationId( cd::get() ); }
00111     };
00125     template< class Ifc1, class Ifc2 >
00126     class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE WeakAggImplHelper2
00127         : public OWeakAggObject
00128         , public com::sun::star::lang::XTypeProvider
00129         , public Ifc1, public Ifc2
00130     {
00131         struct cd : public rtl::StaticAggregate< class_data, ImplClassData2 < Ifc1, Ifc2, WeakAggImplHelper2<Ifc1, Ifc2> > > {};
00132     public:
00133         virtual com::sun::star::uno::Any SAL_CALL queryInterface( com::sun::star::uno::Type const & rType ) throw (com::sun::star::uno::RuntimeException)
00134             { return OWeakAggObject::queryInterface( rType ); }
00135         virtual com::sun::star::uno::Any SAL_CALL queryAggregation( com::sun::star::uno::Type const & rType ) throw (com::sun::star::uno::RuntimeException)
00136             { return WeakAggImplHelper_queryAgg( rType, cd::get(), this, (OWeakAggObject *)this ); }
00137         virtual void SAL_CALL acquire() throw ()
00138             { OWeakAggObject::acquire(); }
00139         virtual void SAL_CALL release() throw ()
00140             { OWeakAggObject::release(); }
00141         virtual com::sun::star::uno::Sequence< com::sun::star::uno::Type > SAL_CALL getTypes() throw (com::sun::star::uno::RuntimeException)
00142             { return WeakAggImplHelper_getTypes( cd::get() ); }
00143         virtual com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (com::sun::star::uno::RuntimeException)
00144             { return ImplHelper_getImplementationId( cd::get() ); }
00145     };
00162     template< class BaseClass, class Ifc1, class Ifc2 >
00163     class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE ImplInheritanceHelper2
00164         : public BaseClass
00165         , public Ifc1, public Ifc2
00166     {
00167         struct cd : public rtl::StaticAggregate< class_data, ImplClassData2 < Ifc1, Ifc2, ImplInheritanceHelper2<BaseClass, Ifc1, Ifc2> > > {};
00168     protected:
00169         template< typename T1 >
00170         explicit ImplInheritanceHelper2(T1 const & arg1): BaseClass(arg1) {}
00171         template< typename T1, typename T2 >
00172         ImplInheritanceHelper2(T1 const & arg1, T2 const & arg2):
00173             BaseClass(arg1, arg2) {}
00174         template< typename T1, typename T2, typename T3 >
00175         ImplInheritanceHelper2(
00176             T1 const & arg1, T2 const & arg2, T3 const & arg3):
00177             BaseClass(arg1, arg2, arg3) {}
00178         template< typename T1, typename T2, typename T3, typename T4 >
00179         ImplInheritanceHelper2(
00180             T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4):
00181             BaseClass(arg1, arg2, arg3, arg4) {}
00182         template<
00183             typename T1, typename T2, typename T3, typename T4, typename T5 >
00184         ImplInheritanceHelper2(
00185             T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4,
00186             T5 const & arg5):
00187             BaseClass(arg1, arg2, arg3, arg4, arg5) {}
00188         template<
00189             typename T1, typename T2, typename T3, typename T4, typename T5,
00190             typename T6 >
00191         ImplInheritanceHelper2(
00192             T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4,
00193             T5 const & arg5, T6 const & arg6):
00194             BaseClass(arg1, arg2, arg3, arg4, arg5, arg6) {}
00195     public:
00196         ImplInheritanceHelper2() {}
00197         virtual com::sun::star::uno::Any SAL_CALL queryInterface( com::sun::star::uno::Type const & rType ) throw (com::sun::star::uno::RuntimeException)
00198             {
00199                 com::sun::star::uno::Any aRet( ImplHelper_queryNoXInterface( rType, cd::get(), this ) );
00200                 if (aRet.hasValue())
00201                     return aRet;
00202                 return BaseClass::queryInterface( rType );
00203             }
00204         virtual void SAL_CALL acquire() throw ()
00205             { BaseClass::acquire(); }
00206         virtual void SAL_CALL release() throw ()
00207             { BaseClass::release(); }
00208         virtual com::sun::star::uno::Sequence< com::sun::star::uno::Type > SAL_CALL getTypes() throw (com::sun::star::uno::RuntimeException)
00209             { return ImplInhHelper_getTypes( cd::get(), BaseClass::getTypes() ); }
00210         virtual com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (com::sun::star::uno::RuntimeException)
00211             { return ImplHelper_getImplementationId( cd::get() ); }
00212     };
00230     template< class BaseClass, class Ifc1, class Ifc2 >
00231     class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE AggImplInheritanceHelper2
00232         : public BaseClass
00233         , public Ifc1, public Ifc2
00234     {
00235         struct cd : public rtl::StaticAggregate< class_data, ImplClassData2 < Ifc1, Ifc2, AggImplInheritanceHelper2<BaseClass, Ifc1, Ifc2> > > {};
00236     protected:
00237         template< typename T1 >
00238         explicit AggImplInheritanceHelper2(T1 const & arg1): BaseClass(arg1) {}
00239         template< typename T1, typename T2 >
00240         AggImplInheritanceHelper2(T1 const & arg1, T2 const & arg2):
00241             BaseClass(arg1, arg2) {}
00242         template< typename T1, typename T2, typename T3 >
00243         AggImplInheritanceHelper2(
00244             T1 const & arg1, T2 const & arg2, T3 const & arg3):
00245             BaseClass(arg1, arg2, arg3) {}
00246         template< typename T1, typename T2, typename T3, typename T4 >
00247         AggImplInheritanceHelper2(
00248             T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4):
00249             BaseClass(arg1, arg2, arg3, arg4) {}
00250         template<
00251             typename T1, typename T2, typename T3, typename T4, typename T5 >
00252         AggImplInheritanceHelper2(
00253             T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4,
00254             T5 const & arg5):
00255             BaseClass(arg1, arg2, arg3, arg4, arg5) {}
00256         template<
00257             typename T1, typename T2, typename T3, typename T4, typename T5,
00258             typename T6 >
00259         AggImplInheritanceHelper2(
00260             T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4,
00261             T5 const & arg5, T6 const & arg6):
00262             BaseClass(arg1, arg2, arg3, arg4, arg5, arg6) {}
00263     public:
00264         AggImplInheritanceHelper2() {}
00265         virtual com::sun::star::uno::Any SAL_CALL queryInterface( com::sun::star::uno::Type const & rType ) throw (com::sun::star::uno::RuntimeException)
00266             { return BaseClass::queryInterface( rType ); }
00267         virtual com::sun::star::uno::Any SAL_CALL queryAggregation( com::sun::star::uno::Type const & rType ) throw (com::sun::star::uno::RuntimeException)
00268             {
00269                 com::sun::star::uno::Any aRet( ImplHelper_queryNoXInterface( rType, cd::get(), this ) );
00270                 if (aRet.hasValue())
00271                     return aRet;
00272                 return BaseClass::queryAggregation( rType );
00273             }
00274         virtual void SAL_CALL acquire() throw ()
00275             { BaseClass::acquire(); }
00276         virtual void SAL_CALL release() throw ()
00277             { BaseClass::release(); }
00278         virtual com::sun::star::uno::Sequence< com::sun::star::uno::Type > SAL_CALL getTypes() throw (com::sun::star::uno::RuntimeException)
00279             { return ImplInhHelper_getTypes( cd::get(), BaseClass::getTypes() ); }
00280         virtual com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (com::sun::star::uno::RuntimeException)
00281             { return ImplHelper_getImplementationId( cd::get() ); }
00282     };
00283 }
00284 
00285 #endif
00286 
00287 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines