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 struct UHashtable;
00063
00064
00165 class U_COMMON_API ResourceBundle {
00166 public:
00194 ResourceBundle( const UnicodeString& path,
00195 const Locale& locale,
00196 UErrorCode& err);
00197 ResourceBundle( const UnicodeString& path,
00198 UErrorCode& err);
00199 ResourceBundle(UErrorCode &err);
00200 ResourceBundle( const wchar_t* path,
00201 const Locale& locale,
00202 UErrorCode& err);
00203 ResourceBundle( const char* path,
00204 const Locale& locale,
00205 UErrorCode& err);
00206 ResourceBundle(const ResourceBundle &original);
00207 ResourceBundle(UResourceBundle *res, UErrorCode &status);
00208
00209 ResourceBundle& operator=(const ResourceBundle& other);
00210 ~ResourceBundle();
00211
00219 int32_t getSize(void) const;
00230 UnicodeString getString(UErrorCode& status) const;
00231 const uint8_t *getBinary(int32_t& len, UErrorCode& status) const;
00232
00239 UBool hasNext(void) const;
00245 void resetIterator(void);
00246
00254 const char *getKey(void);
00255
00256 const char *getName(void);
00257
00258
00265 UResType getType(void);
00266
00274 ResourceBundle getNext(UErrorCode& status);
00275
00284 UnicodeString getNextString(UErrorCode& status);
00294 UnicodeString getNextString(const char ** key, UErrorCode& status);
00295
00304 ResourceBundle get(int32_t index, UErrorCode& status) const;
00305
00314 UnicodeString getStringEx(int32_t index, UErrorCode& status) const;
00315
00325 ResourceBundle get(const char* key, UErrorCode& status) const;
00326
00336 UnicodeString getStringEx(const char* key, UErrorCode& status) const;
00337
00350 const UnicodeString* getString( const char *resourceTag,
00351 UErrorCode& err) const;
00352
00372 const UnicodeString* getStringArray( const char *resourceTag,
00373 int32_t& numArrayItems,
00374 UErrorCode& err) const;
00375
00376
00392 const UnicodeString* getArrayItem( const char *resourceTag,
00393 int32_t index,
00394 UErrorCode& err) const;
00395
00415 const UnicodeString** get2dArray(const char *resourceTag,
00416 int32_t& rowCount,
00417 int32_t& columnCount,
00418 UErrorCode& err) const;
00419
00420
00439 const UnicodeString* get2dArrayItem( const char *resourceTag,
00440 int32_t rowIndex,
00441 int32_t columnIndex,
00442 UErrorCode& err) const;
00443
00444
00461 const UnicodeString* getTaggedArrayItem( const char *resourceTag,
00462 const UnicodeString& itemTag,
00463 UErrorCode& err) const;
00464
00488 void getTaggedArray( const char *resourceTag,
00489 UnicodeString*& itemTags,
00490 UnicodeString*& items,
00491 int32_t& numItems,
00492 UErrorCode& err) const;
00493
00513 const char* getVersionNumber(void) const;
00514
00515 void getVersion(UVersionInfo versionInfo) const;
00516
00523 const Locale &getLocale(void) const ;
00524
00525 private:
00526 UResourceBundle *resource;
00527 void constructForLocale(const UnicodeString& path, const Locale& locale, UErrorCode& error);
00528 void constructForLocale(const wchar_t* path, const Locale& locale, UErrorCode& error);
00529 void initItemCache(UErrorCode& error);
00530
00531 friend class RuleBasedCollator;
00532
00538 ResourceBundle( const UnicodeString& path,
00539 const char *localeName,
00540 UErrorCode& status);
00541
00542 private:
00543 static void U_CALLCONV deleteValue(void* value);
00544 Locale fRealLocale;
00545
00546 UHashtable* fItemCache;
00547 static const char* kDefaultSuffix;
00548 static const int32_t kDefaultSuffixLen;
00549 static const char* kDefaultFilename;
00550 static const char* kDefaultLocaleName;
00551 };
00552
00553 #endif