LCOV - code coverage report
Current view: top level - usr/local/src/libreoffice/include/tools - simplerm.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 1 1 100.0 %
Date: 2013-07-09 Functions: 1 1 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             : // a simple resource manager : no stacks, no sharing of the impl class, only loading of strings and blobs
      21             : // but thread-safety !! :)
      22             : 
      23             : #ifndef _TOOLS_SIMPLERESMGR_HXX_
      24             : #define _TOOLS_SIMPLERESMGR_HXX_
      25             : 
      26             : #include <osl/mutex.hxx>
      27             : #include <tools/resid.hxx>
      28             : #include <i18nlangtag/languagetag.hxx>
      29             : #include <tools/string.hxx>
      30             : #include "tools/toolsdllapi.h"
      31             : 
      32             : class InternalResMgr;
      33             : 
      34             : class TOOLS_DLLPUBLIC SimpleResMgr
      35             : {
      36             : protected:
      37             :     osl::Mutex              m_aAccessSafety;
      38             :     InternalResMgr*         m_pResImpl;
      39             : 
      40             : public:
      41             :                             /** creates a new SimpleResManager
      42             :                                 @param pPrefixName
      43             :                                     denotes the prefix of the resource file name,
      44             :                                     in ThreadTextEncoding
      45             :                                 @param rLocale
      46             :                                     denotes the locale of the resource file to
      47             :                                     load. If empty (SYSTEM), a default locale will be used.
      48             :                             */
      49             :                             SimpleResMgr( const sal_Char* pPrefixName,
      50             :                                           const LanguageTag& rLocale);
      51             : 
      52             :     virtual                 ~SimpleResMgr();
      53             : 
      54             :     static SimpleResMgr*    Create( const sal_Char* pPrefixName,
      55             :                                     LanguageTag aLocale = LanguageTag( LANGUAGE_SYSTEM) );// only in VCL
      56             : 
      57           3 :     bool                    IsValid() const { return m_pResImpl != NULL; }
      58             : 
      59             :     /** reads the string with the given resource id
      60             :         @param  nId
      61             :             the resource id of the string to read
      62             :         @return
      63             :             the string with the given resource id, or an empty string if the id does not denote
      64             :             an existent string
      65             :         @seealso IsAvailable
      66             :     */
      67             :     OUString           ReadString( sal_uInt32 nId );
      68             : 
      69             :     /** checks whether a certain resource is availble
      70             :         @param  _resourceType
      71             :             the type of the resource to check. Currently, only RSC_STRING (strings) and RSC_RESOURCE (blobs)
      72             :             are supported, for every other type, <FALSE/> will be returned.
      73             :         @param  _resourceId
      74             :             the id of the resource to lookup.
      75             :         @return
      76             :             <TRUE/> if and only if a resource of the given type, with the given id, is available.
      77             :     */
      78             :     bool                    IsAvailable( RESOURCE_TYPE _resourceType, sal_uInt32 _resourceId );
      79             : };
      80             : 
      81             : #endif
      82             : 
      83             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10