LCOV - code coverage report
Current view: top level - usr/local/src/libreoffice/include/cppuhelper - implbase1.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 74 78 94.9 %
Date: 2013-07-09 Functions: 1608 4869 33.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_IMPLBASE1_HXX_
      20             : #define _CPPUHELPER_IMPLBASE1_HXX_
      21             : 
      22             : #include <cppuhelper/implbase_ex.hxx>
      23             : #include <rtl/instance.hxx>
      24             : #include <com/sun/star/uno/XComponentContext.hpp>
      25             : 
      26             : namespace cppu
      27             : {
      28             :     /// @cond INTERNAL
      29             : 
      30             :     struct class_data1
      31             :     {
      32             :         sal_Int16 m_nTypes;
      33             :         sal_Bool m_storedTypeRefs;
      34             :         sal_Bool m_storedId;
      35             :         sal_Int8 m_id[ 16 ];
      36             :         type_entry m_typeEntries[ 1 + 1 ];
      37             :     };
      38             : 
      39             :     template< typename Ifc1, typename Impl > struct ImplClassData1
      40             :     {
      41        6920 :         class_data* operator ()()
      42             :         {
      43             :             static class_data1 s_cd =
      44             :             {
      45             :                 1 +1, sal_False, sal_False,
      46             :                 { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
      47             :                 {
      48             :                     { { Ifc1::static_type }, ((sal_IntPtr)(Ifc1 *) (Impl *) 16) - 16 },
      49             :                     { { com::sun::star::lang::XTypeProvider::static_type }, ((sal_IntPtr)(com::sun::star::lang::XTypeProvider *) (Impl *) 16) - 16 }
      50             :                 }
      51             :             };
      52        6920 :             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 method XInterface::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 sub class defines method implementations for these interface(s) including acquire()/
      64             :         release() and delegates incoming queryInterface() calls to this base class.
      65             :     */
      66             :     template< class Ifc1 >
      67       29123 :     class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE ImplHelper1
      68             :         : public com::sun::star::lang::XTypeProvider
      69             :         , public Ifc1
      70             :     {
      71             :         struct cd : public rtl::StaticAggregate< class_data, ImplClassData1 < Ifc1, ImplHelper1<Ifc1> > > {};
      72             :     public:
      73      440110 :         virtual com::sun::star::uno::Any SAL_CALL queryInterface( com::sun::star::uno::Type const & rType ) throw (com::sun::star::uno::RuntimeException)
      74      440110 :             { 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           4 :         virtual com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (com::sun::star::uno::RuntimeException)
      78           4 :             { return ImplHelper_getImplementationId( cd::get() ); }
      79             : 
      80             : #if !defined _MSC_VER // public -> protected changes mangled names there
      81             :     protected:
      82             : #endif
      83       27105 :         ~ImplHelper1() 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             :         These classes are used when you implement your UNO component.
      94             :         WeakImplHelper1 till WeakImplHelper12 can be used when you want
      95             :         to implement 1 till 12 interfaces in your component.
      96             :     */
      97             :     template< class Ifc1 >
      98     3870013 :     class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE SAL_DLLPUBLIC_EXPORT WeakImplHelper1
      99             :         : public OWeakObject
     100             :         , public com::sun::star::lang::XTypeProvider
     101             :         , public Ifc1
     102             :     {
     103             :         struct cd : public rtl::StaticAggregate< class_data, ImplClassData1< Ifc1, WeakImplHelper1< Ifc1 > > > {};
     104             :     public:
     105      675141 :         virtual com::sun::star::uno::Any SAL_CALL queryInterface( com::sun::star::uno::Type const & rType ) throw (com::sun::star::uno::RuntimeException)
     106      675141 :             { return WeakImplHelper_query( rType, cd::get(), this, (OWeakObject *)this ); }
     107     9655067 :         virtual void SAL_CALL acquire() throw ()
     108     9655067 :             { OWeakObject::acquire(); }
     109     9617068 :         virtual void SAL_CALL release() throw ()
     110     9617068 :             { OWeakObject::release(); }
     111        1877 :         virtual com::sun::star::uno::Sequence< com::sun::star::uno::Type > SAL_CALL getTypes() throw (com::sun::star::uno::RuntimeException)
     112        1877 :             { return WeakImplHelper_getTypes( cd::get() ); }
     113        1514 :         virtual com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (com::sun::star::uno::RuntimeException)
     114        1514 :             { return ImplHelper_getImplementationId( cd::get() ); }
     115             :     };
     116             :     /** Implementation helper implementing interfaces com::sun::star::lang::XTypeProvider and
     117             :         com::sun::star::uno::XInterface which supports weak mechanism to be held weakly
     118             :         (supporting com::sun::star::uno::XWeak thru ::cppu::OWeakAggObject).
     119             :         In addition, it supports also aggregation meaning object of this class can be aggregated
     120             :         (com::sun::star::uno::XAggregation thru ::cppu::OWeakAggObject).
     121             :         If a delegator is set (this object is aggregated), then incoming queryInterface()
     122             :         calls are delegated to the delegator object. If the delegator does not support the
     123             :         demanded interface, it calls queryAggregation() on its aggregated objects.
     124             : 
     125             :         @derive
     126             :         Inherit from this class giving your interface(s) to be implemented as template argument(s).
     127             :         Your sub class defines method implementations for these interface(s).
     128             :     */
     129             :     template< class Ifc1 >
     130       99656 :     class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE WeakAggImplHelper1
     131             :         : public OWeakAggObject
     132             :         , public com::sun::star::lang::XTypeProvider
     133             :         , public Ifc1
     134             :     {
     135             :         struct cd : public rtl::StaticAggregate< class_data, ImplClassData1< Ifc1, WeakAggImplHelper1< Ifc1 > > > {};
     136             :     public:
     137        5042 :         virtual com::sun::star::uno::Any SAL_CALL queryInterface( com::sun::star::uno::Type const & rType ) throw (com::sun::star::uno::RuntimeException)
     138        5042 :             { return OWeakAggObject::queryInterface( rType ); }
     139        4952 :         virtual com::sun::star::uno::Any SAL_CALL queryAggregation( com::sun::star::uno::Type const & rType ) throw (com::sun::star::uno::RuntimeException)
     140        4952 :             { return WeakAggImplHelper_queryAgg( rType, cd::get(), this, (OWeakAggObject *)this ); }
     141       17654 :         virtual void SAL_CALL acquire() throw ()
     142       17654 :             { OWeakAggObject::acquire(); }
     143       17649 :         virtual void SAL_CALL release() throw ()
     144       17649 :             { OWeakAggObject::release(); }
     145           0 :         virtual com::sun::star::uno::Sequence< com::sun::star::uno::Type > SAL_CALL getTypes() throw (com::sun::star::uno::RuntimeException)
     146           0 :             { return WeakAggImplHelper_getTypes( cd::get() ); }
     147           0 :         virtual com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (com::sun::star::uno::RuntimeException)
     148           0 :             { return ImplHelper_getImplementationId( cd::get() ); }
     149             :     };
     150             :     /** Implementation helper implementing interfaces com::sun::star::lang::XTypeProvider and
     151             :         com::sun::star::uno::XInterface inherting from a BaseClass.
     152             :         All acquire() and release() calls are delegated to the BaseClass. Upon queryInterface(),
     153             :         if a demanded interface is not supported by this class directly, the request is
     154             :         delegated to the BaseClass.
     155             : 
     156             :         @attention
     157             :         The BaseClass has to be complete in a sense, that com::sun::star::uno::XInterface
     158             :         and com::sun::star::lang::XTypeProvider are implemented properly.  The
     159             :         BaseClass must have at least one ctor that can be called with six or
     160             :         fewer arguments, of which none is of non-const reference type.
     161             : 
     162             :         @derive
     163             :         Inherit from this class giving your additional interface(s) to be implemented as
     164             :         template argument(s). Your sub class defines method implementations for these interface(s).
     165             :     */
     166             :     template< class BaseClass, class Ifc1 >
     167      501071 :     class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE ImplInheritanceHelper1
     168             :         : public BaseClass
     169             :         , public Ifc1
     170             :     {
     171             :         struct cd : public rtl::StaticAggregate< class_data, ImplClassData1< Ifc1, ImplInheritanceHelper1< BaseClass, Ifc1 > > > {};
     172             :     protected:
     173             : #if (defined __SUNPRO_CC && __SUNPRO_CC <= 0x550)
     174             :         // Hack, to get comphelper::service_decl to work for non-trivial impl classes
     175             :         ImplInheritanceHelper1( com::sun::star::uno::Sequence<com::sun::star::uno::Any> const& args,
     176             :                                 com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext> const& xContext ) : BaseClass(args,xContext) {}
     177             : #endif
     178             :         template< typename T1 >
     179      286400 :         explicit ImplInheritanceHelper1(T1 const & arg1): BaseClass(arg1) {}
     180             :         template< typename T1, typename T2 >
     181        2410 :         ImplInheritanceHelper1(T1 const & arg1, T2 const & arg2):
     182        2410 :             BaseClass(arg1, arg2) {}
     183             :         template< typename T1, typename T2, typename T3 >
     184          62 :         ImplInheritanceHelper1(
     185             :             T1 const & arg1, T2 const & arg2, T3 const & arg3):
     186          62 :             BaseClass(arg1, arg2, arg3) {}
     187             :         template< typename T1, typename T2, typename T3, typename T4 >
     188       67667 :         ImplInheritanceHelper1(
     189             :             T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4):
     190       67667 :             BaseClass(arg1, arg2, arg3, arg4) {}
     191             :         template<
     192             :             typename T1, typename T2, typename T3, typename T4, typename T5 >
     193          12 :         ImplInheritanceHelper1(
     194             :             T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4,
     195             :             T5 const & arg5):
     196          12 :             BaseClass(arg1, arg2, arg3, arg4, arg5) {}
     197             :         template<
     198             :             typename T1, typename T2, typename T3, typename T4, typename T5,
     199             :             typename T6 >
     200           2 :         ImplInheritanceHelper1(
     201             :             T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4,
     202             :             T5 const & arg5, T6 const & arg6):
     203           2 :             BaseClass(arg1, arg2, arg3, arg4, arg5, arg6) {}
     204             :     public:
     205      144437 :         ImplInheritanceHelper1() {}
     206     1510888 :         virtual com::sun::star::uno::Any SAL_CALL queryInterface( com::sun::star::uno::Type const & rType ) throw (com::sun::star::uno::RuntimeException)
     207             :             {
     208     1510888 :                 com::sun::star::uno::Any aRet( ImplHelper_queryNoXInterface( rType, cd::get(), this ) );
     209     1510888 :                 if (aRet.hasValue())
     210      823958 :                     return aRet;
     211      686930 :                 return BaseClass::queryInterface( rType );
     212             :             }
     213     6103899 :         virtual void SAL_CALL acquire() throw ()
     214     6103899 :             { BaseClass::acquire(); }
     215     6103349 :         virtual void SAL_CALL release() throw ()
     216     6103349 :             { BaseClass::release(); }
     217         286 :         virtual com::sun::star::uno::Sequence< com::sun::star::uno::Type > SAL_CALL getTypes() throw (com::sun::star::uno::RuntimeException)
     218         286 :             { return ImplInhHelper_getTypes( cd::get(), BaseClass::getTypes() ); }
     219         330 :         virtual com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (com::sun::star::uno::RuntimeException)
     220         330 :             { return ImplHelper_getImplementationId( cd::get() ); }
     221             :     };
     222             :     /** Implementation helper implementing interfaces com::sun::star::lang::XTypeProvider and
     223             :         com::sun::star::uno::XInterface inherting from a BaseClass.
     224             :         All acquire(),  release() and queryInterface() calls are delegated to the BaseClass.
     225             :         Upon queryAggregation(), if a demanded interface is not supported by this class directly,
     226             :         the request is delegated to the BaseClass.
     227             : 
     228             :         @attention
     229             :         The BaseClass has to be complete in a sense, that com::sun::star::uno::XInterface,
     230             :         com::sun::star::uno::XAggregation and com::sun::star::lang::XTypeProvider
     231             :         are implemented properly.  The BaseClass must have at least one ctor
     232             :         that can be called with six or fewer arguments, of which none is of
     233             :         non-const reference type.
     234             : 
     235             :         @derive
     236             :         Inherit from this class giving your additional interface(s) to be implemented as
     237             :         template argument(s). Your sub class defines method implementations for these interface(s).
     238             :     */
     239             :     template< class BaseClass, class Ifc1 >
     240          42 :     class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE AggImplInheritanceHelper1
     241             :         : public BaseClass
     242             :         , public Ifc1
     243             :     {
     244             :         struct cd : public rtl::StaticAggregate< class_data, ImplClassData1< Ifc1, AggImplInheritanceHelper1< BaseClass, Ifc1 > > > {};
     245             :     protected:
     246             :         template< typename T1 >
     247          37 :         explicit AggImplInheritanceHelper1(T1 const & arg1): BaseClass(arg1) {}
     248             :         template< typename T1, typename T2 >
     249             :         AggImplInheritanceHelper1(T1 const & arg1, T2 const & arg2):
     250             :             BaseClass(arg1, arg2) {}
     251             :         template< typename T1, typename T2, typename T3 >
     252             :         AggImplInheritanceHelper1(
     253             :             T1 const & arg1, T2 const & arg2, T3 const & arg3):
     254             :             BaseClass(arg1, arg2, arg3) {}
     255             :         template< typename T1, typename T2, typename T3, typename T4 >
     256             :         AggImplInheritanceHelper1(
     257             :             T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4):
     258             :             BaseClass(arg1, arg2, arg3, arg4) {}
     259             :         template<
     260             :             typename T1, typename T2, typename T3, typename T4, typename T5 >
     261             :         AggImplInheritanceHelper1(
     262             :             T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4,
     263             :             T5 const & arg5):
     264             :             BaseClass(arg1, arg2, arg3, arg4, arg5) {}
     265             :         template<
     266             :             typename T1, typename T2, typename T3, typename T4, typename T5,
     267             :             typename T6 >
     268             :         AggImplInheritanceHelper1(
     269             :             T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4,
     270             :             T5 const & arg5, T6 const & arg6):
     271             :             BaseClass(arg1, arg2, arg3, arg4, arg5, arg6) {}
     272             :     public:
     273          11 :         AggImplInheritanceHelper1() {}
     274        5443 :         virtual com::sun::star::uno::Any SAL_CALL queryInterface( com::sun::star::uno::Type const & rType ) throw (com::sun::star::uno::RuntimeException)
     275        5443 :             { return BaseClass::queryInterface( rType ); }
     276        6837 :         virtual com::sun::star::uno::Any SAL_CALL queryAggregation( com::sun::star::uno::Type const & rType ) throw (com::sun::star::uno::RuntimeException)
     277             :             {
     278        6837 :                 com::sun::star::uno::Any aRet( ImplHelper_queryNoXInterface( rType, cd::get(), this ) );
     279        6837 :                 if (aRet.hasValue())
     280         150 :                     return aRet;
     281        6687 :                 return BaseClass::queryAggregation( rType );
     282             :             }
     283       17461 :         virtual void SAL_CALL acquire() throw ()
     284       17461 :             { BaseClass::acquire(); }
     285       17415 :         virtual void SAL_CALL release() throw ()
     286       17415 :             { BaseClass::release(); }
     287          26 :         virtual com::sun::star::uno::Sequence< com::sun::star::uno::Type > SAL_CALL getTypes() throw (com::sun::star::uno::RuntimeException)
     288          26 :             { return ImplInhHelper_getTypes( cd::get(), BaseClass::getTypes() ); }
     289           4 :         virtual com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (com::sun::star::uno::RuntimeException)
     290           4 :             { return ImplHelper_getImplementationId( cd::get() ); }
     291             :     };
     292             : }
     293             : 
     294             : #endif
     295             : 
     296             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10