UDK 3.2.7 C/C++ API Reference

cppuhelper/implbase1.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_IMPLBASE1_HXX_
00020 #define _CPPUHELPER_IMPLBASE1_HXX_
00021 
00022 #include <cppuhelper/implbase_ex.hxx>
00023 #include <rtl/instance.hxx>
00024 #include <com/sun/star/uno/XComponentContext.hpp>
00025 
00026 namespace cppu
00027 {
00029 
00030     struct class_data1
00031     {
00032         sal_Int16 m_nTypes;
00033         sal_Bool m_storedTypeRefs;
00034         sal_Bool m_storedId;
00035         sal_Int8 m_id[ 16 ];
00036         type_entry m_typeEntries[ 1 + 1 ];
00037     };
00038 
00039     template< typename Ifc1, typename Impl > struct ImplClassData1
00040     {
00041         class_data* operator ()()
00042         {
00043             static class_data1 s_cd =
00044             {
00045                 1 +1, sal_False, sal_False,
00046                 { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
00047                 {
00048                     { { Ifc1::static_type }, ((sal_IntPtr)(Ifc1 *) (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 >
00067     class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE ImplHelper1
00068         : public com::sun::star::lang::XTypeProvider
00069         , public Ifc1
00070     {
00071         struct cd : public rtl::StaticAggregate< class_data, ImplClassData1 < Ifc1, ImplHelper1<Ifc1> > > {};
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         ~ImplHelper1() throw () {}
00084     };
00097     template< class Ifc1 >
00098     class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE SAL_DLLPUBLIC_EXPORT WeakImplHelper1
00099         : public OWeakObject
00100         , public com::sun::star::lang::XTypeProvider
00101         , public Ifc1
00102     {
00103         struct cd : public rtl::StaticAggregate< class_data, ImplClassData1< Ifc1, WeakImplHelper1< Ifc1 > > > {};
00104     public:
00105         virtual com::sun::star::uno::Any SAL_CALL queryInterface( com::sun::star::uno::Type const & rType ) throw (com::sun::star::uno::RuntimeException)
00106             { return WeakImplHelper_query( rType, cd::get(), this, (OWeakObject *)this ); }
00107         virtual void SAL_CALL acquire() throw ()
00108             { OWeakObject::acquire(); }
00109         virtual void SAL_CALL release() throw ()
00110             { OWeakObject::release(); }
00111         virtual com::sun::star::uno::Sequence< com::sun::star::uno::Type > SAL_CALL getTypes() throw (com::sun::star::uno::RuntimeException)
00112             { return WeakImplHelper_getTypes( cd::get() ); }
00113         virtual com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (com::sun::star::uno::RuntimeException)
00114             { return ImplHelper_getImplementationId( cd::get() ); }
00115     };
00129     template< class Ifc1 >
00130     class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE WeakAggImplHelper1
00131         : public OWeakAggObject
00132         , public com::sun::star::lang::XTypeProvider
00133         , public Ifc1
00134     {
00135         struct cd : public rtl::StaticAggregate< class_data, ImplClassData1< Ifc1, WeakAggImplHelper1< Ifc1 > > > {};
00136     public:
00137         virtual com::sun::star::uno::Any SAL_CALL queryInterface( com::sun::star::uno::Type const & rType ) throw (com::sun::star::uno::RuntimeException)
00138             { return OWeakAggObject::queryInterface( rType ); }
00139         virtual com::sun::star::uno::Any SAL_CALL queryAggregation( com::sun::star::uno::Type const & rType ) throw (com::sun::star::uno::RuntimeException)
00140             { return WeakAggImplHelper_queryAgg( rType, cd::get(), this, (OWeakAggObject *)this ); }
00141         virtual void SAL_CALL acquire() throw ()
00142             { OWeakAggObject::acquire(); }
00143         virtual void SAL_CALL release() throw ()
00144             { OWeakAggObject::release(); }
00145         virtual com::sun::star::uno::Sequence< com::sun::star::uno::Type > SAL_CALL getTypes() throw (com::sun::star::uno::RuntimeException)
00146             { return WeakAggImplHelper_getTypes( cd::get() ); }
00147         virtual com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (com::sun::star::uno::RuntimeException)
00148             { return ImplHelper_getImplementationId( cd::get() ); }
00149     };
00166     template< class BaseClass, class Ifc1 >
00167     class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE ImplInheritanceHelper1
00168         : public BaseClass
00169         , public Ifc1
00170     {
00171         struct cd : public rtl::StaticAggregate< class_data, ImplClassData1< Ifc1, ImplInheritanceHelper1< BaseClass, Ifc1 > > > {};
00172     protected:
00173 #if (defined __SUNPRO_CC && __SUNPRO_CC <= 0x550)
00174         // Hack, to get comphelper::service_decl to work for non-trivial impl classes
00175         ImplInheritanceHelper1( com::sun::star::uno::Sequence<com::sun::star::uno::Any> const& args,
00176                                 com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext> const& xContext ) : BaseClass(args,xContext) {}
00177 #endif
00178         template< typename T1 >
00179         explicit ImplInheritanceHelper1(T1 const & arg1): BaseClass(arg1) {}
00180         template< typename T1, typename T2 >
00181         ImplInheritanceHelper1(T1 const & arg1, T2 const & arg2):
00182             BaseClass(arg1, arg2) {}
00183         template< typename T1, typename T2, typename T3 >
00184         ImplInheritanceHelper1(
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         ImplInheritanceHelper1(
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         ImplInheritanceHelper1(
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         ImplInheritanceHelper1(
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         ImplInheritanceHelper1() {}
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 >
00240     class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE AggImplInheritanceHelper1
00241         : public BaseClass
00242         , public Ifc1
00243     {
00244         struct cd : public rtl::StaticAggregate< class_data, ImplClassData1< Ifc1, AggImplInheritanceHelper1< BaseClass, Ifc1 > > > {};
00245     protected:
00246         template< typename T1 >
00247         explicit AggImplInheritanceHelper1(T1 const & arg1): BaseClass(arg1) {}
00248         template< typename T1, typename T2 >
00249         AggImplInheritanceHelper1(T1 const & arg1, T2 const & arg2):
00250             BaseClass(arg1, arg2) {}
00251         template< typename T1, typename T2, typename T3 >
00252         AggImplInheritanceHelper1(
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         AggImplInheritanceHelper1(
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         AggImplInheritanceHelper1(
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         AggImplInheritanceHelper1(
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         AggImplInheritanceHelper1() {}
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: */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines