jpayne@69
|
1 // © 2016 and later: Unicode, Inc. and others.
|
jpayne@69
|
2 // License & terms of use: http://www.unicode.org/copyright.html
|
jpayne@69
|
3 /*
|
jpayne@69
|
4 ******************************************************************************
|
jpayne@69
|
5 *
|
jpayne@69
|
6 * Copyright (C) 1996-2013, International Business Machines Corporation
|
jpayne@69
|
7 * and others. All Rights Reserved.
|
jpayne@69
|
8 *
|
jpayne@69
|
9 ******************************************************************************
|
jpayne@69
|
10 *
|
jpayne@69
|
11 * File resbund.h
|
jpayne@69
|
12 *
|
jpayne@69
|
13 * CREATED BY
|
jpayne@69
|
14 * Richard Gillam
|
jpayne@69
|
15 *
|
jpayne@69
|
16 * Modification History:
|
jpayne@69
|
17 *
|
jpayne@69
|
18 * Date Name Description
|
jpayne@69
|
19 * 2/5/97 aliu Added scanForLocaleInFile. Added
|
jpayne@69
|
20 * constructor which attempts to read resource bundle
|
jpayne@69
|
21 * from a specific file, without searching other files.
|
jpayne@69
|
22 * 2/11/97 aliu Added UErrorCode return values to constructors. Fixed
|
jpayne@69
|
23 * infinite loops in scanForFile and scanForLocale.
|
jpayne@69
|
24 * Modified getRawResourceData to not delete storage
|
jpayne@69
|
25 * in localeData and resourceData which it doesn't own.
|
jpayne@69
|
26 * Added Mac compatibility #ifdefs for tellp() and
|
jpayne@69
|
27 * ios::nocreate.
|
jpayne@69
|
28 * 2/18/97 helena Updated with 100% documentation coverage.
|
jpayne@69
|
29 * 3/13/97 aliu Rewrote to load in entire resource bundle and store
|
jpayne@69
|
30 * it as a Hashtable of ResourceBundleData objects.
|
jpayne@69
|
31 * Added state table to govern parsing of files.
|
jpayne@69
|
32 * Modified to load locale index out of new file
|
jpayne@69
|
33 * distinct from default.txt.
|
jpayne@69
|
34 * 3/25/97 aliu Modified to support 2-d arrays, needed for timezone
|
jpayne@69
|
35 * data. Added support for custom file suffixes. Again,
|
jpayne@69
|
36 * needed to support timezone data.
|
jpayne@69
|
37 * 4/7/97 aliu Cleaned up.
|
jpayne@69
|
38 * 03/02/99 stephen Removed dependency on FILE*.
|
jpayne@69
|
39 * 03/29/99 helena Merged Bertrand and Stephen's changes.
|
jpayne@69
|
40 * 06/11/99 stephen Removed parsing of .txt files.
|
jpayne@69
|
41 * Reworked to use new binary format.
|
jpayne@69
|
42 * Cleaned up.
|
jpayne@69
|
43 * 06/14/99 stephen Removed methods taking a filename suffix.
|
jpayne@69
|
44 * 11/09/99 weiv Added getLocale(), fRealLocale, removed fRealLocaleID
|
jpayne@69
|
45 ******************************************************************************
|
jpayne@69
|
46 */
|
jpayne@69
|
47
|
jpayne@69
|
48 #ifndef RESBUND_H
|
jpayne@69
|
49 #define RESBUND_H
|
jpayne@69
|
50
|
jpayne@69
|
51 #include "unicode/utypes.h"
|
jpayne@69
|
52
|
jpayne@69
|
53 #if U_SHOW_CPLUSPLUS_API
|
jpayne@69
|
54
|
jpayne@69
|
55 #include "unicode/uobject.h"
|
jpayne@69
|
56 #include "unicode/ures.h"
|
jpayne@69
|
57 #include "unicode/unistr.h"
|
jpayne@69
|
58 #include "unicode/locid.h"
|
jpayne@69
|
59
|
jpayne@69
|
60 /**
|
jpayne@69
|
61 * \file
|
jpayne@69
|
62 * \brief C++ API: Resource Bundle
|
jpayne@69
|
63 */
|
jpayne@69
|
64
|
jpayne@69
|
65 U_NAMESPACE_BEGIN
|
jpayne@69
|
66
|
jpayne@69
|
67 /**
|
jpayne@69
|
68 * A class representing a collection of resource information pertaining to a given
|
jpayne@69
|
69 * locale. A resource bundle provides a way of accessing locale- specfic information in
|
jpayne@69
|
70 * a data file. You create a resource bundle that manages the resources for a given
|
jpayne@69
|
71 * locale and then ask it for individual resources.
|
jpayne@69
|
72 * <P>
|
jpayne@69
|
73 * Resource bundles in ICU4C are currently defined using text files which conform to the following
|
jpayne@69
|
74 * <a href="http://source.icu-project.org/repos/icu/icuhtml/trunk/design/bnf_rb.txt">BNF definition</a>.
|
jpayne@69
|
75 * More on resource bundle concepts and syntax can be found in the
|
jpayne@69
|
76 * <a href="http://icu-project.org/userguide/ResourceManagement.html">Users Guide</a>.
|
jpayne@69
|
77 * <P>
|
jpayne@69
|
78 *
|
jpayne@69
|
79 * The ResourceBundle class is not suitable for subclassing.
|
jpayne@69
|
80 *
|
jpayne@69
|
81 * @stable ICU 2.0
|
jpayne@69
|
82 */
|
jpayne@69
|
83 class U_COMMON_API ResourceBundle : public UObject {
|
jpayne@69
|
84 public:
|
jpayne@69
|
85 /**
|
jpayne@69
|
86 * Constructor
|
jpayne@69
|
87 *
|
jpayne@69
|
88 * @param packageName The packageName and locale together point to an ICU udata object,
|
jpayne@69
|
89 * as defined by <code> udata_open( packageName, "res", locale, err) </code>
|
jpayne@69
|
90 * or equivalent. Typically, packageName will refer to a (.dat) file, or to
|
jpayne@69
|
91 * a package registered with udata_setAppData(). Using a full file or directory
|
jpayne@69
|
92 * pathname for packageName is deprecated.
|
jpayne@69
|
93 * @param locale This is the locale this resource bundle is for. To get resources
|
jpayne@69
|
94 * for the French locale, for example, you would create a
|
jpayne@69
|
95 * ResourceBundle passing Locale::FRENCH for the "locale" parameter,
|
jpayne@69
|
96 * and all subsequent calls to that resource bundle will return
|
jpayne@69
|
97 * resources that pertain to the French locale. If the caller doesn't
|
jpayne@69
|
98 * pass a locale parameter, the default locale for the system (as
|
jpayne@69
|
99 * returned by Locale::getDefault()) will be used.
|
jpayne@69
|
100 * @param err The Error Code.
|
jpayne@69
|
101 * The UErrorCode& err parameter is used to return status information to the user. To
|
jpayne@69
|
102 * check whether the construction succeeded or not, you should check the value of
|
jpayne@69
|
103 * U_SUCCESS(err). If you wish more detailed information, you can check for
|
jpayne@69
|
104 * informational error results which still indicate success. U_USING_FALLBACK_WARNING
|
jpayne@69
|
105 * indicates that a fall back locale was used. For example, 'de_CH' was requested,
|
jpayne@69
|
106 * but nothing was found there, so 'de' was used. U_USING_DEFAULT_WARNING indicates that
|
jpayne@69
|
107 * the default locale data was used; neither the requested locale nor any of its
|
jpayne@69
|
108 * fall back locales could be found.
|
jpayne@69
|
109 * @stable ICU 2.0
|
jpayne@69
|
110 */
|
jpayne@69
|
111 ResourceBundle(const UnicodeString& packageName,
|
jpayne@69
|
112 const Locale& locale,
|
jpayne@69
|
113 UErrorCode& err);
|
jpayne@69
|
114
|
jpayne@69
|
115 /**
|
jpayne@69
|
116 * Construct a resource bundle for the default bundle in the specified package.
|
jpayne@69
|
117 *
|
jpayne@69
|
118 * @param packageName The packageName and locale together point to an ICU udata object,
|
jpayne@69
|
119 * as defined by <code> udata_open( packageName, "res", locale, err) </code>
|
jpayne@69
|
120 * or equivalent. Typically, packageName will refer to a (.dat) file, or to
|
jpayne@69
|
121 * a package registered with udata_setAppData(). Using a full file or directory
|
jpayne@69
|
122 * pathname for packageName is deprecated.
|
jpayne@69
|
123 * @param err A UErrorCode value
|
jpayne@69
|
124 * @stable ICU 2.0
|
jpayne@69
|
125 */
|
jpayne@69
|
126 ResourceBundle(const UnicodeString& packageName,
|
jpayne@69
|
127 UErrorCode& err);
|
jpayne@69
|
128
|
jpayne@69
|
129 /**
|
jpayne@69
|
130 * Construct a resource bundle for the ICU default bundle.
|
jpayne@69
|
131 *
|
jpayne@69
|
132 * @param err A UErrorCode value
|
jpayne@69
|
133 * @stable ICU 2.0
|
jpayne@69
|
134 */
|
jpayne@69
|
135 ResourceBundle(UErrorCode &err);
|
jpayne@69
|
136
|
jpayne@69
|
137 /**
|
jpayne@69
|
138 * Standard constructor, constructs a resource bundle for the locale-specific
|
jpayne@69
|
139 * bundle in the specified package.
|
jpayne@69
|
140 *
|
jpayne@69
|
141 * @param packageName The packageName and locale together point to an ICU udata object,
|
jpayne@69
|
142 * as defined by <code> udata_open( packageName, "res", locale, err) </code>
|
jpayne@69
|
143 * or equivalent. Typically, packageName will refer to a (.dat) file, or to
|
jpayne@69
|
144 * a package registered with udata_setAppData(). Using a full file or directory
|
jpayne@69
|
145 * pathname for packageName is deprecated.
|
jpayne@69
|
146 * NULL is used to refer to ICU data.
|
jpayne@69
|
147 * @param locale The locale for which to open a resource bundle.
|
jpayne@69
|
148 * @param err A UErrorCode value
|
jpayne@69
|
149 * @stable ICU 2.0
|
jpayne@69
|
150 */
|
jpayne@69
|
151 ResourceBundle(const char* packageName,
|
jpayne@69
|
152 const Locale& locale,
|
jpayne@69
|
153 UErrorCode& err);
|
jpayne@69
|
154
|
jpayne@69
|
155 /**
|
jpayne@69
|
156 * Copy constructor.
|
jpayne@69
|
157 *
|
jpayne@69
|
158 * @param original The resource bundle to copy.
|
jpayne@69
|
159 * @stable ICU 2.0
|
jpayne@69
|
160 */
|
jpayne@69
|
161 ResourceBundle(const ResourceBundle &original);
|
jpayne@69
|
162
|
jpayne@69
|
163 /**
|
jpayne@69
|
164 * Constructor from a C UResourceBundle. The resource bundle is
|
jpayne@69
|
165 * copied and not adopted. ures_close will still need to be used on the
|
jpayne@69
|
166 * original resource bundle.
|
jpayne@69
|
167 *
|
jpayne@69
|
168 * @param res A pointer to the C resource bundle.
|
jpayne@69
|
169 * @param status A UErrorCode value.
|
jpayne@69
|
170 * @stable ICU 2.0
|
jpayne@69
|
171 */
|
jpayne@69
|
172 ResourceBundle(UResourceBundle *res,
|
jpayne@69
|
173 UErrorCode &status);
|
jpayne@69
|
174
|
jpayne@69
|
175 /**
|
jpayne@69
|
176 * Assignment operator.
|
jpayne@69
|
177 *
|
jpayne@69
|
178 * @param other The resource bundle to copy.
|
jpayne@69
|
179 * @stable ICU 2.0
|
jpayne@69
|
180 */
|
jpayne@69
|
181 ResourceBundle&
|
jpayne@69
|
182 operator=(const ResourceBundle& other);
|
jpayne@69
|
183
|
jpayne@69
|
184 /** Destructor.
|
jpayne@69
|
185 * @stable ICU 2.0
|
jpayne@69
|
186 */
|
jpayne@69
|
187 virtual ~ResourceBundle();
|
jpayne@69
|
188
|
jpayne@69
|
189 /**
|
jpayne@69
|
190 * Clone this object.
|
jpayne@69
|
191 * Clones can be used concurrently in multiple threads.
|
jpayne@69
|
192 * If an error occurs, then NULL is returned.
|
jpayne@69
|
193 * The caller must delete the clone.
|
jpayne@69
|
194 *
|
jpayne@69
|
195 * @return a clone of this object
|
jpayne@69
|
196 *
|
jpayne@69
|
197 * @see getDynamicClassID
|
jpayne@69
|
198 * @stable ICU 2.8
|
jpayne@69
|
199 */
|
jpayne@69
|
200 ResourceBundle *clone() const;
|
jpayne@69
|
201
|
jpayne@69
|
202 /**
|
jpayne@69
|
203 * Returns the size of a resource. Size for scalar types is always 1, and for vector/table types is
|
jpayne@69
|
204 * the number of child resources.
|
jpayne@69
|
205 * @warning Integer array is treated as a scalar type. There are no
|
jpayne@69
|
206 * APIs to access individual members of an integer array. It
|
jpayne@69
|
207 * is always returned as a whole.
|
jpayne@69
|
208 *
|
jpayne@69
|
209 * @return number of resources in a given resource.
|
jpayne@69
|
210 * @stable ICU 2.0
|
jpayne@69
|
211 */
|
jpayne@69
|
212 int32_t
|
jpayne@69
|
213 getSize(void) const;
|
jpayne@69
|
214
|
jpayne@69
|
215 /**
|
jpayne@69
|
216 * returns a string from a string resource type
|
jpayne@69
|
217 *
|
jpayne@69
|
218 * @param status fills in the outgoing error code
|
jpayne@69
|
219 * could be <TT>U_MISSING_RESOURCE_ERROR</TT> if the key is not found
|
jpayne@69
|
220 * could be a warning
|
jpayne@69
|
221 * e.g.: <TT>U_USING_FALLBACK_WARNING</TT>,<TT>U_USING_DEFAULT_WARNING </TT>
|
jpayne@69
|
222 * @return a pointer to a zero-terminated char16_t array which lives in a memory mapped/DLL file.
|
jpayne@69
|
223 * @stable ICU 2.0
|
jpayne@69
|
224 */
|
jpayne@69
|
225 UnicodeString
|
jpayne@69
|
226 getString(UErrorCode& status) const;
|
jpayne@69
|
227
|
jpayne@69
|
228 /**
|
jpayne@69
|
229 * returns a binary data from a resource. Can be used at most primitive resource types (binaries,
|
jpayne@69
|
230 * strings, ints)
|
jpayne@69
|
231 *
|
jpayne@69
|
232 * @param len fills in the length of resulting byte chunk
|
jpayne@69
|
233 * @param status fills in the outgoing error code
|
jpayne@69
|
234 * could be <TT>U_MISSING_RESOURCE_ERROR</TT> if the key is not found
|
jpayne@69
|
235 * could be a warning
|
jpayne@69
|
236 * e.g.: <TT>U_USING_FALLBACK_WARNING</TT>,<TT>U_USING_DEFAULT_WARNING </TT>
|
jpayne@69
|
237 * @return a pointer to a chunk of unsigned bytes which live in a memory mapped/DLL file.
|
jpayne@69
|
238 * @stable ICU 2.0
|
jpayne@69
|
239 */
|
jpayne@69
|
240 const uint8_t*
|
jpayne@69
|
241 getBinary(int32_t& len, UErrorCode& status) const;
|
jpayne@69
|
242
|
jpayne@69
|
243
|
jpayne@69
|
244 /**
|
jpayne@69
|
245 * returns an integer vector from a resource.
|
jpayne@69
|
246 *
|
jpayne@69
|
247 * @param len fills in the length of resulting integer vector
|
jpayne@69
|
248 * @param status fills in the outgoing error code
|
jpayne@69
|
249 * could be <TT>U_MISSING_RESOURCE_ERROR</TT> if the key is not found
|
jpayne@69
|
250 * could be a warning
|
jpayne@69
|
251 * e.g.: <TT>U_USING_FALLBACK_WARNING</TT>,<TT>U_USING_DEFAULT_WARNING </TT>
|
jpayne@69
|
252 * @return a pointer to a vector of integers that lives in a memory mapped/DLL file.
|
jpayne@69
|
253 * @stable ICU 2.0
|
jpayne@69
|
254 */
|
jpayne@69
|
255 const int32_t*
|
jpayne@69
|
256 getIntVector(int32_t& len, UErrorCode& status) const;
|
jpayne@69
|
257
|
jpayne@69
|
258 /**
|
jpayne@69
|
259 * returns an unsigned integer from a resource.
|
jpayne@69
|
260 * This integer is originally 28 bits.
|
jpayne@69
|
261 *
|
jpayne@69
|
262 * @param status fills in the outgoing error code
|
jpayne@69
|
263 * could be <TT>U_MISSING_RESOURCE_ERROR</TT> if the key is not found
|
jpayne@69
|
264 * could be a warning
|
jpayne@69
|
265 * e.g.: <TT>U_USING_FALLBACK_WARNING</TT>,<TT>U_USING_DEFAULT_WARNING </TT>
|
jpayne@69
|
266 * @return an unsigned integer value
|
jpayne@69
|
267 * @stable ICU 2.0
|
jpayne@69
|
268 */
|
jpayne@69
|
269 uint32_t
|
jpayne@69
|
270 getUInt(UErrorCode& status) const;
|
jpayne@69
|
271
|
jpayne@69
|
272 /**
|
jpayne@69
|
273 * returns a signed integer from a resource.
|
jpayne@69
|
274 * This integer is originally 28 bit and the sign gets propagated.
|
jpayne@69
|
275 *
|
jpayne@69
|
276 * @param status fills in the outgoing error code
|
jpayne@69
|
277 * could be <TT>U_MISSING_RESOURCE_ERROR</TT> if the key is not found
|
jpayne@69
|
278 * could be a warning
|
jpayne@69
|
279 * e.g.: <TT>U_USING_FALLBACK_WARNING</TT>,<TT>U_USING_DEFAULT_WARNING </TT>
|
jpayne@69
|
280 * @return a signed integer value
|
jpayne@69
|
281 * @stable ICU 2.0
|
jpayne@69
|
282 */
|
jpayne@69
|
283 int32_t
|
jpayne@69
|
284 getInt(UErrorCode& status) const;
|
jpayne@69
|
285
|
jpayne@69
|
286 /**
|
jpayne@69
|
287 * Checks whether the resource has another element to iterate over.
|
jpayne@69
|
288 *
|
jpayne@69
|
289 * @return TRUE if there are more elements, FALSE if there is no more elements
|
jpayne@69
|
290 * @stable ICU 2.0
|
jpayne@69
|
291 */
|
jpayne@69
|
292 UBool
|
jpayne@69
|
293 hasNext(void) const;
|
jpayne@69
|
294
|
jpayne@69
|
295 /**
|
jpayne@69
|
296 * Resets the internal context of a resource so that iteration starts from the first element.
|
jpayne@69
|
297 *
|
jpayne@69
|
298 * @stable ICU 2.0
|
jpayne@69
|
299 */
|
jpayne@69
|
300 void
|
jpayne@69
|
301 resetIterator(void);
|
jpayne@69
|
302
|
jpayne@69
|
303 /**
|
jpayne@69
|
304 * Returns the key associated with this resource. Not all the resources have a key - only
|
jpayne@69
|
305 * those that are members of a table.
|
jpayne@69
|
306 *
|
jpayne@69
|
307 * @return a key associated to this resource, or NULL if it doesn't have a key
|
jpayne@69
|
308 * @stable ICU 2.0
|
jpayne@69
|
309 */
|
jpayne@69
|
310 const char*
|
jpayne@69
|
311 getKey(void) const;
|
jpayne@69
|
312
|
jpayne@69
|
313 /**
|
jpayne@69
|
314 * Gets the locale ID of the resource bundle as a string.
|
jpayne@69
|
315 * Same as getLocale().getName() .
|
jpayne@69
|
316 *
|
jpayne@69
|
317 * @return the locale ID of the resource bundle as a string
|
jpayne@69
|
318 * @stable ICU 2.0
|
jpayne@69
|
319 */
|
jpayne@69
|
320 const char*
|
jpayne@69
|
321 getName(void) const;
|
jpayne@69
|
322
|
jpayne@69
|
323
|
jpayne@69
|
324 /**
|
jpayne@69
|
325 * Returns the type of a resource. Available types are defined in enum UResType
|
jpayne@69
|
326 *
|
jpayne@69
|
327 * @return type of the given resource.
|
jpayne@69
|
328 * @stable ICU 2.0
|
jpayne@69
|
329 */
|
jpayne@69
|
330 UResType
|
jpayne@69
|
331 getType(void) const;
|
jpayne@69
|
332
|
jpayne@69
|
333 /**
|
jpayne@69
|
334 * Returns the next resource in a given resource or NULL if there are no more resources
|
jpayne@69
|
335 *
|
jpayne@69
|
336 * @param status fills in the outgoing error code
|
jpayne@69
|
337 * @return ResourceBundle object.
|
jpayne@69
|
338 * @stable ICU 2.0
|
jpayne@69
|
339 */
|
jpayne@69
|
340 ResourceBundle
|
jpayne@69
|
341 getNext(UErrorCode& status);
|
jpayne@69
|
342
|
jpayne@69
|
343 /**
|
jpayne@69
|
344 * Returns the next string in a resource or NULL if there are no more resources
|
jpayne@69
|
345 * to iterate over.
|
jpayne@69
|
346 *
|
jpayne@69
|
347 * @param status fills in the outgoing error code
|
jpayne@69
|
348 * @return an UnicodeString object.
|
jpayne@69
|
349 * @stable ICU 2.0
|
jpayne@69
|
350 */
|
jpayne@69
|
351 UnicodeString
|
jpayne@69
|
352 getNextString(UErrorCode& status);
|
jpayne@69
|
353
|
jpayne@69
|
354 /**
|
jpayne@69
|
355 * Returns the next string in a resource or NULL if there are no more resources
|
jpayne@69
|
356 * to iterate over.
|
jpayne@69
|
357 *
|
jpayne@69
|
358 * @param key fill in for key associated with this string
|
jpayne@69
|
359 * @param status fills in the outgoing error code
|
jpayne@69
|
360 * @return an UnicodeString object.
|
jpayne@69
|
361 * @stable ICU 2.0
|
jpayne@69
|
362 */
|
jpayne@69
|
363 UnicodeString
|
jpayne@69
|
364 getNextString(const char ** key,
|
jpayne@69
|
365 UErrorCode& status);
|
jpayne@69
|
366
|
jpayne@69
|
367 /**
|
jpayne@69
|
368 * Returns the resource in a resource at the specified index.
|
jpayne@69
|
369 *
|
jpayne@69
|
370 * @param index an index to the wanted resource.
|
jpayne@69
|
371 * @param status fills in the outgoing error code
|
jpayne@69
|
372 * @return ResourceBundle object. If there is an error, resource is invalid.
|
jpayne@69
|
373 * @stable ICU 2.0
|
jpayne@69
|
374 */
|
jpayne@69
|
375 ResourceBundle
|
jpayne@69
|
376 get(int32_t index,
|
jpayne@69
|
377 UErrorCode& status) const;
|
jpayne@69
|
378
|
jpayne@69
|
379 /**
|
jpayne@69
|
380 * Returns the string in a given resource at the specified index.
|
jpayne@69
|
381 *
|
jpayne@69
|
382 * @param index an index to the wanted string.
|
jpayne@69
|
383 * @param status fills in the outgoing error code
|
jpayne@69
|
384 * @return an UnicodeString object. If there is an error, string is bogus
|
jpayne@69
|
385 * @stable ICU 2.0
|
jpayne@69
|
386 */
|
jpayne@69
|
387 UnicodeString
|
jpayne@69
|
388 getStringEx(int32_t index,
|
jpayne@69
|
389 UErrorCode& status) const;
|
jpayne@69
|
390
|
jpayne@69
|
391 /**
|
jpayne@69
|
392 * Returns a resource in a resource that has a given key. This procedure works only with table
|
jpayne@69
|
393 * resources.
|
jpayne@69
|
394 *
|
jpayne@69
|
395 * @param key a key associated with the wanted resource
|
jpayne@69
|
396 * @param status fills in the outgoing error code.
|
jpayne@69
|
397 * @return ResourceBundle object. If there is an error, resource is invalid.
|
jpayne@69
|
398 * @stable ICU 2.0
|
jpayne@69
|
399 */
|
jpayne@69
|
400 ResourceBundle
|
jpayne@69
|
401 get(const char* key,
|
jpayne@69
|
402 UErrorCode& status) const;
|
jpayne@69
|
403
|
jpayne@69
|
404 /**
|
jpayne@69
|
405 * Returns a string in a resource that has a given key. This procedure works only with table
|
jpayne@69
|
406 * resources.
|
jpayne@69
|
407 *
|
jpayne@69
|
408 * @param key a key associated with the wanted string
|
jpayne@69
|
409 * @param status fills in the outgoing error code
|
jpayne@69
|
410 * @return an UnicodeString object. If there is an error, string is bogus
|
jpayne@69
|
411 * @stable ICU 2.0
|
jpayne@69
|
412 */
|
jpayne@69
|
413 UnicodeString
|
jpayne@69
|
414 getStringEx(const char* key,
|
jpayne@69
|
415 UErrorCode& status) const;
|
jpayne@69
|
416
|
jpayne@69
|
417 #ifndef U_HIDE_DEPRECATED_API
|
jpayne@69
|
418 /**
|
jpayne@69
|
419 * Return the version number associated with this ResourceBundle as a string. Please
|
jpayne@69
|
420 * use getVersion, as this method is going to be deprecated.
|
jpayne@69
|
421 *
|
jpayne@69
|
422 * @return A version number string as specified in the resource bundle or its parent.
|
jpayne@69
|
423 * The caller does not own this string.
|
jpayne@69
|
424 * @see getVersion
|
jpayne@69
|
425 * @deprecated ICU 2.8 Use getVersion instead.
|
jpayne@69
|
426 */
|
jpayne@69
|
427 const char*
|
jpayne@69
|
428 getVersionNumber(void) const;
|
jpayne@69
|
429 #endif /* U_HIDE_DEPRECATED_API */
|
jpayne@69
|
430
|
jpayne@69
|
431 /**
|
jpayne@69
|
432 * Return the version number associated with this ResourceBundle as a UVersionInfo array.
|
jpayne@69
|
433 *
|
jpayne@69
|
434 * @param versionInfo A UVersionInfo array that is filled with the version number
|
jpayne@69
|
435 * as specified in the resource bundle or its parent.
|
jpayne@69
|
436 * @stable ICU 2.0
|
jpayne@69
|
437 */
|
jpayne@69
|
438 void
|
jpayne@69
|
439 getVersion(UVersionInfo versionInfo) const;
|
jpayne@69
|
440
|
jpayne@69
|
441 #ifndef U_HIDE_DEPRECATED_API
|
jpayne@69
|
442 /**
|
jpayne@69
|
443 * Return the Locale associated with this ResourceBundle.
|
jpayne@69
|
444 *
|
jpayne@69
|
445 * @return a Locale object
|
jpayne@69
|
446 * @deprecated ICU 2.8 Use getLocale(ULocDataLocaleType type, UErrorCode &status) overload instead.
|
jpayne@69
|
447 */
|
jpayne@69
|
448 const Locale&
|
jpayne@69
|
449 getLocale(void) const;
|
jpayne@69
|
450 #endif /* U_HIDE_DEPRECATED_API */
|
jpayne@69
|
451
|
jpayne@69
|
452 /**
|
jpayne@69
|
453 * Return the Locale associated with this ResourceBundle.
|
jpayne@69
|
454 * @param type You can choose between requested, valid and actual
|
jpayne@69
|
455 * locale. For description see the definition of
|
jpayne@69
|
456 * ULocDataLocaleType in uloc.h
|
jpayne@69
|
457 * @param status just for catching illegal arguments
|
jpayne@69
|
458 *
|
jpayne@69
|
459 * @return a Locale object
|
jpayne@69
|
460 * @stable ICU 2.8
|
jpayne@69
|
461 */
|
jpayne@69
|
462 const Locale
|
jpayne@69
|
463 getLocale(ULocDataLocaleType type, UErrorCode &status) const;
|
jpayne@69
|
464 #ifndef U_HIDE_INTERNAL_API
|
jpayne@69
|
465 /**
|
jpayne@69
|
466 * This API implements multilevel fallback
|
jpayne@69
|
467 * @internal
|
jpayne@69
|
468 */
|
jpayne@69
|
469 ResourceBundle
|
jpayne@69
|
470 getWithFallback(const char* key, UErrorCode& status);
|
jpayne@69
|
471 #endif /* U_HIDE_INTERNAL_API */
|
jpayne@69
|
472 /**
|
jpayne@69
|
473 * ICU "poor man's RTTI", returns a UClassID for the actual class.
|
jpayne@69
|
474 *
|
jpayne@69
|
475 * @stable ICU 2.2
|
jpayne@69
|
476 */
|
jpayne@69
|
477 virtual UClassID getDynamicClassID() const;
|
jpayne@69
|
478
|
jpayne@69
|
479 /**
|
jpayne@69
|
480 * ICU "poor man's RTTI", returns a UClassID for this class.
|
jpayne@69
|
481 *
|
jpayne@69
|
482 * @stable ICU 2.2
|
jpayne@69
|
483 */
|
jpayne@69
|
484 static UClassID U_EXPORT2 getStaticClassID();
|
jpayne@69
|
485
|
jpayne@69
|
486 private:
|
jpayne@69
|
487 ResourceBundle(); // default constructor not implemented
|
jpayne@69
|
488
|
jpayne@69
|
489 UResourceBundle *fResource;
|
jpayne@69
|
490 void constructForLocale(const UnicodeString& path, const Locale& locale, UErrorCode& error);
|
jpayne@69
|
491 Locale *fLocale;
|
jpayne@69
|
492 };
|
jpayne@69
|
493
|
jpayne@69
|
494 U_NAMESPACE_END
|
jpayne@69
|
495
|
jpayne@69
|
496 #endif /* U_SHOW_CPLUSPLUS_API */
|
jpayne@69
|
497
|
jpayne@69
|
498 #endif
|