ICU 4.8.1.1
4.8.1.1
|
00001 /* 00002 ****************************************************************************** 00003 * 00004 * Copyright (C) 1996-2007, International Business Machines Corporation 00005 * and others. All Rights Reserved. 00006 * 00007 ****************************************************************************** 00008 * 00009 * File resbund.h 00010 * 00011 * CREATED BY 00012 * Richard Gillam 00013 * 00014 * Modification History: 00015 * 00016 * Date Name Description 00017 * 2/5/97 aliu Added scanForLocaleInFile. Added 00018 * constructor which attempts to read resource bundle 00019 * from a specific file, without searching other files. 00020 * 2/11/97 aliu Added UErrorCode return values to constructors. Fixed 00021 * infinite loops in scanForFile and scanForLocale. 00022 * Modified getRawResourceData to not delete storage 00023 * in localeData and resourceData which it doesn't own. 00024 * Added Mac compatibility #ifdefs for tellp() and 00025 * ios::nocreate. 00026 * 2/18/97 helena Updated with 100% documentation coverage. 00027 * 3/13/97 aliu Rewrote to load in entire resource bundle and store 00028 * it as a Hashtable of ResourceBundleData objects. 00029 * Added state table to govern parsing of files. 00030 * Modified to load locale index out of new file 00031 * distinct from default.txt. 00032 * 3/25/97 aliu Modified to support 2-d arrays, needed for timezone 00033 * data. Added support for custom file suffixes. Again, 00034 * needed to support timezone data. 00035 * 4/7/97 aliu Cleaned up. 00036 * 03/02/99 stephen Removed dependency on FILE*. 00037 * 03/29/99 helena Merged Bertrand and Stephen's changes. 00038 * 06/11/99 stephen Removed parsing of .txt files. 00039 * Reworked to use new binary format. 00040 * Cleaned up. 00041 * 06/14/99 stephen Removed methods taking a filename suffix. 00042 * 11/09/99 weiv Added getLocale(), fRealLocale, removed fRealLocaleID 00043 ****************************************************************************** 00044 */ 00045 00046 #ifndef RESBUND_H 00047 #define RESBUND_H 00048 00049 #include "unicode/utypes.h" 00050 #include "unicode/uobject.h" 00051 #include "unicode/ures.h" 00052 #include "unicode/unistr.h" 00053 #include "unicode/locid.h" 00054 00060 U_NAMESPACE_BEGIN 00061 00078 class U_COMMON_API ResourceBundle : public UObject { 00079 public: 00106 ResourceBundle(const UnicodeString& packageName, 00107 const Locale& locale, 00108 UErrorCode& err); 00109 00121 ResourceBundle(const UnicodeString& packageName, 00122 UErrorCode& err); 00123 00130 ResourceBundle(UErrorCode &err); 00131 00146 ResourceBundle(const char* packageName, 00147 const Locale& locale, 00148 UErrorCode& err); 00149 00156 ResourceBundle(const ResourceBundle &original); 00157 00167 ResourceBundle(UResourceBundle *res, 00168 UErrorCode &status); 00169 00176 ResourceBundle& 00177 operator=(const ResourceBundle& other); 00178 00182 virtual ~ResourceBundle(); 00183 00195 ResourceBundle *clone() const; 00196 00207 int32_t 00208 getSize(void) const; 00209 00220 UnicodeString 00221 getString(UErrorCode& status) const; 00222 00235 const uint8_t* 00236 getBinary(int32_t& len, UErrorCode& status) const; 00237 00238 00250 const int32_t* 00251 getIntVector(int32_t& len, UErrorCode& status) const; 00252 00264 uint32_t 00265 getUInt(UErrorCode& status) const; 00266 00278 int32_t 00279 getInt(UErrorCode& status) const; 00280 00287 UBool 00288 hasNext(void) const; 00289 00295 void 00296 resetIterator(void); 00297 00305 const char* 00306 getKey(void) const; 00307 00315 const char* 00316 getName(void) const; 00317 00318 00325 UResType 00326 getType(void) const; 00327 00335 ResourceBundle 00336 getNext(UErrorCode& status); 00337 00346 UnicodeString 00347 getNextString(UErrorCode& status); 00348 00358 UnicodeString 00359 getNextString(const char ** key, 00360 UErrorCode& status); 00361 00370 ResourceBundle 00371 get(int32_t index, 00372 UErrorCode& status) const; 00373 00382 UnicodeString 00383 getStringEx(int32_t index, 00384 UErrorCode& status) const; 00385 00395 ResourceBundle 00396 get(const char* key, 00397 UErrorCode& status) const; 00398 00408 UnicodeString 00409 getStringEx(const char* key, 00410 UErrorCode& status) const; 00411 00421 const char* 00422 getVersionNumber(void) const; 00423 00431 void 00432 getVersion(UVersionInfo versionInfo) const; 00433 00440 const Locale& 00441 getLocale(void) const; 00442 00453 const Locale 00454 getLocale(ULocDataLocaleType type, UErrorCode &status) const; 00459 ResourceBundle 00460 getWithFallback(const char* key, UErrorCode& status); 00466 virtual UClassID getDynamicClassID() const; 00467 00473 static UClassID U_EXPORT2 getStaticClassID(); 00474 00475 private: 00476 ResourceBundle(); // default constructor not implemented 00477 00478 UResourceBundle *fResource; 00479 void constructForLocale(const UnicodeString& path, const Locale& locale, UErrorCode& error); 00480 Locale *fLocale; 00481 00482 }; 00483 00484 U_NAMESPACE_END 00485 #endif