LCOV - code coverage report
Current view: top level - libreoffice/sd/inc/helper - simplereferencecomponent.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 1 0.0 %
Date: 2012-12-17 Functions: 0 1 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 _SD_SIMPLEREFERENCECOMPONENT_HXX_
      21             : #define _SD_SIMPLEREFERENCECOMPONENT_HXX_
      22             : 
      23             : #include "osl/interlck.h"
      24             : #include "sal/types.h"
      25             : 
      26             : #include <cstddef>
      27             : #include <new>
      28             : 
      29             : #include <sddllapi.h>
      30             : 
      31             : namespace sd {
      32             : 
      33             : /** A simple base implementation for reference-counted components.
      34             :     acts like sal::SimpleReferenceObject but calls the virtual disposing()
      35             :     methods before the ref count switches from 1 to zero.
      36             :  */
      37             : class SimpleReferenceComponent
      38             : {
      39             : public:
      40             :     SimpleReferenceComponent();
      41             : 
      42             :     /** @ATTENTION
      43             :         The results are undefined if, for any individual instance of
      44             :         SimpleReferenceComponent, the total number of calls to acquire() exceeds
      45             :         the total number of calls to release() by a platform dependent amount
      46             :         (which, hopefully, is quite large).
      47             :      */
      48             :     SD_DLLPUBLIC void acquire();
      49             :     SD_DLLPUBLIC void release();
      50             : 
      51             :     void Dispose();
      52             : 
      53           0 :     bool isDisposed() const { return mbDisposed; }
      54             : 
      55             :     /** see general class documentation
      56             :      */
      57             :     static void * operator new(std::size_t nSize) SAL_THROW((std::bad_alloc));
      58             : 
      59             :     /** see general class documentation
      60             :      */
      61             :     static void * operator new(std::size_t nSize,
      62             :                                std::nothrow_t const & rNothrow)
      63             :        ;
      64             : 
      65             :     /** see general class documentation
      66             :      */
      67             :     static void operator delete(void * pPtr);
      68             : 
      69             :     /** see general class documentation
      70             :      */
      71             :     static void operator delete(void * pPtr, std::nothrow_t const & rNothrow)
      72             :        ;
      73             : 
      74             : protected:
      75             :     virtual void disposing();
      76             : 
      77             :     virtual ~SimpleReferenceComponent();
      78             : 
      79             : private:
      80             :     oslInterlockedCount m_nCount;
      81             : 
      82             :     /** not implemented
      83             :         @internal
      84             :      */
      85             :     SimpleReferenceComponent(SimpleReferenceComponent &);
      86             : 
      87             :     /** not implemented
      88             :         @internal
      89             :      */
      90             :     void operator =(SimpleReferenceComponent);
      91             : 
      92             :     /** not implemented (see general class documentation)
      93             :         @internal
      94             :      */
      95             :     static void * operator new[](std::size_t);
      96             : 
      97             :     /** not implemented (see general class documentation)
      98             :         @internal
      99             :      */
     100             :     static void operator delete[](void * pPtr);
     101             : 
     102             :     bool mbDisposed;
     103             : };
     104             : 
     105             : }
     106             : 
     107             : #endif // _SALHELPER_SimpleReferenceComponent_HXX_
     108             : 
     109             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10