LCOV - code coverage report
Current view: top level - include/cppuhelper - implbase1.hxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 68 78 87.2 %
Date: 2015-06-13 12:38:46 Functions: 1763 4800 36.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_IMPLBASE1_HXX
      20             : #define INCLUDED_CPPUHELPER_IMPLBASE1_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_data1
      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[ 1 + 1 ];
      36             :     };
      37             : 
      38             :     template< typename Ifc1, typename Impl > struct ImplClassData1
      39             :     {
      40       12456 :         class_data* operator ()()
      41             :         {
      42             :             static class_data1 s_cd =
      43             :             {
      44             :                 1 +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(com::sun::star::lang::XTypeProvider)
      49             :                 }
      50             :             };
      51       12456 :             return reinterpret_cast< class_data * >(&s_cd);
      52             :         }
      53             :     };
      54             : 
      55             :     /// @endcond
      56             : 
      57             :     /** Implementation helper implementing interface com::sun::star::lang::XTypeProvider
      58             :         and method XInterface::queryInterface(), but no reference counting.
      59             : 
      60             :         @derive
      61             :         Inherit from this class giving your interface(s) to be implemented as template argument(s).
      62             :         Your sub class defines method implementations for these interface(s) including acquire()/
      63             :         release() and delegates incoming queryInterface() calls to this base class.
      64             :     */
      65             :     template< class Ifc1 >
      66      225050 :     class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE ImplHelper1
      67             :         : public com::sun::star::lang::XTypeProvider
      68             :         , public Ifc1
      69             :     {
      70             :         struct cd : public rtl::StaticAggregate< class_data, ImplClassData1 < Ifc1, ImplHelper1<Ifc1> > > {};
      71             :     public:
      72     1392224 :         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
      73     1392224 :             { return ImplHelper_query( rType, cd::get(), this ); }
      74         184 :         virtual com::sun::star::uno::Sequence< com::sun::star::uno::Type > SAL_CALL getTypes() throw (com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE
      75         184 :             { return ImplHelper_getTypes( cd::get() ); }
      76           0 :         virtual com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE
      77           0 :             { return ImplHelper_getImplementationId( cd::get() ); }
      78             : 
      79             : #if !defined _MSC_VER // public -> protected changes mangled names there
      80             :     protected:
      81             : #endif
      82      221605 :         ~ImplHelper1() throw () {}
      83             :     };
      84             :     /** Implementation helper implementing interfaces com::sun::star::lang::XTypeProvider and
      85             :         com::sun::star::uno::XInterface which supports weak mechanism to be held weakly
      86             :         (supporting com::sun::star::uno::XWeak through ::cppu::OWeakObject).
      87             : 
      88             :         @derive
      89             :         Inherit from this class giving your interface(s) to be implemented as template argument(s).
      90             :         Your sub class defines method implementations for these interface(s).
      91             : 
      92             :         These classes are used when you implement your UNO component.
      93             :         WeakImplHelper1 till WeakImplHelper12 can be used when you want
      94             :         to implement 1 till 12 interfaces in your component.
      95             :     */
      96             :     template< class Ifc1 >
      97    12158615 :     class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE SAL_DLLPUBLIC_EXPORT WeakImplHelper1
      98             :         : public OWeakObject
      99             :         , public com::sun::star::lang::XTypeProvider
     100             :         , public Ifc1
     101             :     {
     102             :         struct cd : public rtl::StaticAggregate< class_data, ImplClassData1< Ifc1, WeakImplHelper1< Ifc1 > > > {};
     103             :     public:
     104     1583146 :         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
     105     1583146 :             { return WeakImplHelper_query( rType, cd::get(), this, static_cast<OWeakObject *>(this) ); }
     106    76083480 :         virtual void SAL_CALL acquire() throw () SAL_OVERRIDE
     107    76083480 :             { OWeakObject::acquire(); }
     108    76049570 :         virtual void SAL_CALL release() throw () SAL_OVERRIDE
     109    76049570 :             { OWeakObject::release(); }
     110        4308 :         virtual com::sun::star::uno::Sequence< com::sun::star::uno::Type > SAL_CALL getTypes() throw (com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE
     111        4308 :             { return WeakImplHelper_getTypes( cd::get() ); }
     112           0 :         virtual com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE
     113           0 :             { return ImplHelper_getImplementationId( cd::get() ); }
     114             :     };
     115             :     /** Implementation helper implementing interfaces com::sun::star::lang::XTypeProvider and
     116             :         com::sun::star::uno::XInterface which supports weak mechanism to be held weakly
     117             :         (supporting com::sun::star::uno::XWeak through ::cppu::OWeakAggObject).
     118             :         In addition, it supports also aggregation meaning object of this class can be aggregated
     119             :         (com::sun::star::uno::XAggregation through ::cppu::OWeakAggObject).
     120             :         If a delegator is set (this object is aggregated), then incoming queryInterface()
     121             :         calls are delegated to the delegator object. If the delegator does not support the
     122             :         demanded interface, it calls queryAggregation() on its aggregated objects.
     123             : 
     124             :         @derive
     125             :         Inherit from this class giving your interface(s) to be implemented as template argument(s).
     126             :         Your sub class defines method implementations for these interface(s).
     127             :     */
     128             :     template< class Ifc1 >
     129      189966 :     class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE WeakAggImplHelper1
     130             :         : public OWeakAggObject
     131             :         , public com::sun::star::lang::XTypeProvider
     132             :         , public Ifc1
     133             :     {
     134             :         struct cd : public rtl::StaticAggregate< class_data, ImplClassData1< Ifc1, WeakAggImplHelper1< Ifc1 > > > {};
     135             :     public:
     136        1331 :         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
     137        1331 :             { return OWeakAggObject::queryInterface( rType ); }
     138        1245 :         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
     139        1245 :             { return WeakAggImplHelper_queryAgg( rType, cd::get(), this, static_cast<OWeakAggObject *>(this) ); }
     140       13622 :         virtual void SAL_CALL acquire() throw () SAL_OVERRIDE
     141       13622 :             { OWeakAggObject::acquire(); }
     142       13598 :         virtual void SAL_CALL release() throw () SAL_OVERRIDE
     143       13598 :             { OWeakAggObject::release(); }
     144           0 :         virtual com::sun::star::uno::Sequence< com::sun::star::uno::Type > SAL_CALL getTypes() throw (com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE
     145           0 :             { return WeakAggImplHelper_getTypes( cd::get() ); }
     146           0 :         virtual com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE
     147           0 :             { return ImplHelper_getImplementationId( cd::get() ); }
     148             :     };
     149             :     /** Implementation helper implementing interfaces com::sun::star::lang::XTypeProvider and
     150             :         com::sun::star::uno::XInterface inherting from a BaseClass.
     151             :         All acquire() and release() calls are delegated to the BaseClass. Upon queryInterface(),
     152             :         if a demanded interface is not supported by this class directly, the request is
     153             :         delegated to the BaseClass.
     154             : 
     155             :         @attention
     156             :         The BaseClass has to be complete in a sense, that com::sun::star::uno::XInterface
     157             :         and com::sun::star::lang::XTypeProvider are implemented properly.  The
     158             :         BaseClass must have at least one ctor that can be called with six or
     159             :         fewer arguments, of which none is of non-const reference type.
     160             : 
     161             :         @derive
     162             :         Inherit from this class giving your additional interface(s) to be implemented as
     163             :         template argument(s). Your sub class defines method implementations for these interface(s).
     164             :     */
     165             :     template< class BaseClass, class Ifc1 >
     166     2787916 :     class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE ImplInheritanceHelper1
     167             :         : public BaseClass
     168             :         , public Ifc1
     169             :     {
     170             :         struct cd : public rtl::StaticAggregate< class_data, ImplClassData1< Ifc1, ImplInheritanceHelper1< BaseClass, Ifc1 > > > {};
     171             :     protected:
     172             :         template< typename T1 >
     173      591648 :         explicit ImplInheritanceHelper1(T1 const & arg1): BaseClass(arg1) {}
     174             :         template< typename T1, typename T2 >
     175        3625 :         ImplInheritanceHelper1(T1 const & arg1, T2 const & arg2):
     176        3625 :             BaseClass(arg1, arg2) {}
     177             :         template< typename T1, typename T2, typename T3 >
     178          64 :         ImplInheritanceHelper1(
     179             :             T1 const & arg1, T2 const & arg2, T3 const & arg3):
     180          64 :             BaseClass(arg1, arg2, arg3) {}
     181             :         template< typename T1, typename T2, typename T3, typename T4 >
     182     1390006 :         ImplInheritanceHelper1(
     183             :             T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4):
     184     1390006 :             BaseClass(arg1, arg2, arg3, arg4) {}
     185             :         template<
     186             :             typename T1, typename T2, typename T3, typename T4, typename T5 >
     187          12 :         ImplInheritanceHelper1(
     188             :             T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4,
     189             :             T5 const & arg5):
     190          12 :             BaseClass(arg1, arg2, arg3, arg4, arg5) {}
     191             :         template<
     192             :             typename T1, typename T2, typename T3, typename T4, typename T5,
     193             :             typename T6 >
     194           2 :         ImplInheritanceHelper1(
     195             :             T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4,
     196             :             T5 const & arg5, T6 const & arg6):
     197           2 :             BaseClass(arg1, arg2, arg3, arg4, arg5, arg6) {}
     198             :     public:
     199      802199 :         ImplInheritanceHelper1() {}
     200     9534697 :         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
     201             :             {
     202     9534697 :                 com::sun::star::uno::Any aRet( ImplHelper_queryNoXInterface( rType, cd::get(), this ) );
     203     9534697 :                 if (aRet.hasValue())
     204     2695703 :                     return aRet;
     205     6838994 :                 return BaseClass::queryInterface( rType );
     206             :             }
     207    37421566 :         virtual void SAL_CALL acquire() throw () SAL_OVERRIDE
     208    37421566 :             { BaseClass::acquire(); }
     209    37420685 :         virtual void SAL_CALL release() throw () SAL_OVERRIDE
     210    37420685 :             { BaseClass::release(); }
     211         572 :         virtual com::sun::star::uno::Sequence< com::sun::star::uno::Type > SAL_CALL getTypes() throw (com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE
     212         572 :             { return ImplInhHelper_getTypes( cd::get(), BaseClass::getTypes() ); }
     213           0 :         virtual com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE
     214           0 :             { return ImplHelper_getImplementationId( cd::get() ); }
     215             :     };
     216             :     /** Implementation helper implementing interfaces com::sun::star::lang::XTypeProvider and
     217             :         com::sun::star::uno::XInterface inherting from a BaseClass.
     218             :         All acquire(),  release() and queryInterface() calls are delegated to the BaseClass.
     219             :         Upon queryAggregation(), if a demanded interface is not supported by this class directly,
     220             :         the request is delegated to the BaseClass.
     221             : 
     222             :         @attention
     223             :         The BaseClass has to be complete in a sense, that com::sun::star::uno::XInterface,
     224             :         com::sun::star::uno::XAggregation and com::sun::star::lang::XTypeProvider
     225             :         are implemented properly.  The BaseClass must have at least one ctor
     226             :         that can be called with six or fewer arguments, of which none is of
     227             :         non-const reference type.
     228             : 
     229             :         @derive
     230             :         Inherit from this class giving your additional interface(s) to be implemented as
     231             :         template argument(s). Your sub class defines method implementations for these interface(s).
     232             :     */
     233             :     template< class BaseClass, class Ifc1 >
     234          76 :     class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE AggImplInheritanceHelper1
     235             :         : public BaseClass
     236             :         , public Ifc1
     237             :     {
     238             :         struct cd : public rtl::StaticAggregate< class_data, ImplClassData1< Ifc1, AggImplInheritanceHelper1< BaseClass, Ifc1 > > > {};
     239             :     protected:
     240             :         template< typename T1 >
     241          67 :         explicit AggImplInheritanceHelper1(T1 const & arg1): BaseClass(arg1) {}
     242             :         template< typename T1, typename T2 >
     243             :         AggImplInheritanceHelper1(T1 const & arg1, T2 const & arg2):
     244             :             BaseClass(arg1, arg2) {}
     245             :         template< typename T1, typename T2, typename T3 >
     246             :         AggImplInheritanceHelper1(
     247             :             T1 const & arg1, T2 const & arg2, T3 const & arg3):
     248             :             BaseClass(arg1, arg2, arg3) {}
     249             :         template< typename T1, typename T2, typename T3, typename T4 >
     250             :         AggImplInheritanceHelper1(
     251             :             T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4):
     252             :             BaseClass(arg1, arg2, arg3, arg4) {}
     253             :         template<
     254             :             typename T1, typename T2, typename T3, typename T4, typename T5 >
     255             :         AggImplInheritanceHelper1(
     256             :             T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4,
     257             :             T5 const & arg5):
     258             :             BaseClass(arg1, arg2, arg3, arg4, arg5) {}
     259             :         template<
     260             :             typename T1, typename T2, typename T3, typename T4, typename T5,
     261             :             typename T6 >
     262             :         AggImplInheritanceHelper1(
     263             :             T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4,
     264             :             T5 const & arg5, T6 const & arg6):
     265             :             BaseClass(arg1, arg2, arg3, arg4, arg5, arg6) {}
     266             :     public:
     267          14 :         AggImplInheritanceHelper1() {}
     268        6472 :         virtual com::sun::star::uno::Any SAL_CALL queryInterface( com::sun::star::uno::Type const & rType ) throw (com::sun::star::uno::RuntimeException) SAL_OVERRIDE
     269        6472 :             { return BaseClass::queryInterface( rType ); }
     270        8396 :         virtual com::sun::star::uno::Any SAL_CALL queryAggregation( com::sun::star::uno::Type const & rType ) throw (com::sun::star::uno::RuntimeException) SAL_OVERRIDE
     271             :             {
     272        8396 :                 com::sun::star::uno::Any aRet( ImplHelper_queryNoXInterface( rType, cd::get(), this ) );
     273        8396 :                 if (aRet.hasValue())
     274         218 :                     return aRet;
     275        8178 :                 return BaseClass::queryAggregation( rType );
     276             :             }
     277       22378 :         virtual void SAL_CALL acquire() throw () SAL_OVERRIDE
     278       22378 :             { BaseClass::acquire(); }
     279       22346 :         virtual void SAL_CALL release() throw () SAL_OVERRIDE
     280       22346 :             { BaseClass::release(); }
     281          44 :         virtual com::sun::star::uno::Sequence< com::sun::star::uno::Type > SAL_CALL getTypes() throw (com::sun::star::uno::RuntimeException) SAL_OVERRIDE
     282          44 :             { return ImplInhHelper_getTypes( cd::get(), BaseClass::getTypes() ); }
     283           4 :         virtual com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (com::sun::star::uno::RuntimeException) SAL_OVERRIDE
     284           4 :             { return ImplHelper_getImplementationId( cd::get() ); }
     285             :     };
     286             : }
     287             : 
     288             : #endif
     289             : 
     290             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11