1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 // a simple resource manager : no stacks, no sharing of the impl class, only loading of strings and blobs
21 // but thread-safety !! :)
23 #ifndef INCLUDED_TOOLS_SIMPLERM_HXX
24 #define INCLUDED_TOOLS_SIMPLERM_HXX
26 #include <osl/mutex.hxx>
27 #include <tools/resid.hxx>
28 #include <i18nlangtag/languagetag.hxx>
29 #include <tools/toolsdllapi.h>
34 class SAL_WARN_UNUSED TOOLS_DLLPUBLIC SimpleResMgr final
36 osl::Mutex m_aAccessSafety
;
37 std::unique_ptr
<InternalResMgr
>
41 /** creates a new SimpleResManager
43 denotes the prefix of the resource file name,
46 denotes the locale of the resource file to
47 load. If empty (SYSTEM), a default locale will be used.
49 SimpleResMgr( const sal_Char
* pPrefixName
,
50 const LanguageTag
& rLocale
);
54 static SimpleResMgr
* Create( const sal_Char
* pPrefixName
,
55 const LanguageTag
& rLocale
);// only in VCL
57 bool IsValid() const { return m_pResImpl
!= nullptr; }
59 /** reads the string with the given resource id
61 the resource id of the string to read
63 the string with the given resource id, or an empty string if the id does not denote
67 OUString
ReadString( sal_uInt32 nId
);
69 /** checks whether a certain resource is available
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.
74 the id of the resource to lookup.
76 <TRUE/> if and only if a resource of the given type, with the given id, is available.
78 bool IsAvailable( RESOURCE_TYPE _resourceType
, sal_uInt32 _resourceId
);
83 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */