LCOV - code coverage report
Current view: top level - include/tools - rc.hxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 22 22 100.0 %
Date: 2014-11-03 Functions: 12 12 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_TOOLS_RC_HXX
      20             : #define INCLUDED_TOOLS_RC_HXX
      21             : 
      22             : #include <tools/toolsdllapi.h>
      23             : #include <i18nlangtag/lang.h>
      24             : #include <tools/resmgr.hxx>
      25             : 
      26             : class TOOLS_DLLPUBLIC Resource
      27             : {
      28             : protected:
      29             :     ResMgr* m_pResMgr;
      30             : 
      31             :     // check availability of Resource
      32       97264 :     bool                IsAvailableRes( const ResId& rId ) const
      33       97264 :         { return m_pResMgr->IsAvailable( rId, this ); }
      34             : 
      35             :     // Load a Resource
      36             :     void                GetRes( const ResId& rResId );
      37             : 
      38             :     // check Resource state
      39             : #ifdef DBG_UTIL
      40             :     void                TestRes();
      41             : #endif
      42             : 
      43             :     // Get a pointer to the Resource's data
      44       52674 :     void* GetClassRes()
      45       52674 :     { return m_pResMgr->GetClass(); }
      46             : 
      47             :     // increase the memory pointer gotten by GetClassRes()
      48       94941 :     void* IncrementRes( sal_uInt32 nBytes )
      49       94941 :     { return m_pResMgr->Increment( nBytes ); }
      50             : 
      51             :     // return the memory size of a Resource data block
      52       21276 :     static sal_uInt32   GetObjSizeRes( RSHEADER_TYPE * pHT )
      53       21276 :     { return ResMgr::GetObjSize( pHT ); }
      54             : 
      55             :     // return the remaining size of this Resource's data
      56             :     sal_uInt32 GetRemainSizeRes()
      57             :     { return m_pResMgr->GetRemainSize(); }
      58             : 
      59             :     // get a 32bit value from Resource data
      60       10002 :     static sal_Int32    GetLongRes( void * pLong )
      61       10002 :     { return ResMgr::GetLong( pLong ); }
      62             :     // get a 16bit value from Resource data
      63             :     static sal_Int16    GetShortRes( void * pShort )
      64             :     { return ResMgr::GetShort( pShort ); }
      65             : 
      66             :     // read a 32bit value from resource data and increment pointer
      67      120399 :     sal_Int32 ReadLongRes()
      68      120399 :     { return m_pResMgr->ReadLong(); }
      69             :     // read a 16bit value from resource data and increment pointer
      70       10662 :     sal_Int16 ReadShortRes()
      71       10662 :     { return m_pResMgr->ReadShort(); }
      72             :     // read a string from resource data and increment pointer
      73       22678 :     OUString ReadStringRes()
      74       22678 :     { return m_pResMgr->ReadString(); }
      75             :     // read a byte string from resource data and increment pointer
      76       13996 :     OString ReadByteStringRes()
      77       13996 :     { return m_pResMgr->ReadByteString(); }
      78             : 
      79             :     // free the resource from m_pResMgr's stack (pass this ptr for validation)
      80       43018 :     void FreeResource()
      81       43018 :     { m_pResMgr->PopContext( this ); }
      82             : 
      83             :     // constructors
      84      588603 :     Resource() : m_pResMgr( NULL ) {}
      85             :     Resource( const ResId& rResId );
      86             : 
      87             : public:
      88             : #ifdef DBG_UTIL
      89             :     ~Resource() { TestRes(); }
      90             : #else
      91      627407 :     ~Resource() {}
      92             : #endif
      93             : };
      94             : 
      95             : #endif
      96             : 
      97             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10