|
ICU 73.2
73.2
|
00001 // © 2016 and later: Unicode, Inc. and others. 00002 // License & terms of use: http://www.unicode.org/copyright.html 00003 /* 00004 ****************************************************************************** 00005 * 00006 * Copyright (C) 1996-2013, International Business Machines Corporation 00007 * and others. All Rights Reserved. 00008 * 00009 ****************************************************************************** 00010 * 00011 * File resbund.h 00012 * 00013 * CREATED BY 00014 * Richard Gillam 00015 * 00016 * Modification History: 00017 * 00018 * Date Name Description 00019 * 2/5/97 aliu Added scanForLocaleInFile. Added 00020 * constructor which attempts to read resource bundle 00021 * from a specific file, without searching other files. 00022 * 2/11/97 aliu Added UErrorCode return values to constructors. Fixed 00023 * infinite loops in scanForFile and scanForLocale. 00024 * Modified getRawResourceData to not delete storage 00025 * in localeData and resourceData which it doesn't own. 00026 * Added Mac compatibility #ifdefs for tellp() and 00027 * ios::nocreate. 00028 * 2/18/97 helena Updated with 100% documentation coverage. 00029 * 3/13/97 aliu Rewrote to load in entire resource bundle and store 00030 * it as a Hashtable of ResourceBundleData objects. 00031 * Added state table to govern parsing of files. 00032 * Modified to load locale index out of new file 00033 * distinct from default.txt. 00034 * 3/25/97 aliu Modified to support 2-d arrays, needed for timezone 00035 * data. Added support for custom file suffixes. Again, 00036 * needed to support timezone data. 00037 * 4/7/97 aliu Cleaned up. 00038 * 03/02/99 stephen Removed dependency on FILE*. 00039 * 03/29/99 helena Merged Bertrand and Stephen's changes. 00040 * 06/11/99 stephen Removed parsing of .txt files. 00041 * Reworked to use new binary format. 00042 * Cleaned up. 00043 * 06/14/99 stephen Removed methods taking a filename suffix. 00044 * 11/09/99 weiv Added getLocale(), fRealLocale, removed fRealLocaleID 00045 ****************************************************************************** 00046 */ 00047 00048 #ifndef RESBUND_H 00049 #define RESBUND_H 00050 00051 #include "unicode/utypes.h" 00052 00053 #if U_SHOW_CPLUSPLUS_API 00054 00055 #include "unicode/uobject.h" 00056 #include "unicode/ures.h" 00057 #include "unicode/unistr.h" 00058 #include "unicode/locid.h" 00059 00065 U_NAMESPACE_BEGIN 00066 00083 class U_COMMON_API ResourceBundle : public UObject { 00084 public: 00111 ResourceBundle(const UnicodeString& packageName, 00112 const Locale& locale, 00113 UErrorCode& err); 00114 00126 ResourceBundle(const UnicodeString& packageName, 00127 UErrorCode& err); 00128 00135 ResourceBundle(UErrorCode &err); 00136 00151 ResourceBundle(const char* packageName, 00152 const Locale& locale, 00153 UErrorCode& err); 00154 00161 ResourceBundle(const ResourceBundle &original); 00162 00172 ResourceBundle(UResourceBundle *res, 00173 UErrorCode &status); 00174 00181 ResourceBundle& 00182 operator=(const ResourceBundle& other); 00183 00187 virtual ~ResourceBundle(); 00188 00200 ResourceBundle *clone() const; 00201 00212 int32_t 00213 getSize(void) const; 00214 00225 UnicodeString 00226 getString(UErrorCode& status) const; 00227 00240 const uint8_t* 00241 getBinary(int32_t& len, UErrorCode& status) const; 00242 00243 00255 const int32_t* 00256 getIntVector(int32_t& len, UErrorCode& status) const; 00257 00269 uint32_t 00270 getUInt(UErrorCode& status) const; 00271 00283 int32_t 00284 getInt(UErrorCode& status) const; 00285 00292 UBool 00293 hasNext(void) const; 00294 00300 void 00301 resetIterator(void); 00302 00310 const char* 00311 getKey(void) const; 00312 00320 const char* 00321 getName(void) const; 00322 00323 00330 UResType 00331 getType(void) const; 00332 00340 ResourceBundle 00341 getNext(UErrorCode& status); 00342 00351 UnicodeString 00352 getNextString(UErrorCode& status); 00353 00363 UnicodeString 00364 getNextString(const char ** key, 00365 UErrorCode& status); 00366 00375 ResourceBundle 00376 get(int32_t index, 00377 UErrorCode& status) const; 00378 00387 UnicodeString 00388 getStringEx(int32_t index, 00389 UErrorCode& status) const; 00390 00400 ResourceBundle 00401 get(const char* key, 00402 UErrorCode& status) const; 00403 00413 UnicodeString 00414 getStringEx(const char* key, 00415 UErrorCode& status) const; 00416 00417 #ifndef U_HIDE_DEPRECATED_API 00418 00427 const char* 00428 getVersionNumber(void) const; 00429 #endif /* U_HIDE_DEPRECATED_API */ 00430 00438 void 00439 getVersion(UVersionInfo versionInfo) const; 00440 00441 #ifndef U_HIDE_DEPRECATED_API 00442 00448 const Locale& 00449 getLocale(void) const; 00450 #endif /* U_HIDE_DEPRECATED_API */ 00451 00462 const Locale 00463 getLocale(ULocDataLocaleType type, UErrorCode &status) const; 00464 #ifndef U_HIDE_INTERNAL_API 00465 00469 ResourceBundle 00470 getWithFallback(const char* key, UErrorCode& status); 00471 #endif /* U_HIDE_INTERNAL_API */ 00472 00477 virtual UClassID getDynamicClassID() const override; 00478 00484 static UClassID U_EXPORT2 getStaticClassID(); 00485 00486 private: 00487 ResourceBundle() = delete; // default constructor not implemented 00488 00489 UResourceBundle *fResource; 00490 void constructForLocale(const UnicodeString& path, const Locale& locale, UErrorCode& error); 00491 Locale *fLocale; 00492 }; 00493 00494 U_NAMESPACE_END 00495 00496 #endif /* U_SHOW_CPLUSPLUS_API */ 00497 00498 #endif
1.7.6.1