LCOV - code coverage report
Current view: top level - include/cppuhelper - compbase_ex.hxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 4 8 50.0 %
Date: 2014-04-14 Functions: 2 4 50.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 INCLUDED_CPPUHELPER_COMPBASE_EX_HXX
      20             : #define INCLUDED_CPPUHELPER_COMPBASE_EX_HXX
      21             : 
      22             : #include <osl/mutex.hxx>
      23             : #include <cppuhelper/implbase_ex.hxx>
      24             : #include <cppuhelper/interfacecontainer.hxx>
      25             : #include <com/sun/star/lang/XComponent.hpp>
      26             : #include <cppuhelper/cppuhelperdllapi.h>
      27             : 
      28             : /// @cond INTERNAL
      29             : 
      30             : namespace cppu
      31             : {
      32             : 
      33             : /** Implementation helper base class for components. Inherits from ::cppu::OWeakObject and
      34             :     ::com::sun::star::lang::XComponent.
      35             : */
      36             : class CPPUHELPER_DLLPUBLIC SAL_NO_VTABLE WeakComponentImplHelperBase
      37             :     : public ::cppu::OWeakObject
      38             :     , public ::com::sun::star::lang::XComponent
      39             : {
      40             : protected:
      41             :     /** broadcast helper for disposing events
      42             :     */
      43             :     ::cppu::OBroadcastHelper rBHelper;
      44             : 
      45             :     /** this function is called upon disposing the component
      46             :     */
      47             :     virtual void SAL_CALL disposing();
      48             : 
      49             :     /** This is the one and only constructor that is called from derived implementations.
      50             : 
      51             :         @param rMutex mutex to sync upon disposing
      52             :     */
      53             :     WeakComponentImplHelperBase( ::osl::Mutex & rMutex ) SAL_THROW(());
      54             : public:
      55             :     /** Destructor
      56             :     */
      57             :     virtual ~WeakComponentImplHelperBase() SAL_THROW(());
      58             : 
      59             :     // these are here to force memory de/allocation to sal lib.
      60           3 :     inline static void * SAL_CALL operator new( size_t nSize ) SAL_THROW(())
      61           3 :         { return ::rtl_allocateMemory( nSize ); }
      62           3 :     inline static void SAL_CALL operator delete( void * pMem ) SAL_THROW(())
      63           3 :         { ::rtl_freeMemory( pMem ); }
      64             :     inline static void * SAL_CALL operator new( size_t, void * pMem ) SAL_THROW(())
      65             :         { return pMem; }
      66             :     inline static void SAL_CALL operator delete( void *, void * ) SAL_THROW(())
      67             :         {}
      68             : 
      69             :     virtual ::com::sun::star::uno::Any SAL_CALL queryInterface(
      70             :         ::com::sun::star::uno::Type const & rType )
      71             :         throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      72             :     virtual void SAL_CALL acquire()
      73             :         throw () SAL_OVERRIDE;
      74             :     virtual void SAL_CALL release()
      75             :         throw () SAL_OVERRIDE;
      76             :     virtual void SAL_CALL dispose()
      77             :         throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      78             :     virtual void SAL_CALL addEventListener(
      79             :         ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > const & xListener )
      80             :         throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      81             :     virtual void SAL_CALL removeEventListener(
      82             :         ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > const & xListener )
      83             :         throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      84             : };
      85             : 
      86             : /** Implementation helper base class for components. Inherits from ::cppu::OWeakAggObject and
      87             :     ::com::sun::star::lang::XComponent.
      88             : */
      89             : class CPPUHELPER_DLLPUBLIC SAL_NO_VTABLE WeakAggComponentImplHelperBase
      90             :     : public ::cppu::OWeakAggObject
      91             :     , public ::com::sun::star::lang::XComponent
      92             : {
      93             : protected:
      94             :     ::cppu::OBroadcastHelper rBHelper;
      95             : 
      96             :     /** Is called upon disposing the component.
      97             :     */
      98             :     virtual void SAL_CALL disposing();
      99             : 
     100             :     WeakAggComponentImplHelperBase( ::osl::Mutex & rMutex ) SAL_THROW(());
     101             : public:
     102             :     virtual ~WeakAggComponentImplHelperBase() SAL_THROW(());
     103             : 
     104             :     // these are here to force memory de/allocation to sal lib.
     105           0 :     inline static void * SAL_CALL operator new( size_t nSize ) SAL_THROW(())
     106           0 :         { return ::rtl_allocateMemory( nSize ); }
     107           0 :     inline static void SAL_CALL operator delete( void * pMem ) SAL_THROW(())
     108           0 :         { ::rtl_freeMemory( pMem ); }
     109             :     inline static void * SAL_CALL operator new( size_t, void * pMem ) SAL_THROW(())
     110             :         { return pMem; }
     111             :     inline static void SAL_CALL operator delete( void *, void * ) SAL_THROW(())
     112             :         {}
     113             : 
     114             :     virtual ::com::sun::star::uno::Any SAL_CALL queryInterface(
     115             :         ::com::sun::star::uno::Type const & rType )
     116             :         throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     117             :     virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation(
     118             :         ::com::sun::star::uno::Type const & rType )
     119             :         throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     120             :     virtual void SAL_CALL acquire()
     121             :         throw () SAL_OVERRIDE;
     122             :     virtual void SAL_CALL release()
     123             :         throw () SAL_OVERRIDE;
     124             :     virtual void SAL_CALL dispose()
     125             :         throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     126             :     virtual void SAL_CALL addEventListener(
     127             :         ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > const & xListener )
     128             :         throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     129             :     virtual void SAL_CALL removeEventListener(
     130             :         ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > const & xListener )
     131             :         throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     132             : };
     133             : 
     134             : /** WeakComponentImplHelper
     135             : */
     136             : CPPUHELPER_DLLPUBLIC ::com::sun::star::uno::Any SAL_CALL WeakComponentImplHelper_query(
     137             :     ::com::sun::star::uno::Type const & rType,
     138             :     class_data * cd,
     139             :     void * that,
     140             :     ::cppu::WeakComponentImplHelperBase * pBase )
     141             :     SAL_THROW( (::com::sun::star::uno::RuntimeException) );
     142             : /** WeakComponentImplHelper
     143             : */
     144             : CPPUHELPER_DLLPUBLIC ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL WeakComponentImplHelper_getTypes(
     145             :     class_data * cd )
     146             :     SAL_THROW( (::com::sun::star::uno::RuntimeException) );
     147             : 
     148             : /** WeakAggComponentImplHelper
     149             : */
     150             : CPPUHELPER_DLLPUBLIC ::com::sun::star::uno::Any SAL_CALL WeakAggComponentImplHelper_queryAgg(
     151             :     ::com::sun::star::uno::Type const & rType,
     152             :     class_data * cd,
     153             :     void * that,
     154             :     ::cppu::WeakAggComponentImplHelperBase * pBase )
     155             :     SAL_THROW( (::com::sun::star::uno::RuntimeException) );
     156             : /** WeakAggComponentImplHelper
     157             : */
     158             : CPPUHELPER_DLLPUBLIC ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL WeakAggComponentImplHelper_getTypes(
     159             :     class_data * cd )
     160             :     SAL_THROW( (::com::sun::star::uno::RuntimeException) );
     161             : 
     162             : }
     163             : 
     164             : /// @endcond
     165             : 
     166             : #endif
     167             : 
     168             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10