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
00031 #if U_SHOW_CPLUSPLUS_API
00032 #include "unicode/localpointer.h"
00033 #endif // U_SHOW_CPLUSPLUS_API
00034
00057 struct UResourceBundle;
00058
00062 typedef struct UResourceBundle UResourceBundle;
00063
00069 typedef enum {
00071 URES_NONE=-1,
00072
00074 URES_STRING=0,
00075
00077 URES_BINARY=1,
00078
00080 URES_TABLE=2,
00081
00089 URES_ALIAS=3,
00090
00098 URES_INT=7,
00099
00101 URES_ARRAY=8,
00102
00108 URES_INT_VECTOR = 14,
00109 #ifndef U_HIDE_DEPRECATED_API
00110
00111 RES_NONE=URES_NONE,
00113 RES_STRING=URES_STRING,
00115 RES_BINARY=URES_BINARY,
00117 RES_TABLE=URES_TABLE,
00119 RES_ALIAS=URES_ALIAS,
00121 RES_INT=URES_INT,
00123 RES_ARRAY=URES_ARRAY,
00125 RES_INT_VECTOR=URES_INT_VECTOR,
00127 RES_RESERVED=15,
00128
00133 URES_LIMIT = 16
00134 #endif // U_HIDE_DEPRECATED_API
00135 } UResType;
00136
00137
00138
00139
00140
00169 U_CAPI UResourceBundle* U_EXPORT2
00170 ures_open(const char* packageName,
00171 const char* locale,
00172 UErrorCode* status);
00173
00174
00192 U_CAPI UResourceBundle* U_EXPORT2
00193 ures_openDirect(const char* packageName,
00194 const char* locale,
00195 UErrorCode* status);
00196
00215 U_CAPI UResourceBundle* U_EXPORT2
00216 ures_openU(const UChar* packageName,
00217 const char* locale,
00218 UErrorCode* status);
00219
00220 #ifndef U_HIDE_DEPRECATED_API
00221
00237 U_DEPRECATED int32_t U_EXPORT2
00238 ures_countArrayItems(const UResourceBundle* resourceBundle,
00239 const char* resourceKey,
00240 UErrorCode* err);
00241 #endif
00242
00251 U_CAPI void U_EXPORT2
00252 ures_close(UResourceBundle* resourceBundle);
00253
00254 #if U_SHOW_CPLUSPLUS_API
00255
00256 U_NAMESPACE_BEGIN
00257
00267 U_DEFINE_LOCAL_OPEN_POINTER(LocalUResourceBundlePointer, UResourceBundle, ures_close);
00268
00269 U_NAMESPACE_END
00270
00271 #endif
00272
00273 #ifndef U_HIDE_DEPRECATED_API
00274
00284 U_DEPRECATED const char* U_EXPORT2
00285 ures_getVersionNumber(const UResourceBundle* resourceBundle);
00286 #endif
00287
00297 U_CAPI void U_EXPORT2
00298 ures_getVersion(const UResourceBundle* resB,
00299 UVersionInfo versionInfo);
00300
00301 #ifndef U_HIDE_DEPRECATED_API
00302
00314 U_DEPRECATED const char* U_EXPORT2
00315 ures_getLocale(const UResourceBundle* resourceBundle,
00316 UErrorCode* status);
00317 #endif
00318
00331 U_CAPI const char* U_EXPORT2
00332 ures_getLocaleByType(const UResourceBundle* resourceBundle,
00333 ULocDataLocaleType type,
00334 UErrorCode* status);
00335
00336
00337 #ifndef U_HIDE_INTERNAL_API
00338
00354 U_CAPI void U_EXPORT2
00355 ures_openFillIn(UResourceBundle *r,
00356 const char* packageName,
00357 const char* localeID,
00358 UErrorCode* status);
00359 #endif
00360
00378 U_CAPI const UChar* U_EXPORT2
00379 ures_getString(const UResourceBundle* resourceBundle,
00380 int32_t* len,
00381 UErrorCode* status);
00382
00430 U_CAPI const char * U_EXPORT2
00431 ures_getUTF8String(const UResourceBundle *resB,
00432 char *dest, int32_t *length,
00433 UBool forceCopy,
00434 UErrorCode *status);
00435
00453 U_CAPI const uint8_t* U_EXPORT2
00454 ures_getBinary(const UResourceBundle* resourceBundle,
00455 int32_t* len,
00456 UErrorCode* status);
00457
00475 U_CAPI const int32_t* U_EXPORT2
00476 ures_getIntVector(const UResourceBundle* resourceBundle,
00477 int32_t* len,
00478 UErrorCode* status);
00479
00496 U_CAPI uint32_t U_EXPORT2
00497 ures_getUInt(const UResourceBundle* resourceBundle,
00498 UErrorCode *status);
00499
00516 U_CAPI int32_t U_EXPORT2
00517 ures_getInt(const UResourceBundle* resourceBundle,
00518 UErrorCode *status);
00519
00530 U_CAPI int32_t U_EXPORT2
00531 ures_getSize(const UResourceBundle *resourceBundle);
00532
00541 U_CAPI UResType U_EXPORT2
00542 ures_getType(const UResourceBundle *resourceBundle);
00543
00552 U_CAPI const char * U_EXPORT2
00553 ures_getKey(const UResourceBundle *resourceBundle);
00554
00555
00556
00557
00558
00565 U_CAPI void U_EXPORT2
00566 ures_resetIterator(UResourceBundle *resourceBundle);
00567
00575 U_CAPI UBool U_EXPORT2
00576 ures_hasNext(const UResourceBundle *resourceBundle);
00577
00590 U_CAPI UResourceBundle* U_EXPORT2
00591 ures_getNextResource(UResourceBundle *resourceBundle,
00592 UResourceBundle *fillIn,
00593 UErrorCode *status);
00594
00607 U_CAPI const UChar* U_EXPORT2
00608 ures_getNextString(UResourceBundle *resourceBundle,
00609 int32_t* len,
00610 const char ** key,
00611 UErrorCode *status);
00612
00625 U_CAPI UResourceBundle* U_EXPORT2
00626 ures_getByIndex(const UResourceBundle *resourceBundle,
00627 int32_t indexR,
00628 UResourceBundle *fillIn,
00629 UErrorCode *status);
00630
00642 U_CAPI const UChar* U_EXPORT2
00643 ures_getStringByIndex(const UResourceBundle *resourceBundle,
00644 int32_t indexS,
00645 int32_t* len,
00646 UErrorCode *status);
00647
00696 U_CAPI const char * U_EXPORT2
00697 ures_getUTF8StringByIndex(const UResourceBundle *resB,
00698 int32_t stringIndex,
00699 char *dest, int32_t *pLength,
00700 UBool forceCopy,
00701 UErrorCode *status);
00702
00715 U_CAPI UResourceBundle* U_EXPORT2
00716 ures_getByKey(const UResourceBundle *resourceBundle,
00717 const char* key,
00718 UResourceBundle *fillIn,
00719 UErrorCode *status);
00720
00733 U_CAPI const UChar* U_EXPORT2
00734 ures_getStringByKey(const UResourceBundle *resB,
00735 const char* key,
00736 int32_t* len,
00737 UErrorCode *status);
00738
00789 U_CAPI const char * U_EXPORT2
00790 ures_getUTF8StringByKey(const UResourceBundle *resB,
00791 const char *key,
00792 char *dest, int32_t *pLength,
00793 UBool forceCopy,
00794 UErrorCode *status);
00795
00796 #if U_SHOW_CPLUSPLUS_API
00797 #include "unicode/unistr.h"
00798
00799 U_NAMESPACE_BEGIN
00811 inline UnicodeString
00812 ures_getUnicodeString(const UResourceBundle *resB, UErrorCode* status) {
00813 UnicodeString result;
00814 int32_t len = 0;
00815 const UChar *r = ures_getString(resB, &len, status);
00816 if(U_SUCCESS(*status)) {
00817 result.setTo(true, r, len);
00818 } else {
00819 result.setToBogus();
00820 }
00821 return result;
00822 }
00823
00836 inline UnicodeString
00837 ures_getNextUnicodeString(UResourceBundle *resB, const char ** key, UErrorCode* status) {
00838 UnicodeString result;
00839 int32_t len = 0;
00840 const UChar* r = ures_getNextString(resB, &len, key, status);
00841 if(U_SUCCESS(*status)) {
00842 result.setTo(true, r, len);
00843 } else {
00844 result.setToBogus();
00845 }
00846 return result;
00847 }
00848
00858 inline UnicodeString
00859 ures_getUnicodeStringByIndex(const UResourceBundle *resB, int32_t indexS, UErrorCode* status) {
00860 UnicodeString result;
00861 int32_t len = 0;
00862 const UChar* r = ures_getStringByIndex(resB, indexS, &len, status);
00863 if(U_SUCCESS(*status)) {
00864 result.setTo(true, r, len);
00865 } else {
00866 result.setToBogus();
00867 }
00868 return result;
00869 }
00870
00881 inline UnicodeString
00882 ures_getUnicodeStringByKey(const UResourceBundle *resB, const char* key, UErrorCode* status) {
00883 UnicodeString result;
00884 int32_t len = 0;
00885 const UChar* r = ures_getStringByKey(resB, key, &len, status);
00886 if(U_SUCCESS(*status)) {
00887 result.setTo(true, r, len);
00888 } else {
00889 result.setToBogus();
00890 }
00891 return result;
00892 }
00893
00894 U_NAMESPACE_END
00895
00896 #endif
00897
00906 U_CAPI UEnumeration* U_EXPORT2
00907 ures_openAvailableLocales(const char *packageName, UErrorCode *status);
00908
00909
00910 #endif
00911