LCOV - code coverage report
Current view: top level - include/cppuhelper - implbase3.hxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 55 67 82.1 %
Date: 2015-06-13 12:38:46 Functions: 767 1353 56.7 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : #ifndef INCLUDED_CPPUHELPER_IMPLBASE3_HXX
      20             : #define INCLUDED_CPPUHELPER_IMPLBASE3_HXX
      21             : 
      22             : #include <cppuhelper/implbase_ex.hxx>
      23             : #include <rtl/instance.hxx>
      24             : 
      25             : namespace cppu
      26             : {
      27             :     /// @cond INTERNAL
      28             : 
      29             :     struct class_data3
      30             :     {
      31             :         sal_Int16 m_nTypes;
      32             :         sal_Bool m_storedTypeRefs;
      33             :         sal_Bool m_storedId;
      34             :         sal_Int8 m_id[ 16 ];
      35             :         type_entry m_typeEntries[ 3 + 1 ];
      36             :     };
      37             : 
      38             :     template< typename Ifc1, typename Ifc2, typename Ifc3, typename Impl > struct ImplClassData3
      39             :     {
      40        4788 :         class_data* operator ()()
      41             :         {
      42             :             static class_data3 s_cd =
      43             :             {
      44             :                 3 +1, sal_False, sal_False,
      45             :                 { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
      46             :                 {
      47             :                     CPPUHELPER_DETAIL_TYPEENTRY(Ifc1),
      48             :                     CPPUHELPER_DETAIL_TYPEENTRY(Ifc2),
      49             :                     CPPUHELPER_DETAIL_TYPEENTRY(Ifc3),
      50             :                     CPPUHELPER_DETAIL_TYPEENTRY(com::sun::star::lang::XTypeProvider)
      51             :                 }
      52             :             };
      53        4788 :             return reinterpret_cast< class_data * >(&s_cd);
      54             :         }
      55             :     };
      56             : 
      57             :     /// @endcond
      58             : 
      59             :     /** Implementation helper implementing interface com::sun::star::lang::XTypeProvider
      60             :         and method XInterface::queryInterface(), but no reference counting.
      61             : 
      62             :         @derive
      63             :         Inherit from this class giving your interface(s) to be implemented as template argument(s).
      64             :         Your sub class defines method implementations for these interface(s) including acquire()/
      65             :         release() and delegates incoming queryInterface() calls to this base class.
      66             :     */
      67             :     template< class Ifc1, class Ifc2, class Ifc3 >
      68        3340 :     class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE ImplHelper3
      69             :         : public com::sun::star::lang::XTypeProvider
      70             :         , public Ifc1, public Ifc2, public Ifc3
      71             :     {
      72             :         struct cd : public rtl::StaticAggregate< class_data, ImplClassData3 < Ifc1, Ifc2, Ifc3, ImplHelper3<Ifc1, Ifc2, Ifc3> > > {};
      73             :     public:
      74       50216 :         virtual com::sun::star::uno::Any SAL_CALL queryInterface( com::sun::star::uno::Type const & rType ) throw (com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE
      75       50216 :             { return ImplHelper_query( rType, cd::get(), this ); }
      76         210 :         virtual com::sun::star::uno::Sequence< com::sun::star::uno::Type > SAL_CALL getTypes() throw (com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE
      77         210 :             { return ImplHelper_getTypes( cd::get() ); }
      78           0 :         virtual com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE
      79           0 :             { return ImplHelper_getImplementationId( cd::get() ); }
      80             : 
      81             : #if !defined _MSC_VER // public -> protected changes mangled names there
      82             :     protected:
      83             : #endif
      84        3232 :         ~ImplHelper3() throw () {}
      85             :     };
      86             :     /** Implementation helper implementing interfaces com::sun::star::lang::XTypeProvider and
      87             :         com::sun::star::uno::XInterface which supports weak mechanism to be held weakly
      88             :         (supporting com::sun::star::uno::XWeak through ::cppu::OWeakObject).
      89             : 
      90             :         @derive
      91             :         Inherit from this class giving your interface(s) to be implemented as template argument(s).
      92             :         Your sub class defines method implementations for these interface(s).
      93             :     */
      94             :     template< class Ifc1, class Ifc2, class Ifc3 >
      95     3103145 :     class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE WeakImplHelper3
      96             :         : public OWeakObject
      97             :         , public com::sun::star::lang::XTypeProvider
      98             :         , public Ifc1, public Ifc2, public Ifc3
      99             :     {
     100             :         struct cd : public rtl::StaticAggregate< class_data, ImplClassData3 < Ifc1, Ifc2, Ifc3, WeakImplHelper3<Ifc1, Ifc2, Ifc3> > > {};
     101             :     public:
     102   201581022 :         virtual com::sun::star::uno::Any SAL_CALL queryInterface( com::sun::star::uno::Type const & rType ) throw (com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE
     103   201581022 :             { return WeakImplHelper_query( rType, cd::get(), this, static_cast<OWeakObject *>(this) ); }
     104  1092535593 :         virtual void SAL_CALL acquire() throw () SAL_OVERRIDE
     105  1092535593 :             { OWeakObject::acquire(); }
     106  1092526485 :         virtual void SAL_CALL release() throw () SAL_OVERRIDE
     107  1092526485 :             { OWeakObject::release(); }
     108           6 :         virtual com::sun::star::uno::Sequence< com::sun::star::uno::Type > SAL_CALL getTypes() throw (com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE
     109           6 :             { return WeakImplHelper_getTypes( cd::get() ); }
     110           0 :         virtual com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE
     111           0 :             { return ImplHelper_getImplementationId( cd::get() ); }
     112             :     };
     113             :     /** Implementation helper implementing interfaces com::sun::star::lang::XTypeProvider and
     114             :         com::sun::star::uno::XInterface which supports weak mechanism to be held weakly
     115             :         (supporting com::sun::star::uno::XWeak through ::cppu::OWeakAggObject).
     116             :         In addition, it supports also aggregation meaning object of this class can be aggregated
     117             :         (com::sun::star::uno::XAggregation through ::cppu::OWeakAggObject).
     118             :         If a delegator is set (this object is aggregated), then incoming queryInterface()
     119             :         calls are delegated to the delegator object. If the delegator does not support the
     120             :         demanded interface, it calls queryAggregation() on its aggregated objects.
     121             : 
     122             :         @derive
     123             :         Inherit from this class giving your interface(s) to be implemented as template argument(s).
     124             :         Your sub class defines method implementations for these interface(s).
     125             :     */
     126             :     template< class Ifc1, class Ifc2, class Ifc3 >
     127        1923 :     class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE WeakAggImplHelper3
     128             :         : public OWeakAggObject
     129             :         , public com::sun::star::lang::XTypeProvider
     130             :         , public Ifc1, public Ifc2, public Ifc3
     131             :     {
     132             :         struct cd : public rtl::StaticAggregate< class_data, ImplClassData3 < Ifc1, Ifc2, Ifc3, WeakAggImplHelper3<Ifc1, Ifc2, Ifc3> > > {};
     133             :     public:
     134        4258 :         virtual com::sun::star::uno::Any SAL_CALL queryInterface( com::sun::star::uno::Type const & rType ) throw (com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE
     135        4258 :             { return OWeakAggObject::queryInterface( rType ); }
     136        4849 :         virtual com::sun::star::uno::Any SAL_CALL queryAggregation( com::sun::star::uno::Type const & rType ) throw (com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE
     137        4849 :             { return WeakAggImplHelper_queryAgg( rType, cd::get(), this, static_cast<OWeakAggObject *>(this) ); }
     138       18511 :         virtual void SAL_CALL acquire() throw () SAL_OVERRIDE
     139       18511 :             { OWeakAggObject::acquire(); }
     140       18048 :         virtual void SAL_CALL release() throw () SAL_OVERRIDE
     141       18048 :             { OWeakAggObject::release(); }
     142           4 :         virtual com::sun::star::uno::Sequence< com::sun::star::uno::Type > SAL_CALL getTypes() throw (com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE
     143           4 :             { return WeakAggImplHelper_getTypes( cd::get() ); }
     144           0 :         virtual com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE
     145           0 :             { return ImplHelper_getImplementationId( cd::get() ); }
     146             :     };
     147             :     /** Implementation helper implementing interfaces com::sun::star::lang::XTypeProvider and
     148             :         com::sun::star::uno::XInterface inherting from a BaseClass.
     149             :         All acquire() and release() calls are delegated to the BaseClass. Upon queryInterface(),
     150             :         if a demanded interface is not supported by this class directly, the request is
     151             :         delegated to the BaseClass.
     152             : 
     153             :         @attention
     154             :         The BaseClass has to be complete in a sense, that com::sun::star::uno::XInterface
     155             :         and com::sun::star::lang::XTypeProvider are implemented properly.  The
     156             :         BaseClass must have at least one ctor that can be called with six or
     157             :         fewer arguments, of which none is of non-const reference type.
     158             :         also has to have a default ctor.
     159             : 
     160             :         @derive
     161             :         Inherit from this class giving your additional interface(s) to be implemented as
     162             :         template argument(s). Your sub class defines method implementations for these interface(s).
     163             :     */
     164             :     template< class BaseClass, class Ifc1, class Ifc2, class Ifc3 >
     165        1309 :     class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE ImplInheritanceHelper3
     166             :         : public BaseClass
     167             :         , public Ifc1, public Ifc2, public Ifc3
     168             :     {
     169             :         struct cd : public rtl::StaticAggregate< class_data, ImplClassData3 < Ifc1, Ifc2, Ifc3, ImplInheritanceHelper3<BaseClass, Ifc1, Ifc2, Ifc3> > > {};
     170             :     protected:
     171             :         template< typename T1 >
     172           3 :         explicit ImplInheritanceHelper3(T1 const & arg1): BaseClass(arg1) {}
     173             :         template< typename T1, typename T2 >
     174             :         ImplInheritanceHelper3(T1 const & arg1, T2 const & arg2):
     175             :             BaseClass(arg1, arg2) {}
     176             :         template< typename T1, typename T2, typename T3 >
     177             :         ImplInheritanceHelper3(
     178             :             T1 const & arg1, T2 const & arg2, T3 const & arg3):
     179             :             BaseClass(arg1, arg2, arg3) {}
     180             :         template< typename T1, typename T2, typename T3, typename T4 >
     181             :         ImplInheritanceHelper3(
     182             :             T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4):
     183             :             BaseClass(arg1, arg2, arg3, arg4) {}
     184             :         template<
     185             :             typename T1, typename T2, typename T3, typename T4, typename T5 >
     186             :         ImplInheritanceHelper3(
     187             :             T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4,
     188             :             T5 const & arg5):
     189             :             BaseClass(arg1, arg2, arg3, arg4, arg5) {}
     190             :         template<
     191             :             typename T1, typename T2, typename T3, typename T4, typename T5,
     192             :             typename T6 >
     193             :         ImplInheritanceHelper3(
     194             :             T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4,
     195             :             T5 const & arg5, T6 const & arg6):
     196             :             BaseClass(arg1, arg2, arg3, arg4, arg5, arg6) {}
     197             :     public:
     198        1307 :         ImplInheritanceHelper3() {}
     199       16273 :         virtual com::sun::star::uno::Any SAL_CALL queryInterface( com::sun::star::uno::Type const & rType ) throw (com::sun::star::uno::RuntimeException) SAL_OVERRIDE
     200             :             {
     201       16273 :                 com::sun::star::uno::Any aRet( ImplHelper_queryNoXInterface( rType, cd::get(), this ) );
     202       16273 :                 if (aRet.hasValue())
     203        2078 :                     return aRet;
     204       14195 :                 return BaseClass::queryInterface( rType );
     205             :             }
     206       89877 :         virtual void SAL_CALL acquire() throw () SAL_OVERRIDE
     207       89877 :             { BaseClass::acquire(); }
     208       89874 :         virtual void SAL_CALL release() throw () SAL_OVERRIDE
     209       89874 :             { BaseClass::release(); }
     210           0 :         virtual com::sun::star::uno::Sequence< com::sun::star::uno::Type > SAL_CALL getTypes() throw (com::sun::star::uno::RuntimeException) SAL_OVERRIDE
     211           0 :             { return ImplInhHelper_getTypes( cd::get(), BaseClass::getTypes() ); }
     212           0 :         virtual com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (com::sun::star::uno::RuntimeException) SAL_OVERRIDE
     213           0 :             { return ImplHelper_getImplementationId( cd::get() ); }
     214             :     };
     215             :     /** Implementation helper implementing interfaces com::sun::star::lang::XTypeProvider and
     216             :         com::sun::star::uno::XInterface inherting from a BaseClass.
     217             :         All acquire(),  release() and queryInterface() calls are delegated to the BaseClass.
     218             :         Upon queryAggregation(), if a demanded interface is not supported by this class directly,
     219             :         the request is delegated to the BaseClass.
     220             : 
     221             :         @attention
     222             :         The BaseClass has to be complete in a sense, that com::sun::star::uno::XInterface,
     223             :         com::sun::star::uno::XAggregation and com::sun::star::lang::XTypeProvider
     224             :         are implemented properly.  The BaseClass must have at least one ctor
     225             :         that can be called with six or fewer arguments, of which none is of
     226             :         non-const reference type.
     227             : 
     228             :         @derive
     229             :         Inherit from this class giving your additional interface(s) to be implemented as
     230             :         template argument(s). Your sub class defines method implementations for these interface(s).
     231             :     */
     232             :     template< class BaseClass, class Ifc1, class Ifc2, class Ifc3 >
     233           3 :     class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE AggImplInheritanceHelper3
     234             :         : public BaseClass
     235             :         , public Ifc1, public Ifc2, public Ifc3
     236             :     {
     237             :         struct cd : public rtl::StaticAggregate< class_data, ImplClassData3 < Ifc1, Ifc2, Ifc3, AggImplInheritanceHelper3<BaseClass, Ifc1, Ifc2, Ifc3> > > {};
     238             :     protected:
     239             :         template< typename T1 >
     240             :         explicit AggImplInheritanceHelper3(T1 const & arg1): BaseClass(arg1) {}
     241             :         template< typename T1, typename T2 >
     242             :         AggImplInheritanceHelper3(T1 const & arg1, T2 const & arg2):
     243             :             BaseClass(arg1, arg2) {}
     244             :         template< typename T1, typename T2, typename T3 >
     245             :         AggImplInheritanceHelper3(
     246             :             T1 const & arg1, T2 const & arg2, T3 const & arg3):
     247             :             BaseClass(arg1, arg2, arg3) {}
     248             :         template< typename T1, typename T2, typename T3, typename T4 >
     249             :         AggImplInheritanceHelper3(
     250             :             T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4):
     251             :             BaseClass(arg1, arg2, arg3, arg4) {}
     252             :         template<
     253             :             typename T1, typename T2, typename T3, typename T4, typename T5 >
     254             :         AggImplInheritanceHelper3(
     255             :             T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4,
     256             :             T5 const & arg5):
     257             :             BaseClass(arg1, arg2, arg3, arg4, arg5) {}
     258             :         template<
     259             :             typename T1, typename T2, typename T3, typename T4, typename T5,
     260             :             typename T6 >
     261             :         AggImplInheritanceHelper3(
     262             :             T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4,
     263             :             T5 const & arg5, T6 const & arg6):
     264             :             BaseClass(arg1, arg2, arg3, arg4, arg5, arg6) {}
     265             :     public:
     266          10 :         AggImplInheritanceHelper3() {}
     267         470 :         virtual com::sun::star::uno::Any SAL_CALL queryInterface( com::sun::star::uno::Type const & rType ) throw (com::sun::star::uno::RuntimeException) SAL_OVERRIDE
     268         470 :             { return BaseClass::queryInterface( rType ); }
     269         146 :         virtual com::sun::star::uno::Any SAL_CALL queryAggregation( com::sun::star::uno::Type const & rType ) throw (com::sun::star::uno::RuntimeException) SAL_OVERRIDE
     270             :             {
     271         146 :                 com::sun::star::uno::Any aRet( ImplHelper_queryNoXInterface( rType, cd::get(), this ) );
     272         146 :                 if (aRet.hasValue())
     273          10 :                     return aRet;
     274         136 :                 return BaseClass::queryAggregation( rType );
     275             :             }
     276        1760 :         virtual void SAL_CALL acquire() throw () SAL_OVERRIDE
     277        1760 :             { BaseClass::acquire(); }
     278        1726 :         virtual void SAL_CALL release() throw () SAL_OVERRIDE
     279        1726 :             { BaseClass::release(); }
     280          36 :         virtual com::sun::star::uno::Sequence< com::sun::star::uno::Type > SAL_CALL getTypes() throw (com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE
     281          36 :             { return ImplInhHelper_getTypes( cd::get(), BaseClass::getTypes() ); }
     282           0 :         virtual com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE
     283           0 :             { return ImplHelper_getImplementationId( cd::get() ); }
     284             :     };
     285             : }
     286             : 
     287             : #endif
     288             : 
     289             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11