Bump version to 5.0-14
[LibreOffice.git] / dbaccess / source / core / inc / core_resource.hxx
blob4db3848417fe0c63bdbd5c4ab396e8f463096fac
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 #ifndef INCLUDED_DBACCESS_SOURCE_CORE_INC_CORE_RESOURCE_HXX
21 #define INCLUDED_DBACCESS_SOURCE_CORE_INC_CORE_RESOURCE_HXX
23 #include <rtl/ustring.hxx>
24 #include <osl/mutex.hxx>
26 class ResMgr;
28 namespace dbaccess
31 #define DBA_RES( id ) ResourceManager::loadString( id )
32 #define DBA_RES_PARAM( id, ascii, replace ) ResourceManager::loadString( id, ascii, replace )
34 #define DBACORE_RESSTRING( id ) DBA_RES( id )
35 // (compatibility)
37 // ResourceManager
38 // handling resources within the DBA-Core library
39 class ResourceManager
41 friend class OModuleClient;
42 static sal_Int32 s_nClients; /// number of registered clients
43 static ResMgr* m_pImpl;
45 private:
46 // no instantiation allowed
47 ResourceManager() { }
48 ~ResourceManager() { }
50 protected:
51 static void ensureImplExists();
52 /// register a client for the module
53 static void registerClient();
54 /// revoke a client for the module
55 static void revokeClient();
57 public:
58 /** loads the string with the specified resource id
60 static OUString loadString(sal_uInt16 _nResId);
62 /** loads a string from the resource file, substituting a placeholder with a given string
64 @param _nResId
65 the resource ID of the string to load
66 @param _pPlaceholderAscii
67 the ASCII representation of the placeholder string
68 @param _rReplace
69 the string which should substitute the placeholder
71 static OUString loadString(
72 sal_uInt16 _nResId,
73 const sal_Char* _pPlaceholderAscii,
74 const OUString& _rReplace
77 /** loads a string from the resource file, substituting two placeholders with given strings
79 @param _nResId
80 the resource ID of the string to load
81 @param _pPlaceholderAscii1
82 the ASCII representation of the first placeholder string
83 @param _rReplace1
84 the string which should substitute the first placeholder
85 @param _pPlaceholderAscii2
86 the ASCII representation of the second placeholder string
87 @param _rReplace2
88 the string which should substitute the second placeholder
90 static OUString loadString(
91 sal_uInt16 _nResId,
92 const sal_Char* _pPlaceholderAscii1,
93 const OUString& _rReplace1,
94 const sal_Char* _pPlaceholderAscii2,
95 const OUString& _rReplace2
99 // OModuleClient
100 /** base class for objects which uses any global module-specific resources
102 class OModuleClient
104 public:
105 OModuleClient() { ResourceManager::registerClient(); }
106 ~OModuleClient() { ResourceManager::revokeClient(); }
110 #endif // INCLUDED_DBACCESS_SOURCE_CORE_INC_CORE_RESOURCE_HXX
112 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */