LCOV - code coverage report
Current view: top level - usr/local/src/libreoffice/include/svtools - localresaccess.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 12 16 75.0 %
Date: 2013-07-09 Functions: 3 4 75.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 _SVTOOLS_LOCALRESACCESS_HXX_
      21             : #define _SVTOOLS_LOCALRESACCESS_HXX_
      22             : 
      23             : #include <tools/rc.hxx>
      24             : #include <tools/rcid.h>
      25             : #include <osl/diagnose.h>
      26             : 
      27             : //.........................................................................
      28             : namespace svt
      29             : {
      30             : //.........................................................................
      31             : 
      32             :     //=========================================================================
      33             :     //= OLocalResourceAccess
      34             :     //=========================================================================
      35             :     /** helper class for acessing local resources
      36             :     */
      37             :     class OLocalResourceAccess : public Resource
      38             :     {
      39             :     protected:
      40             :         ResMgr*     m_pManager;
      41             : 
      42             :     public:
      43         120 :         OLocalResourceAccess( const ResId& _rId )
      44         120 :             :Resource( _rId.SetAutoRelease( sal_False ) )
      45         120 :             ,m_pManager( _rId.GetResMgr() )
      46             :         {
      47         120 :         }
      48             : 
      49           0 :         OLocalResourceAccess(const ResId& _rId, RESOURCE_TYPE _rType)
      50           0 :             :Resource(_rId.SetRT(_rType).SetAutoRelease(sal_False))
      51           0 :             ,m_pManager(_rId.GetResMgr())
      52             :         {
      53             :             OSL_ENSURE( m_pManager != NULL, "OLocalResourceAccess::OLocalResourceAccess: invalid resource manager!" );
      54           0 :         }
      55             : 
      56         120 :         ~OLocalResourceAccess()
      57         120 :         {
      58         120 :             if ( m_pManager )
      59         120 :                 m_pManager->Increment( m_pManager->GetRemainSize() );
      60         120 :             FreeResource();
      61         120 :         }
      62             : 
      63         120 :         inline sal_Bool IsAvailableRes( const ResId& _rId ) const
      64             :         {
      65         120 :             return Resource::IsAvailableRes( _rId );
      66             :         }
      67             :     };
      68             : 
      69             : //.........................................................................
      70             : }   // namespace svt
      71             : //.........................................................................
      72             : 
      73             : #endif // _SVTOOLS_LOCALRESACCESS_HXX_
      74             : 
      75             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10