LCOV - code coverage report
Current view: top level - tools/source/rc - rc.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 24 28 85.7 %
Date: 2015-06-13 12:38:46 Functions: 3 3 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             : 
      20             : #include <string.h>
      21             : #include <rtl/ustrbuf.hxx>
      22             : #include <tools/date.hxx>
      23             : #include <tools/time.hxx>
      24             : #include <tools/rc.hxx>
      25             : #include <tools/rcid.h>
      26             : 
      27       34833 : Resource::Resource( const ResId& rResId )
      28       34833 :     : m_pResMgr(NULL)
      29             : {
      30       34833 :     GetRes( rResId.SetRT( RSC_RESOURCE ) );
      31       34833 : }
      32             : 
      33       47793 : void Resource::GetRes( const ResId& rResId )
      34             : {
      35       47793 :     if( rResId.GetResMgr() )
      36       47793 :         m_pResMgr = rResId.GetResMgr();
      37             :     assert(m_pResMgr);
      38       47793 :     m_pResMgr->GetResource( rResId, this );
      39       47793 :     IncrementRes( sizeof( RSHEADER_TYPE ) );
      40       47793 : }
      41             : 
      42     1432504 : OUString ResId::toString() const
      43             : {
      44     1432504 :     SetRT( RSC_STRING );
      45     1432504 :     ResMgr* pResMgr = GetResMgr();
      46             : 
      47     1432504 :     if ( !pResMgr || !pResMgr->GetResource( *this ) )
      48             :     {
      49           0 :         OUString sRet;
      50             : 
      51             : #if OSL_DEBUG_LEVEL > 0
      52             :         sRet = OUStringBuffer().
      53             :             append("<resource id ").
      54             :             append(static_cast<sal_Int32>(GetId())).
      55             :             append(" not found>").
      56             :             makeStringAndClear();
      57             : #endif
      58             : 
      59           0 :         if( pResMgr )
      60           0 :             pResMgr->PopContext();
      61             : 
      62           0 :         return sRet;
      63             :     }
      64             : 
      65             :     // String loading
      66     1432504 :     RSHEADER_TYPE * pResHdr = static_cast<RSHEADER_TYPE*>(pResMgr->GetClass());
      67             : 
      68     1432504 :     sal_Int32 nStringLen = rtl_str_getLength( reinterpret_cast<char*>(pResHdr+1) );
      69     1432504 :     OUString sRet(reinterpret_cast<char*>(pResHdr+1), nStringLen, RTL_TEXTENCODING_UTF8);
      70             : 
      71             :     sal_uInt32 nSize = sizeof( RSHEADER_TYPE )
      72     1432504 :         + sal::static_int_cast< sal_uInt32 >(nStringLen) + 1;
      73     1432504 :     nSize += nSize % 2;
      74     1432504 :     pResMgr->Increment( nSize );
      75             : 
      76     1432504 :     ResHookProc pImplResHookProc = ResMgr::GetReadStringHook();
      77     1432504 :     if ( pImplResHookProc )
      78      413140 :         sRet = pImplResHookProc(sRet);
      79     1432504 :     return sRet;
      80             : }
      81             : 
      82             : 
      83             : 
      84             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11