LCOV - code coverage report
Current view: top level - include/canvas/base - disambiguationhelper.hxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 0 12 0.0 %
Date: 2015-06-13 12:38:46 Functions: 0 14 0.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             : 
      20             : #ifndef INCLUDED_CANVAS_BASE_DISAMBIGUATIONHELPER_HXX
      21             : #define INCLUDED_CANVAS_BASE_DISAMBIGUATIONHELPER_HXX
      22             : 
      23             : #include <osl/mutex.hxx>
      24             : 
      25             : 
      26             : /* Definition of the DisambiguationHelper class */
      27             : 
      28             : namespace canvas
      29             : {
      30             :     /** Base class, initializing its own baseclass with m_aMutex.
      31             : 
      32             :         This is necessary to make the CanvasBase, GraphicDeviceBase,
      33             :         etc. classes freely combinable - letting them perform this
      34             :         initialization would prohibit deriving e.g. CanvasBase from
      35             :         GraphicDeviceBase.
      36             : 
      37             :         On top of that, disambiguates XEventListener::disposing and
      38             :         WeakComponentImplHelper::disposing.
      39             : 
      40             :         Having two virtual methods with the same name, and not
      41             :         overriding them in every derived class, will hide one of
      42             :         them. Later trying to override the same method, will generate
      43             :         a new vtable slot, and lead to very hard to spot errors.
      44             :      */
      45           0 :     template< class Base > class DisambiguationHelper : public Base
      46             :     {
      47             :     protected:
      48             :         /** Construct DisambiguationHelper
      49             : 
      50             :             This method is the whole purpose of this template:
      51             :             initializing a base class with the provided m_aMutex
      52             :             member (the WeakComponentImplHelper templates need that,
      53             :             as they require the lifetime of the mutex to extend
      54             :             theirs).
      55             :          */
      56           0 :         DisambiguationHelper() :
      57           0 :             Base( m_aMutex )
      58             :         {
      59           0 :         }
      60             : 
      61           0 :         virtual void disposeThis()
      62           0 :         {}
      63           0 :         virtual void disposeEventSource( const ::com::sun::star::lang::EventObject& ) throw (::com::sun::star::uno::RuntimeException)
      64           0 :         {}
      65             : 
      66             :         mutable ::osl::Mutex m_aMutex;
      67             : 
      68             :     private:
      69           0 :         virtual void SAL_CALL disposing() SAL_OVERRIDE
      70           0 :         { disposeThis(); }
      71             : 
      72           0 :         virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw (::com::sun::star::uno::RuntimeException) SAL_OVERRIDE
      73           0 :         { disposeEventSource(Source); }
      74             : 
      75             :     };
      76             : }
      77             : 
      78             : #endif // INCLUDED_CANVAS_BASE_DISAMBIGUATIONHELPER_HXX
      79             : 
      80             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11