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

Generated by: LCOV version 1.10