cid#1607171 Data race condition
[LibreOffice.git] / connectivity / source / inc / resource / sharedresources.hxx
blob0c439cdf24e378079fb0894215293cea97b5b51b
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 #pragma once
22 #include <rtl/ustring.hxx>
23 #include <vector>
24 #include <connectivity/dbtoolsdllapi.hxx>
25 #include <unotools/resmgr.hxx>
27 namespace connectivity
31 typedef sal_uInt16 ResourceId;
33 /** helper class for accessing resources shared by different libraries
34 in the connectivity module
36 class OOO_DLLPUBLIC_DBTOOLS SharedResources
38 public:
39 SharedResources();
40 ~SharedResources();
42 /** loads a string from the shared resource file
43 @param pResId
44 the resource ID of the string
45 @return
46 the string from the resource file
48 OUString
49 getResourceString(
50 TranslateId pResId
51 ) const;
53 /** loads a string from the shared resource file, and replaces
54 a given ASCII pattern with a given string
56 @param pResId
57 the resource ID of the string to load
58 @param _pAsciiPatternToReplace
59 the ASCII string which is to search in the string. Must not be <NULL/>.
60 @param _rStringToSubstitute
61 the String which should substitute the ASCII pattern.
63 @return
64 the string from the resource file, with applied string substitution
66 OUString
67 getResourceStringWithSubstitution(
68 TranslateId pResId,
69 const char* _pAsciiPatternToReplace,
70 const OUString& _rStringToSubstitute
71 ) const;
73 /** loads a string from the shared resource file, and replaces
74 a given ASCII pattern with a given string
76 @param pResId
77 the resource ID of the string to load
78 @param _pAsciiPatternToReplace1
79 the ASCII string (1) which is to search in the string. Must not be <NULL/>.
80 @param _rStringToSubstitute1
81 the String which should substitute the ASCII pattern (1)
82 @param _pAsciiPatternToReplace2
83 the ASCII string (2) which is to search in the string. Must not be <NULL/>.
84 @param _rStringToSubstitute2
85 the String which should substitute the ASCII pattern (2)
87 @return
88 the string from the resource file, with applied string substitution
90 OUString
91 getResourceStringWithSubstitution(
92 TranslateId pResId,
93 const char* _pAsciiPatternToReplace1,
94 const OUString& _rStringToSubstitute1,
95 const char* _pAsciiPatternToReplace2,
96 const OUString& _rStringToSubstitute2
97 ) const;
99 /** loads a string from the shared resource file, and replaces
100 a given ASCII pattern with a given string
102 @param pResId
103 the resource ID of the string to load
104 @param _pAsciiPatternToReplace1
105 the ASCII string (1) which is to search in the string. Must not be <NULL/>.
106 @param _rStringToSubstitute1
107 the String which should substitute the ASCII pattern (1)
108 @param _pAsciiPatternToReplace2
109 the ASCII string (2) which is to search in the string. Must not be <NULL/>.
110 @param _rStringToSubstitute2
111 the String which should substitute the ASCII pattern (2)
112 @param _pAsciiPatternToReplace3
113 the ASCII string (3) which is to search in the string. Must not be <NULL/>.
114 @param _rStringToSubstitute3
115 the String which should substitute the ASCII pattern (3)
117 @return
118 the string from the resource file, with applied string substitution
120 OUString
121 getResourceStringWithSubstitution(
122 TranslateId pResId,
123 const char* _pAsciiPatternToReplace1,
124 const OUString& _rStringToSubstitute1,
125 const char* _pAsciiPatternToReplace2,
126 const OUString& _rStringToSubstitute2,
127 const char* _pAsciiPatternToReplace3,
128 const OUString& _rStringToSubstitute3
129 ) const;
131 /** loads a string from the shared resource file, and replaces a given ASCII pattern with a given string
133 @param pResId
134 the resource ID of the string to load
135 @param _aStringToSubstitutes
136 A list of substitutions.
138 @return
139 the string from the resource file, with applied string substitution
141 OUString getResourceStringWithSubstitution( TranslateId pResId,
142 const std::vector< std::pair<const char* , OUString > >& _rStringToSubstitutes) const;
146 } // namespace connectivity
149 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */