00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef URES_H
00024 #define URES_H
00025
00026 #include "unicode/utypes.h"
00027 #include "unicode/uloc.h"
00028 #include "unicode/localpointer.h"
00029
00052 struct UResourceBundle;
00053
00057 typedef struct UResourceBundle UResourceBundle;
00058
00064 typedef enum {
00066 URES_NONE=-1,
00067
00069 URES_STRING=0,
00070
00072 URES_BINARY=1,
00073
00075 URES_TABLE=2,
00076
00084 URES_ALIAS=3,
00085
00093 URES_INT=7,
00094
00096 URES_ARRAY=8,
00097
00103 URES_INT_VECTOR = 14,
00104 #ifndef U_HIDE_DEPRECATED_API
00105
00106 RES_NONE=URES_NONE,
00108 RES_STRING=URES_STRING,
00110 RES_BINARY=URES_BINARY,
00112 RES_TABLE=URES_TABLE,
00114 RES_ALIAS=URES_ALIAS,
00116 RES_INT=URES_INT,
00118 RES_ARRAY=URES_ARRAY,
00120 RES_INT_VECTOR=URES_INT_VECTOR,
00122 RES_RESERVED=15,
00123 #endif
00124
00125 URES_LIMIT = 16
00126 } UResType;
00127
00128
00129
00130
00131
00160 U_STABLE UResourceBundle* U_EXPORT2
00161 ures_open(const char* packageName,
00162 const char* locale,
00163 UErrorCode* status);
00164
00165
00183 U_STABLE UResourceBundle* U_EXPORT2
00184 ures_openDirect(const char* packageName,
00185 const char* locale,
00186 UErrorCode* status);
00187
00206 U_STABLE UResourceBundle* U_EXPORT2
00207 ures_openU(const UChar* packageName,
00208 const char* locale,
00209 UErrorCode* status);
00210
00211 #ifndef U_HIDE_DEPRECATED_API
00212
00228 U_DEPRECATED int32_t U_EXPORT2
00229 ures_countArrayItems(const UResourceBundle* resourceBundle,
00230 const char* resourceKey,
00231 UErrorCode* err);
00232 #endif
00233
00242 U_STABLE void U_EXPORT2
00243 ures_close(UResourceBundle* resourceBundle);
00244
00245 #if U_SHOW_CPLUSPLUS_API
00246
00247 U_NAMESPACE_BEGIN
00248
00258 U_DEFINE_LOCAL_OPEN_POINTER(LocalUResourceBundlePointer, UResourceBundle, ures_close);
00259
00260 U_NAMESPACE_END
00261
00262 #endif
00263
00264 #ifndef U_HIDE_DEPRECATED_API
00265
00275 U_DEPRECATED const char* U_EXPORT2
00276 ures_getVersionNumber(const UResourceBundle* resourceBundle);
00277 #endif
00278
00288 U_STABLE void U_EXPORT2
00289 ures_getVersion(const UResourceBundle* resB,
00290 UVersionInfo versionInfo);
00291
00292 #ifndef U_HIDE_DEPRECATED_API
00293
00305 U_DEPRECATED const char* U_EXPORT2
00306 ures_getLocale(const UResourceBundle* resourceBundle,
00307 UErrorCode* status);
00308 #endif
00309
00322 U_STABLE const char* U_EXPORT2
00323 ures_getLocaleByType(const UResourceBundle* resourceBundle,
00324 ULocDataLocaleType type,
00325 UErrorCode* status);
00326
00327
00328 #ifndef U_HIDE_INTERNAL_API
00329
00345 U_INTERNAL void U_EXPORT2
00346 ures_openFillIn(UResourceBundle *r,
00347 const char* packageName,
00348 const char* localeID,
00349 UErrorCode* status);
00350 #endif
00351
00369 U_STABLE const UChar* U_EXPORT2
00370 ures_getString(const UResourceBundle* resourceBundle,
00371 int32_t* len,
00372 UErrorCode* status);
00373
00421 U_STABLE const char * U_EXPORT2
00422 ures_getUTF8String(const UResourceBundle *resB,
00423 char *dest, int32_t *length,
00424 UBool forceCopy,
00425 UErrorCode *status);
00426
00444 U_STABLE const uint8_t* U_EXPORT2
00445 ures_getBinary(const UResourceBundle* resourceBundle,
00446 int32_t* len,
00447 UErrorCode* status);
00448
00466 U_STABLE const int32_t* U_EXPORT2
00467 ures_getIntVector(const UResourceBundle* resourceBundle,
00468 int32_t* len,
00469 UErrorCode* status);
00470
00487 U_STABLE uint32_t U_EXPORT2
00488 ures_getUInt(const UResourceBundle* resourceBundle,
00489 UErrorCode *status);
00490
00507 U_STABLE int32_t U_EXPORT2
00508 ures_getInt(const UResourceBundle* resourceBundle,
00509 UErrorCode *status);
00510
00521 U_STABLE int32_t U_EXPORT2
00522 ures_getSize(const UResourceBundle *resourceBundle);
00523
00532 U_STABLE UResType U_EXPORT2
00533 ures_getType(const UResourceBundle *resourceBundle);
00534
00543 U_STABLE const char * U_EXPORT2
00544 ures_getKey(const UResourceBundle *resourceBundle);
00545
00546
00547
00548
00549
00556 U_STABLE void U_EXPORT2
00557 ures_resetIterator(UResourceBundle *resourceBundle);
00558
00566 U_STABLE UBool U_EXPORT2
00567 ures_hasNext(const UResourceBundle *resourceBundle);
00568
00581 U_STABLE UResourceBundle* U_EXPORT2
00582 ures_getNextResource(UResourceBundle *resourceBundle,
00583 UResourceBundle *fillIn,
00584 UErrorCode *status);
00585
00598 U_STABLE const UChar* U_EXPORT2
00599 ures_getNextString(UResourceBundle *resourceBundle,
00600 int32_t* len,
00601 const char ** key,
00602 UErrorCode *status);
00603
00616 U_STABLE UResourceBundle* U_EXPORT2
00617 ures_getByIndex(const UResourceBundle *resourceBundle,
00618 int32_t indexR,
00619 UResourceBundle *fillIn,
00620 UErrorCode *status);
00621
00633 U_STABLE const UChar* U_EXPORT2
00634 ures_getStringByIndex(const UResourceBundle *resourceBundle,
00635 int32_t indexS,
00636 int32_t* len,
00637 UErrorCode *status);
00638
00687 U_STABLE const char * U_EXPORT2
00688 ures_getUTF8StringByIndex(const UResourceBundle *resB,
00689 int32_t stringIndex,
00690 char *dest, int32_t *pLength,
00691 UBool forceCopy,
00692 UErrorCode *status);
00693
00706 U_STABLE UResourceBundle* U_EXPORT2
00707 ures_getByKey(const UResourceBundle *resourceBundle,
00708 const char* key,
00709 UResourceBundle *fillIn,
00710 UErrorCode *status);
00711
00724 U_STABLE const UChar* U_EXPORT2
00725 ures_getStringByKey(const UResourceBundle *resB,
00726 const char* key,
00727 int32_t* len,
00728 UErrorCode *status);
00729
00780 U_STABLE const char * U_EXPORT2
00781 ures_getUTF8StringByKey(const UResourceBundle *resB,
00782 const char *key,
00783 char *dest, int32_t *pLength,
00784 UBool forceCopy,
00785 UErrorCode *status);
00786
00787 #if U_SHOW_CPLUSPLUS_API
00788 #include "unicode/unistr.h"
00789
00790 U_NAMESPACE_BEGIN
00802 inline UnicodeString
00803 ures_getUnicodeString(const UResourceBundle *resB, UErrorCode* status) {
00804 UnicodeString result;
00805 int32_t len = 0;
00806 const UChar *r = ures_getString(resB, &len, status);
00807 if(U_SUCCESS(*status)) {
00808 result.setTo(TRUE, r, len);
00809 } else {
00810 result.setToBogus();
00811 }
00812 return result;
00813 }
00814
00827 inline UnicodeString
00828 ures_getNextUnicodeString(UResourceBundle *resB, const char ** key, UErrorCode* status) {
00829 UnicodeString result;
00830 int32_t len = 0;
00831 const UChar* r = ures_getNextString(resB, &len, key, status);
00832 if(U_SUCCESS(*status)) {
00833 result.setTo(TRUE, r, len);
00834 } else {
00835 result.setToBogus();
00836 }
00837 return result;
00838 }
00839
00849 inline UnicodeString
00850 ures_getUnicodeStringByIndex(const UResourceBundle *resB, int32_t indexS, UErrorCode* status) {
00851 UnicodeString result;
00852 int32_t len = 0;
00853 const UChar* r = ures_getStringByIndex(resB, indexS, &len, status);
00854 if(U_SUCCESS(*status)) {
00855 result.setTo(TRUE, r, len);
00856 } else {
00857 result.setToBogus();
00858 }
00859 return result;
00860 }
00861
00872 inline UnicodeString
00873 ures_getUnicodeStringByKey(const UResourceBundle *resB, const char* key, UErrorCode* status) {
00874 UnicodeString result;
00875 int32_t len = 0;
00876 const UChar* r = ures_getStringByKey(resB, key, &len, status);
00877 if(U_SUCCESS(*status)) {
00878 result.setTo(TRUE, r, len);
00879 } else {
00880 result.setToBogus();
00881 }
00882 return result;
00883 }
00884
00885 U_NAMESPACE_END
00886
00887 #endif
00888
00897 U_STABLE UEnumeration* U_EXPORT2
00898 ures_openAvailableLocales(const char *packageName, UErrorCode *status);
00899
00900
00901 #endif
00902