00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046 #ifndef RESBUND_H
00047 #define RESBUND_H
00048
00049 #include "unicode/ures.h"
00050 #include "unicode/utypes.h"
00051 #include "unicode/unistr.h"
00052 #include "unicode/locid.h"
00053
00054 #ifndef _FILESTRM
00055 typedef struct _FileStream FileStream;
00056 #endif
00057
00058
00059 class Locale;
00060 class RuleBasedCollator;
00061 class ResourceBundle;
00062
00063 #ifdef ICU_RESBUND_USE_DEPRECATES
00064 struct UHashtable;
00065 #endif
00066
00167 class U_COMMON_API ResourceBundle {
00168 public:
00196 ResourceBundle( const UnicodeString& path,
00197 const Locale& locale,
00198 UErrorCode& err);
00199 ResourceBundle( const UnicodeString& path,
00200 UErrorCode& err);
00201 ResourceBundle(UErrorCode &err);
00202 ResourceBundle( const wchar_t* path,
00203 const Locale& locale,
00204 UErrorCode& err);
00205 ResourceBundle( const char* path,
00206 const Locale& locale,
00207 UErrorCode& err);
00208 ResourceBundle(const ResourceBundle &original);
00209 ResourceBundle(UResourceBundle *res, UErrorCode &status);
00210
00211 ResourceBundle& operator=(const ResourceBundle& other);
00212 ~ResourceBundle();
00213
00221 int32_t getSize(void) const;
00222
00233 UnicodeString getString(UErrorCode& status) const;
00234
00248 const uint8_t *getBinary(int32_t& len, UErrorCode& status) const;
00249
00256 UBool hasNext(void) const;
00257
00263 void resetIterator(void);
00264
00272 const char *getKey(void);
00273
00274 const char *getName(void);
00275
00276
00283 UResType getType(void);
00284
00292 ResourceBundle getNext(UErrorCode& status);
00293
00302 UnicodeString getNextString(UErrorCode& status);
00303
00313 UnicodeString getNextString(const char ** key, UErrorCode& status);
00314
00323 ResourceBundle get(int32_t index, UErrorCode& status) const;
00324
00333 UnicodeString getStringEx(int32_t index, UErrorCode& status) const;
00334
00344 ResourceBundle get(const char* key, UErrorCode& status) const;
00345
00355 UnicodeString getStringEx(const char* key, UErrorCode& status) const;
00356
00357 #ifdef ICU_RESBUND_USE_DEPRECATES
00358
00370 const UnicodeString* getString( const char *resourceTag,
00371 UErrorCode& err) const;
00372
00392 const UnicodeString* getStringArray( const char *resourceTag,
00393 int32_t& numArrayItems,
00394 UErrorCode& err) const;
00395
00396
00412 const UnicodeString* getArrayItem( const char *resourceTag,
00413 int32_t index,
00414 UErrorCode& err) const;
00415
00435 const UnicodeString** get2dArray(const char *resourceTag,
00436 int32_t& rowCount,
00437 int32_t& columnCount,
00438 UErrorCode& err) const;
00439
00440
00459 const UnicodeString* get2dArrayItem( const char *resourceTag,
00460 int32_t rowIndex,
00461 int32_t columnIndex,
00462 UErrorCode& err) const;
00463
00464
00481 const UnicodeString* getTaggedArrayItem( const char *resourceTag,
00482 const UnicodeString& itemTag,
00483 UErrorCode& err) const;
00484
00508 void getTaggedArray( const char *resourceTag,
00509 UnicodeString*& itemTags,
00510 UnicodeString*& items,
00511 int32_t& numItems,
00512 UErrorCode& err) const;
00513 #endif
00514
00534 const char* getVersionNumber(void) const;
00535
00536 void getVersion(UVersionInfo versionInfo) const;
00537
00544 const Locale &getLocale(void) const ;
00545
00546 private:
00547 UResourceBundle *resource;
00548 void constructForLocale(const UnicodeString& path, const Locale& locale, UErrorCode& error);
00549 void constructForLocale(const wchar_t* path, const Locale& locale, UErrorCode& error);
00550 #ifdef ICU_RESBUND_USE_DEPRECATES
00551 void initItemCache(UErrorCode& error);
00552 #endif
00553
00554 friend class RuleBasedCollator;
00555
00561 ResourceBundle( const UnicodeString& path,
00562 const char *localeName,
00563 UErrorCode& status);
00564
00565 private:
00566 static void U_CALLCONV deleteValue(void* value);
00567 Locale fRealLocale;
00568
00569 #ifdef ICU_RESBUND_USE_DEPRECATES
00570 UHashtable* fItemCache;
00571 #endif
00572
00573 static const char* kDefaultSuffix;
00574 static const int32_t kDefaultSuffixLen;
00575 static const char* kDefaultFilename;
00576 static const char* kDefaultLocaleName;
00577 };
00578
00579 #endif