ICU 58.2 58.2

- Main Page
- Related Pages
- Modules
- Namespaces
- Data Structures
- Files

- File List
- Globals

resbund.h
Go to the documentation of this file.
1 // Copyright (C) 2016 and later: Unicode, Inc. and others.
2 // License & terms of use: http://www.unicode.org/copyright.html
3 /*
4 ******************************************************************************
5 *
6 * Copyright (C) 1996-2013, International Business Machines Corporation
7 * and others. All Rights Reserved.
8 *
9 ******************************************************************************
10 *
11 * File resbund.h
12 *
13 * CREATED BY
14 * Richard Gillam
15 *
16 * Modification History:
17 *
18 * Date Name Description
19 * 2/5/97 aliu Added scanForLocaleInFile. Added
20 * constructor which attempts to read resource bundle
21 * from a specific file, without searching other files.
22 * 2/11/97 aliu Added UErrorCode return values to constructors. Fixed
23 * infinite loops in scanForFile and scanForLocale.
24 * Modified getRawResourceData to not delete storage
25 * in localeData and resourceData which it doesn't own.
26 * Added Mac compatibility #ifdefs for tellp() and
27 * ios::nocreate.
28 * 2/18/97 helena Updated with 100% documentation coverage.
29 * 3/13/97 aliu Rewrote to load in entire resource bundle and store
30 * it as a Hashtable of ResourceBundleData objects.
31 * Added state table to govern parsing of files.
32 * Modified to load locale index out of new file
33 * distinct from default.txt.
34 * 3/25/97 aliu Modified to support 2-d arrays, needed for timezone
35 * data. Added support for custom file suffixes. Again,
36 * needed to support timezone data.
37 * 4/7/97 aliu Cleaned up.
38 * 03/02/99 stephen Removed dependency on FILE*.
39 * 03/29/99 helena Merged Bertrand and Stephen's changes.
40 * 06/11/99 stephen Removed parsing of .txt files.
41 * Reworked to use new binary format.
42 * Cleaned up.
43 * 06/14/99 stephen Removed methods taking a filename suffix.
44 * 11/09/99 weiv Added getLocale(), fRealLocale, removed fRealLocaleID
45 ******************************************************************************
46 */
47
48 #ifndef RESBUND_H
49 #define RESBUND_H
50
51 #include "unicode/utypes.h"
52 #include "unicode/uobject.h"
53 #include "unicode/ures.h"
54 #include "unicode/unistr.h"
55 #include "unicode/locid.h"
56
62 U_NAMESPACE_BEGIN
63
80 class U_COMMON_API ResourceBundle : public UObject {
81 public:
108 ResourceBundle(const UnicodeString& packageName,
109 const Locale& locale,
110 UErrorCode& err);
111
123 ResourceBundle(const UnicodeString& packageName,
124 UErrorCode& err);
125
132 ResourceBundle(UErrorCode &err);
133
148 ResourceBundle(const char* packageName,
149 const Locale& locale,
150 UErrorCode& err);
151
158 ResourceBundle(const ResourceBundle &original);
159
169 ResourceBundle(UResourceBundle *res,
170 UErrorCode &status);
171
178 ResourceBundle&
179 operator=(const ResourceBundle& other);
180
184 virtual ~ResourceBundle();
185
197 ResourceBundle *clone() const;
198
209 int32_t
210 getSize(void) const;
211
222 UnicodeString
223 getString(UErrorCode& status) const;
224
237 const uint8_t*
238 getBinary(int32_t& len, UErrorCode& status) const;
239
240
252 const int32_t*
253 getIntVector(int32_t& len, UErrorCode& status) const;
254
266 uint32_t
267 getUInt(UErrorCode& status) const;
268
280 int32_t
281 getInt(UErrorCode& status) const;
282
289 UBool
290 hasNext(void) const;
291
297 void
298 resetIterator(void);
299
307 const char*
308 getKey(void) const;
309
317 const char*
318 getName(void) const;
319
320
327 UResType
328 getType(void) const;
329
337 ResourceBundle
338 getNext(UErrorCode& status);
339
348 UnicodeString
349 getNextString(UErrorCode& status);
350
360 UnicodeString
361 getNextString(const char ** key,
362 UErrorCode& status);
363
372 ResourceBundle
373 get(int32_t index,
374 UErrorCode& status) const;
375
384 UnicodeString
385 getStringEx(int32_t index,
386 UErrorCode& status) const;
387
397 ResourceBundle
398 get(const char* key,
399 UErrorCode& status) const;
400
410 UnicodeString
411 getStringEx(const char* key,
412 UErrorCode& status) const;
413
414 #ifndef U_HIDE_DEPRECATED_API
415
424 const char*
425 getVersionNumber(void) const;
426 #endif /* U_HIDE_DEPRECATED_API */
427
435 void
436 getVersion(UVersionInfo versionInfo) const;
437
438 #ifndef U_HIDE_DEPRECATED_API
439
445 const Locale&
446 getLocale(void) const;
447 #endif /* U_HIDE_DEPRECATED_API */
448
459 const Locale
460 getLocale(ULocDataLocaleType type, UErrorCode &status) const;
461 #ifndef U_HIDE_INTERNAL_API
462
466 ResourceBundle
467 getWithFallback(const char* key, UErrorCode& status);
468 #endif /* U_HIDE_INTERNAL_API */
469
474 virtual UClassID getDynamicClassID() const;
475
481 static UClassID U_EXPORT2 getStaticClassID();
482
483 private:
484 ResourceBundle(); // default constructor not implemented
485
486 UResourceBundle *fResource;
487 void constructForLocale(const UnicodeString& path, const Locale& locale, UErrorCode& error);
488 Locale *fLocale;
489 };
490
491 U_NAMESPACE_END
492 #endif
UVersionInfo
uint8_t UVersionInfo[U_MAX_VERSION_LENGTH]
The binary form of a version on ICU APIs is an array of 4 uint8_t.
Definition: uversion.h:59
icu::UObject::getDynamicClassID
virtual UClassID getDynamicClassID() const
ICU4C "poor man&#39;s RTTI", returns a UClassID for the actual ICU class.
unistr.h
C++ API: Unicode String.
UClassID
void * UClassID
UClassID is used to identify classes without using the compiler&#39;s RTTI.
Definition: uobject.h:93
U_NAMESPACE_BEGIN
#define U_NAMESPACE_BEGIN
This is used to begin a declaration of a public ICU C++ API.
Definition: uversion.h:131
icu::ResourceBundle
A class representing a collection of resource information pertaining to a given locale.
Definition: resbund.h:80
UResType
UResType
Numeric constants for types of resource items.
Definition: ures.h:66
uobject.h
C++ API: Common ICU base class UObject.
U_NAMESPACE_END
#define U_NAMESPACE_END
This is used to end a declaration of a public ICU C++ API.
Definition: uversion.h:132
UErrorCode
UErrorCode
Error code to replace exception handling, so that the code is compatible with all C++ compilers...
Definition: utypes.h:396
ULocDataLocaleType
ULocDataLocaleType
Constants for *_getLocale() Allow user to select whether she wants information on requested...
Definition: uloc.h:338
locid.h
C++ API: Locale ID object.
utypes.h
Basic definitions for ICU, for both C and C++ APIs.
U_COMMON_API
#define U_COMMON_API
Set to export library symbols from inside the common library, and to import them from outside...
Definition: utypes.h:359
icu::UnicodeString
UnicodeString is a string class that stores Unicode characters directly and provides similar function...
Definition: unistr.h:295
UResourceBundle
struct UResourceBundle UResourceBundle
Definition: ures.h:59
icu::UObject
UObject is the common ICU "boilerplate" class.
Definition: uobject.h:223
ures.h
C API: Resource Bundle.
UBool
int8_t UBool
The ICU boolean type.
Definition: umachine.h:259
icu::Locale
A Locale object represents a specific geographical, political, or cultural region.
Definition: locid.h:187