LCOV - code coverage report
Current view: top level - include/cppuhelper - weakagg.hxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 2 2 100.0 %
Date: 2015-06-13 12:38:46 Functions: 1 1 100.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_WEAKAGG_HXX
      20             : #define INCLUDED_CPPUHELPER_WEAKAGG_HXX
      21             : 
      22             : #include <cppuhelper/weak.hxx>
      23             : #include <cppuhelper/weakref.hxx>
      24             : #include <com/sun/star/uno/XAggregation.hpp>
      25             : #include <cppuhelper/cppuhelperdllapi.h>
      26             : 
      27             : 
      28             : namespace cppu
      29             : {
      30             : 
      31             : /** Base class to implement an UNO object supporting weak references, i.e. the object can be held
      32             :     weakly (by a ::com::sun::star::uno::WeakReference) and aggregation, i.e. the object can be
      33             :     aggregated by another (delegator).
      34             :     This implementation copes with reference counting.  Upon last release(), the virtual dtor
      35             :     is called.
      36             : 
      37             :     @derive
      38             :     Inherit from this class and delegate acquire()/ release() calls.  Re-implement
      39             :     XAggregation::queryInterface().
      40             : */
      41             : class CPPUHELPER_DLLPUBLIC OWeakAggObject
      42             :     : public ::cppu::OWeakObject
      43             :     , public ::com::sun::star::uno::XAggregation
      44             : {
      45             : public:
      46             :     /** Constructor.  No delegator set.
      47             :     */
      48      454832 :     inline OWeakAggObject()
      49      454832 :         {}
      50             : 
      51             :     /** If a delegator is set, then the delegators gets acquired.  Otherwise call is delegated to
      52             :         base class ::cppu::OWeakObject.
      53             :     */
      54             :     virtual void SAL_CALL acquire() throw() SAL_OVERRIDE;
      55             :     /** If a delegator is set, then the delegators gets released.  Otherwise call is delegated to
      56             :         base class ::cppu::OWeakObject.
      57             :     */
      58             :     virtual void SAL_CALL release() throw() SAL_OVERRIDE;
      59             :     /** If a delegator is set, then the delegator is queried for the demanded interface.  If the
      60             :         delegator cannot provide the demanded interface, it calls queryAggregation() on its
      61             :         aggregated objects.
      62             : 
      63             :         @param rType demanded interface type
      64             :         @return demanded type or empty any
      65             :         @see queryAggregation.
      66             :     */
      67             :     virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType )
      68             :         throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      69             : 
      70             :     /** Set the delegator.  The delegator member reference is a weak reference.
      71             : 
      72             :         @param Delegator the object that delegate its queryInterface to this aggregate.
      73             :     */
      74             :     virtual void SAL_CALL setDelegator( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > & Delegator )
      75             :         throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      76             :     /** Called by the delegator or queryInterface. Re-implement this method instead of
      77             :         queryInterface.
      78             : 
      79             :         @see queryInterface
      80             :     */
      81             :     virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type & rType )
      82             :         throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      83             : 
      84             : protected:
      85             :     /** Virtual dtor. Called when reference count is 0.
      86             : 
      87             :         @attention
      88             :         Despite the fact that a RuntimeException is allowed to be thrown, you must not throw any
      89             :         exception upon destruction!
      90             :     */
      91             :     virtual ~OWeakAggObject();
      92             : 
      93             :     /** weak reference to delegator.
      94             :     */
      95             :     ::com::sun::star::uno::WeakReferenceHelper xDelegator;
      96             : private:
      97             :     OWeakAggObject( const OWeakAggObject & rObj ) SAL_DELETED_FUNCTION;
      98             :     OWeakAggObject & operator = ( const OWeakAggObject & rObj )
      99             :         SAL_DELETED_FUNCTION;
     100             : };
     101             : 
     102             : }
     103             : 
     104             : #endif
     105             : 
     106             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11