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

Generated by: LCOV version 1.11