LCOV - code coverage report
Current view: top level - usr/local/src/libreoffice/include/cppuhelper - implbase2.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 67 76 88.2 %
Date: 2013-07-09 Functions: 1146 2667 43.0 %
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 _CPPUHELPER_IMPLBASE2_HXX_
      20             : #define _CPPUHELPER_IMPLBASE2_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_data2
      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[ 2 + 1 ];
      36             :     };
      37             : 
      38             :     template< typename Ifc1, typename Ifc2, typename Impl > struct ImplClassData2
      39             :     {
      40        4744 :         class_data* operator ()()
      41             :         {
      42             :             static class_data2 s_cd =
      43             :             {
      44             :                 2 +1, sal_False, sal_False,
      45             :                 { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
      46             :                 {
      47             :                     { { Ifc1::static_type }, ((sal_IntPtr)(Ifc1 *) (Impl *) 16) - 16 },
      48             :                     { { Ifc2::static_type }, ((sal_IntPtr)(Ifc2 *) (Impl *) 16) - 16 },
      49             :                     { { com::sun::star::lang::XTypeProvider::static_type }, ((sal_IntPtr)(com::sun::star::lang::XTypeProvider *) (Impl *) 16) - 16 }
      50             :                 }
      51             :             };
      52        4744 :             return reinterpret_cast< class_data * >(&s_cd);
      53             :         }
      54             :     };
      55             : 
      56             :     /// @endcond
      57             : 
      58             :     /** Implementation helper implementing interface com::sun::star::lang::XTypeProvider
      59             :         and queryInterface(), but no reference counting.
      60             : 
      61             :         @derive
      62             :         Inherit from this class giving your interface(s) to be implemented as template argument(s).
      63             :         Your base class defines method implementations, acquire(), release() and delegates incoming
      64             :         queryInterface() calls to this base class.
      65             :     */
      66             :     template< class Ifc1, class Ifc2 >
      67        3222 :     class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE ImplHelper2
      68             :         : public com::sun::star::lang::XTypeProvider
      69             :         , public Ifc1, public Ifc2
      70             :     {
      71             :         struct cd : public rtl::StaticAggregate< class_data, ImplClassData2 < Ifc1, Ifc2, ImplHelper2<Ifc1, Ifc2> > > {};
      72             :     public:
      73       16056 :         virtual com::sun::star::uno::Any SAL_CALL queryInterface( com::sun::star::uno::Type const & rType ) throw (com::sun::star::uno::RuntimeException)
      74       16056 :             { return ImplHelper_query( rType, cd::get(), this ); }
      75         164 :         virtual com::sun::star::uno::Sequence< com::sun::star::uno::Type > SAL_CALL getTypes() throw (com::sun::star::uno::RuntimeException)
      76         164 :             { return ImplHelper_getTypes( cd::get() ); }
      77           0 :         virtual com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (com::sun::star::uno::RuntimeException)
      78           0 :             { return ImplHelper_getImplementationId( cd::get() ); }
      79             : 
      80             : #if !defined _MSC_VER // public -> protected changes mangled names there
      81             :     protected:
      82             : #endif
      83        3137 :         ~ImplHelper2() throw () {}
      84             :     };
      85             :     /** Implementation helper implementing interfaces com::sun::star::lang::XTypeProvider and
      86             :         com::sun::star::uno::XInterface which supports weak mechanism to be held weakly
      87             :         (supporting com::sun::star::uno::XWeak thru ::cppu::OWeakObject).
      88             : 
      89             :         @derive
      90             :         Inherit from this class giving your interface(s) to be implemented as template argument(s).
      91             :         Your sub class defines method implementations for these interface(s).
      92             :     */
      93             :     template< class Ifc1, class Ifc2 >
      94      630533 :     class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE SAL_DLLPUBLIC_EXPORT WeakImplHelper2
      95             :         : public OWeakObject
      96             :         , public com::sun::star::lang::XTypeProvider
      97             :         , public Ifc1, public Ifc2
      98             :     {
      99             :         struct cd : public rtl::StaticAggregate< class_data, ImplClassData2 < Ifc1, Ifc2, WeakImplHelper2<Ifc1, Ifc2> > > {};
     100             :     public:
     101      772598 :         virtual com::sun::star::uno::Any SAL_CALL queryInterface( com::sun::star::uno::Type const & rType ) throw (com::sun::star::uno::RuntimeException)
     102      772598 :             { return WeakImplHelper_query( rType, cd::get(), this, (OWeakObject *)this ); }
     103     4101909 :         virtual void SAL_CALL acquire() throw ()
     104     4101909 :             { OWeakObject::acquire(); }
     105     4099741 :         virtual void SAL_CALL release() throw ()
     106     4099741 :             { OWeakObject::release(); }
     107          80 :         virtual com::sun::star::uno::Sequence< com::sun::star::uno::Type > SAL_CALL getTypes() throw (com::sun::star::uno::RuntimeException)
     108          80 :             { return WeakImplHelper_getTypes( cd::get() ); }
     109          73 :         virtual com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (com::sun::star::uno::RuntimeException)
     110          73 :             { return ImplHelper_getImplementationId( cd::get() ); }
     111             :     };
     112             :     /** Implementation helper implementing interfaces com::sun::star::lang::XTypeProvider and
     113             :         com::sun::star::uno::XInterface which supports weak mechanism to be held weakly
     114             :         (supporting com::sun::star::uno::XWeak thru ::cppu::OWeakAggObject).
     115             :         In addition, it supports also aggregation meaning object of this class can be aggregated
     116             :         (com::sun::star::uno::XAggregation thru ::cppu::OWeakAggObject).
     117             :         If a delegator is set (this object is aggregated), then incoming queryInterface()
     118             :         calls are delegated to the delegator object. If the delegator does not support the
     119             :         demanded interface, it calls queryAggregation() on its aggregated objects.
     120             : 
     121             :         @derive
     122             :         Inherit from this class giving your interface(s) to be implemented as template argument(s).
     123             :         Your sub class defines method implementations for these interface(s).
     124             :     */
     125             :     template< class Ifc1, class Ifc2 >
     126        5017 :     class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE WeakAggImplHelper2
     127             :         : public OWeakAggObject
     128             :         , public com::sun::star::lang::XTypeProvider
     129             :         , public Ifc1, public Ifc2
     130             :     {
     131             :         struct cd : public rtl::StaticAggregate< class_data, ImplClassData2 < Ifc1, Ifc2, WeakAggImplHelper2<Ifc1, Ifc2> > > {};
     132             :     public:
     133        9137 :         virtual com::sun::star::uno::Any SAL_CALL queryInterface( com::sun::star::uno::Type const & rType ) throw (com::sun::star::uno::RuntimeException)
     134        9137 :             { return OWeakAggObject::queryInterface( rType ); }
     135       19546 :         virtual com::sun::star::uno::Any SAL_CALL queryAggregation( com::sun::star::uno::Type const & rType ) throw (com::sun::star::uno::RuntimeException)
     136       19546 :             { return WeakAggImplHelper_queryAgg( rType, cd::get(), this, (OWeakAggObject *)this ); }
     137       74919 :         virtual void SAL_CALL acquire() throw ()
     138       74919 :             { OWeakAggObject::acquire(); }
     139       74421 :         virtual void SAL_CALL release() throw ()
     140       74421 :             { OWeakAggObject::release(); }
     141         834 :         virtual com::sun::star::uno::Sequence< com::sun::star::uno::Type > SAL_CALL getTypes() throw (com::sun::star::uno::RuntimeException)
     142         834 :             { return WeakAggImplHelper_getTypes( cd::get() ); }
     143           0 :         virtual com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (com::sun::star::uno::RuntimeException)
     144           0 :             { return ImplHelper_getImplementationId( cd::get() ); }
     145             :     };
     146             :     /** Implementation helper implementing interfaces com::sun::star::lang::XTypeProvider and
     147             :         com::sun::star::uno::XInterface inherting from a BaseClass.
     148             :         All acquire() and release() calls are delegated to the BaseClass. Upon queryInterface(),
     149             :         if a demanded interface is not supported by this class directly, the request is
     150             :         delegated to the BaseClass.
     151             : 
     152             :         @attention
     153             :         The BaseClass has to be complete in a sense, that com::sun::star::uno::XInterface
     154             :         and com::sun::star::lang::XTypeProvider are implemented properly.  The
     155             :         BaseClass must have at least one ctor that can be called with six or
     156             :         fewer arguments, of which none is of non-const reference type.
     157             : 
     158             :         @derive
     159             :         Inherit from this class giving your additional interface(s) to be implemented as
     160             :         template argument(s). Your sub class defines method implementations for these interface(s).
     161             :     */
     162             :     template< class BaseClass, class Ifc1, class Ifc2 >
     163       43877 :     class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE ImplInheritanceHelper2
     164             :         : public BaseClass
     165             :         , public Ifc1, public Ifc2
     166             :     {
     167             :         struct cd : public rtl::StaticAggregate< class_data, ImplClassData2 < Ifc1, Ifc2, ImplInheritanceHelper2<BaseClass, Ifc1, Ifc2> > > {};
     168             :     protected:
     169             :         template< typename T1 >
     170         292 :         explicit ImplInheritanceHelper2(T1 const & arg1): BaseClass(arg1) {}
     171             :         template< typename T1, typename T2 >
     172           0 :         ImplInheritanceHelper2(T1 const & arg1, T2 const & arg2):
     173           0 :             BaseClass(arg1, arg2) {}
     174             :         template< typename T1, typename T2, typename T3 >
     175           0 :         ImplInheritanceHelper2(
     176             :             T1 const & arg1, T2 const & arg2, T3 const & arg3):
     177           0 :             BaseClass(arg1, arg2, arg3) {}
     178             :         template< typename T1, typename T2, typename T3, typename T4 >
     179        6648 :         ImplInheritanceHelper2(
     180             :             T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4):
     181        6648 :             BaseClass(arg1, arg2, arg3, arg4) {}
     182             :         template<
     183             :             typename T1, typename T2, typename T3, typename T4, typename T5 >
     184         120 :         ImplInheritanceHelper2(
     185             :             T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4,
     186             :             T5 const & arg5):
     187         120 :             BaseClass(arg1, arg2, arg3, arg4, arg5) {}
     188             :         template<
     189             :             typename T1, typename T2, typename T3, typename T4, typename T5,
     190             :             typename T6 >
     191             :         ImplInheritanceHelper2(
     192             :             T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4,
     193             :             T5 const & arg5, T6 const & arg6):
     194             :             BaseClass(arg1, arg2, arg3, arg4, arg5, arg6) {}
     195             :     public:
     196       37386 :         ImplInheritanceHelper2() {}
     197      151762 :         virtual com::sun::star::uno::Any SAL_CALL queryInterface( com::sun::star::uno::Type const & rType ) throw (com::sun::star::uno::RuntimeException)
     198             :             {
     199      151762 :                 com::sun::star::uno::Any aRet( ImplHelper_queryNoXInterface( rType, cd::get(), this ) );
     200      151762 :                 if (aRet.hasValue())
     201       38491 :                     return aRet;
     202      113271 :                 return BaseClass::queryInterface( rType );
     203             :             }
     204      839713 :         virtual void SAL_CALL acquire() throw ()
     205      839713 :             { BaseClass::acquire(); }
     206      732378 :         virtual void SAL_CALL release() throw ()
     207      732378 :             { BaseClass::release(); }
     208         112 :         virtual com::sun::star::uno::Sequence< com::sun::star::uno::Type > SAL_CALL getTypes() throw (com::sun::star::uno::RuntimeException)
     209         112 :             { return ImplInhHelper_getTypes( cd::get(), BaseClass::getTypes() ); }
     210         275 :         virtual com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (com::sun::star::uno::RuntimeException)
     211         275 :             { return ImplHelper_getImplementationId( cd::get() ); }
     212             :     };
     213             :     /** Implementation helper implementing interfaces com::sun::star::lang::XTypeProvider and
     214             :         com::sun::star::uno::XInterface inherting from a BaseClass.
     215             :         All acquire(),  release() and queryInterface() calls are delegated to the BaseClass.
     216             :         Upon queryAggregation(), if a demanded interface is not supported by this class directly,
     217             :         the request is delegated to the BaseClass.
     218             : 
     219             :         @attention
     220             :         The BaseClass has to be complete in a sense, that com::sun::star::uno::XInterface,
     221             :         com::sun::star::uno::XAggregation and com::sun::star::lang::XTypeProvider
     222             :         are implemented properly.  The BaseClass must have at least one ctor
     223             :         that can be called with six or fewer arguments, of which none is of
     224             :         non-const reference type.
     225             : 
     226             :         @derive
     227             :         Inherit from this class giving your additional interface(s) to be implemented as
     228             :         template argument(s). Your sub class defines method implementations for these interface(s).
     229             :     */
     230             :     template< class BaseClass, class Ifc1, class Ifc2 >
     231           1 :     class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE AggImplInheritanceHelper2
     232             :         : public BaseClass
     233             :         , public Ifc1, public Ifc2
     234             :     {
     235             :         struct cd : public rtl::StaticAggregate< class_data, ImplClassData2 < Ifc1, Ifc2, AggImplInheritanceHelper2<BaseClass, Ifc1, Ifc2> > > {};
     236             :     protected:
     237             :         template< typename T1 >
     238           7 :         explicit AggImplInheritanceHelper2(T1 const & arg1): BaseClass(arg1) {}
     239             :         template< typename T1, typename T2 >
     240             :         AggImplInheritanceHelper2(T1 const & arg1, T2 const & arg2):
     241             :             BaseClass(arg1, arg2) {}
     242             :         template< typename T1, typename T2, typename T3 >
     243             :         AggImplInheritanceHelper2(
     244             :             T1 const & arg1, T2 const & arg2, T3 const & arg3):
     245             :             BaseClass(arg1, arg2, arg3) {}
     246             :         template< typename T1, typename T2, typename T3, typename T4 >
     247             :         AggImplInheritanceHelper2(
     248             :             T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4):
     249             :             BaseClass(arg1, arg2, arg3, arg4) {}
     250             :         template<
     251             :             typename T1, typename T2, typename T3, typename T4, typename T5 >
     252             :         AggImplInheritanceHelper2(
     253             :             T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4,
     254             :             T5 const & arg5):
     255             :             BaseClass(arg1, arg2, arg3, arg4, arg5) {}
     256             :         template<
     257             :             typename T1, typename T2, typename T3, typename T4, typename T5,
     258             :             typename T6 >
     259             :         AggImplInheritanceHelper2(
     260             :             T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4,
     261             :             T5 const & arg5, T6 const & arg6):
     262             :             BaseClass(arg1, arg2, arg3, arg4, arg5, arg6) {}
     263             :     public:
     264           0 :         AggImplInheritanceHelper2() {}
     265         410 :         virtual com::sun::star::uno::Any SAL_CALL queryInterface( com::sun::star::uno::Type const & rType ) throw (com::sun::star::uno::RuntimeException)
     266         410 :             { return BaseClass::queryInterface( rType ); }
     267         431 :         virtual com::sun::star::uno::Any SAL_CALL queryAggregation( com::sun::star::uno::Type const & rType ) throw (com::sun::star::uno::RuntimeException)
     268             :             {
     269         431 :                 com::sun::star::uno::Any aRet( ImplHelper_queryNoXInterface( rType, cd::get(), this ) );
     270         431 :                 if (aRet.hasValue())
     271         335 :                     return aRet;
     272          96 :                 return BaseClass::queryAggregation( rType );
     273             :             }
     274        1517 :         virtual void SAL_CALL acquire() throw ()
     275        1517 :             { BaseClass::acquire(); }
     276        1445 :         virtual void SAL_CALL release() throw ()
     277        1445 :             { BaseClass::release(); }
     278          18 :         virtual com::sun::star::uno::Sequence< com::sun::star::uno::Type > SAL_CALL getTypes() throw (com::sun::star::uno::RuntimeException)
     279          18 :             { return ImplInhHelper_getTypes( cd::get(), BaseClass::getTypes() ); }
     280          18 :         virtual com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (com::sun::star::uno::RuntimeException)
     281          18 :             { return ImplHelper_getImplementationId( cd::get() ); }
     282             :     };
     283             : }
     284             : 
     285             : #endif
     286             : 
     287             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10