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 #ifndef URES_H
00026 #define URES_H
00027
00028 #include "unicode/utypes.h"
00029 #include "unicode/uloc.h"
00030 #include "unicode/localpointer.h"
00031
00054 struct UResourceBundle;
00055
00059 typedef struct UResourceBundle UResourceBundle;
00060
00066 typedef enum {
00068 URES_NONE=-1,
00069
00071 URES_STRING=0,
00072
00074 URES_BINARY=1,
00075
00077 URES_TABLE=2,
00078
00086 URES_ALIAS=3,
00087
00095 URES_INT=7,
00096
00098 URES_ARRAY=8,
00099
00105 URES_INT_VECTOR = 14,
00106 #ifndef U_HIDE_DEPRECATED_API
00107
00108 RES_NONE=URES_NONE,
00110 RES_STRING=URES_STRING,
00112 RES_BINARY=URES_BINARY,
00114 RES_TABLE=URES_TABLE,
00116 RES_ALIAS=URES_ALIAS,
00118 RES_INT=URES_INT,
00120 RES_ARRAY=URES_ARRAY,
00122 RES_INT_VECTOR=URES_INT_VECTOR,
00124 RES_RESERVED=15,
00125
00130 URES_LIMIT = 16
00131 #endif // U_HIDE_DEPRECATED_API
00132 } UResType;
00133
00134
00135
00136
00137
00166 U_STABLE UResourceBundle* U_EXPORT2
00167 ures_open(const char* packageName,
00168 const char* locale,
00169 UErrorCode* status);
00170
00171
00189 U_STABLE UResourceBundle* U_EXPORT2
00190 ures_openDirect(const char* packageName,
00191 const char* locale,
00192 UErrorCode* status);
00193
00212 U_STABLE UResourceBundle* U_EXPORT2
00213 ures_openU(const UChar* packageName,
00214 const char* locale,
00215 UErrorCode* status);
00216
00217 #ifndef U_HIDE_DEPRECATED_API
00218
00234 U_DEPRECATED int32_t U_EXPORT2
00235 ures_countArrayItems(const UResourceBundle* resourceBundle,
00236 const char* resourceKey,
00237 UErrorCode* err);
00238 #endif
00239
00248 U_STABLE void U_EXPORT2
00249 ures_close(UResourceBundle* resourceBundle);
00250
00251 #if U_SHOW_CPLUSPLUS_API
00252
00253 U_NAMESPACE_BEGIN
00254
00264 U_DEFINE_LOCAL_OPEN_POINTER(LocalUResourceBundlePointer, UResourceBundle, ures_close);
00265
00266 U_NAMESPACE_END
00267
00268 #endif
00269
00270 #ifndef U_HIDE_DEPRECATED_API
00271
00281 U_DEPRECATED const char* U_EXPORT2
00282 ures_getVersionNumber(const UResourceBundle* resourceBundle);
00283 #endif
00284
00294 U_STABLE void U_EXPORT2
00295 ures_getVersion(const UResourceBundle* resB,
00296 UVersionInfo versionInfo);
00297
00298 #ifndef U_HIDE_DEPRECATED_API
00299
00311 U_DEPRECATED const char* U_EXPORT2
00312 ures_getLocale(const UResourceBundle* resourceBundle,
00313 UErrorCode* status);
00314 #endif
00315
00328 U_STABLE const char* U_EXPORT2
00329 ures_getLocaleByType(const UResourceBundle* resourceBundle,
00330 ULocDataLocaleType type,
00331 UErrorCode* status);
00332
00333
00334 #ifndef U_HIDE_INTERNAL_API
00335
00351 U_INTERNAL void U_EXPORT2
00352 ures_openFillIn(UResourceBundle *r,
00353 const char* packageName,
00354 const char* localeID,
00355 UErrorCode* status);
00356 #endif
00357
00375 U_STABLE const UChar* U_EXPORT2
00376 ures_getString(const UResourceBundle* resourceBundle,
00377 int32_t* len,
00378 UErrorCode* status);
00379
00427 U_STABLE const char * U_EXPORT2
00428 ures_getUTF8String(const UResourceBundle *resB,
00429 char *dest, int32_t *length,
00430 UBool forceCopy,
00431 UErrorCode *status);
00432
00450 U_STABLE const uint8_t* U_EXPORT2
00451 ures_getBinary(const UResourceBundle* resourceBundle,
00452 int32_t* len,
00453 UErrorCode* status);
00454
00472 U_STABLE const int32_t* U_EXPORT2
00473 ures_getIntVector(const UResourceBundle* resourceBundle,
00474 int32_t* len,
00475 UErrorCode* status);
00476
00493 U_STABLE uint32_t U_EXPORT2
00494 ures_getUInt(const UResourceBundle* resourceBundle,
00495 UErrorCode *status);
00496
00513 U_STABLE int32_t U_EXPORT2
00514 ures_getInt(const UResourceBundle* resourceBundle,
00515 UErrorCode *status);
00516
00527 U_STABLE int32_t U_EXPORT2
00528 ures_getSize(const UResourceBundle *resourceBundle);
00529
00538 U_STABLE UResType U_EXPORT2
00539 ures_getType(const UResourceBundle *resourceBundle);
00540
00549 U_STABLE const char * U_EXPORT2
00550 ures_getKey(const UResourceBundle *resourceBundle);
00551
00552
00553
00554
00555
00562 U_STABLE void U_EXPORT2
00563 ures_resetIterator(UResourceBundle *resourceBundle);
00564
00572 U_STABLE UBool U_EXPORT2
00573 ures_hasNext(const UResourceBundle *resourceBundle);
00574
00587 U_STABLE UResourceBundle* U_EXPORT2
00588 ures_getNextResource(UResourceBundle *resourceBundle,
00589 UResourceBundle *fillIn,
00590 UErrorCode *status);
00591
00604 U_STABLE const UChar* U_EXPORT2
00605 ures_getNextString(UResourceBundle *resourceBundle,
00606 int32_t* len,
00607 const char ** key,
00608 UErrorCode *status);
00609
00622 U_STABLE UResourceBundle* U_EXPORT2
00623 ures_getByIndex(const UResourceBundle *resourceBundle,
00624 int32_t indexR,
00625 UResourceBundle *fillIn,
00626 UErrorCode *status);
00627
00639 U_STABLE const UChar* U_EXPORT2
00640 ures_getStringByIndex(const UResourceBundle *resourceBundle,
00641 int32_t indexS,
00642 int32_t* len,
00643 UErrorCode *status);
00644
00693 U_STABLE const char * U_EXPORT2
00694 ures_getUTF8StringByIndex(const UResourceBundle *resB,
00695 int32_t stringIndex,
00696 char *dest, int32_t *pLength,
00697 UBool forceCopy,
00698 UErrorCode *status);
00699
00712 U_STABLE UResourceBundle* U_EXPORT2
00713 ures_getByKey(const UResourceBundle *resourceBundle,
00714 const char* key,
00715 UResourceBundle *fillIn,
00716 UErrorCode *status);
00717
00730 U_STABLE const UChar* U_EXPORT2
00731 ures_getStringByKey(const UResourceBundle *resB,
00732 const char* key,
00733 int32_t* len,
00734 UErrorCode *status);
00735
00786 U_STABLE const char * U_EXPORT2
00787 ures_getUTF8StringByKey(const UResourceBundle *resB,
00788 const char *key,
00789 char *dest, int32_t *pLength,
00790 UBool forceCopy,
00791 UErrorCode *status);
00792
00793 #if U_SHOW_CPLUSPLUS_API
00794 #include "unicode/unistr.h"
00795
00796 U_NAMESPACE_BEGIN
00808 inline UnicodeString
00809 ures_getUnicodeString(const UResourceBundle *resB, UErrorCode* status) {
00810 UnicodeString result;
00811 int32_t len = 0;
00812 const UChar *r = ures_getString(resB, &len, status);
00813 if(U_SUCCESS(*status)) {
00814 result.setTo(TRUE, r, len);
00815 } else {
00816 result.setToBogus();
00817 }
00818 return result;
00819 }
00820
00833 inline UnicodeString
00834 ures_getNextUnicodeString(UResourceBundle *resB, const char ** key, UErrorCode* status) {
00835 UnicodeString result;
00836 int32_t len = 0;
00837 const UChar* r = ures_getNextString(resB, &len, key, status);
00838 if(U_SUCCESS(*status)) {
00839 result.setTo(TRUE, r, len);
00840 } else {
00841 result.setToBogus();
00842 }
00843 return result;
00844 }
00845
00855 inline UnicodeString
00856 ures_getUnicodeStringByIndex(const UResourceBundle *resB, int32_t indexS, UErrorCode* status) {
00857 UnicodeString result;
00858 int32_t len = 0;
00859 const UChar* r = ures_getStringByIndex(resB, indexS, &len, status);
00860 if(U_SUCCESS(*status)) {
00861 result.setTo(TRUE, r, len);
00862 } else {
00863 result.setToBogus();
00864 }
00865 return result;
00866 }
00867
00878 inline UnicodeString
00879 ures_getUnicodeStringByKey(const UResourceBundle *resB, const char* key, UErrorCode* status) {
00880 UnicodeString result;
00881 int32_t len = 0;
00882 const UChar* r = ures_getStringByKey(resB, key, &len, status);
00883 if(U_SUCCESS(*status)) {
00884 result.setTo(TRUE, r, len);
00885 } else {
00886 result.setToBogus();
00887 }
00888 return result;
00889 }
00890
00891 U_NAMESPACE_END
00892
00893 #endif
00894
00903 U_STABLE UEnumeration* U_EXPORT2
00904 ures_openAvailableLocales(const char *packageName, UErrorCode *status);
00905
00906
00907 #endif
00908