|
ICU 73.2
73.2
|
00001 // © 2016 and later: Unicode, Inc. and others. 00002 // License & terms of use: http://www.unicode.org/copyright.html 00003 /* 00004 ********************************************************************** 00005 * Copyright (C) 1997-2016, International Business Machines 00006 * Corporation and others. All Rights Reserved. 00007 ********************************************************************** 00008 * 00009 * File URES.H (formerly CRESBUND.H) 00010 * 00011 * Modification History: 00012 * 00013 * Date Name Description 00014 * 04/01/97 aliu Creation. 00015 * 02/22/99 damiba overhaul. 00016 * 04/04/99 helena Fixed internal header inclusion. 00017 * 04/15/99 Madhu Updated Javadoc 00018 * 06/14/99 stephen Removed functions taking a filename suffix. 00019 * 07/20/99 stephen Language-independent typedef to void* 00020 * 11/09/99 weiv Added ures_getLocale() 00021 * 06/24/02 weiv Added support for resource sharing 00022 ****************************************************************************** 00023 */ 00024 00025 #ifndef URES_H 00026 #define URES_H 00027 00028 #include "unicode/char16ptr.h" 00029 #include "unicode/utypes.h" 00030 #include "unicode/uloc.h" 00031 00032 #if U_SHOW_CPLUSPLUS_API 00033 #include "unicode/localpointer.h" 00034 #endif // U_SHOW_CPLUSPLUS_API 00035 00058 struct UResourceBundle; 00059 00063 typedef struct UResourceBundle UResourceBundle; 00064 00070 typedef enum { 00072 URES_NONE=-1, 00073 00075 URES_STRING=0, 00076 00078 URES_BINARY=1, 00079 00081 URES_TABLE=2, 00082 00090 URES_ALIAS=3, 00091 00099 URES_INT=7, 00100 00102 URES_ARRAY=8, 00103 00109 URES_INT_VECTOR = 14, 00110 #ifndef U_HIDE_DEPRECATED_API 00111 00112 RES_NONE=URES_NONE, 00114 RES_STRING=URES_STRING, 00116 RES_BINARY=URES_BINARY, 00118 RES_TABLE=URES_TABLE, 00120 RES_ALIAS=URES_ALIAS, 00122 RES_INT=URES_INT, 00124 RES_ARRAY=URES_ARRAY, 00126 RES_INT_VECTOR=URES_INT_VECTOR, 00128 RES_RESERVED=15, 00129 00134 URES_LIMIT = 16 00135 #endif // U_HIDE_DEPRECATED_API 00136 } UResType; 00137 00138 /* 00139 * Functions to create and destroy resource bundles. 00140 */ 00141 00170 U_CAPI UResourceBundle* U_EXPORT2 00171 ures_open(const char* packageName, 00172 const char* locale, 00173 UErrorCode* status); 00174 00175 00193 U_CAPI UResourceBundle* U_EXPORT2 00194 ures_openDirect(const char* packageName, 00195 const char* locale, 00196 UErrorCode* status); 00197 00216 U_CAPI UResourceBundle* U_EXPORT2 00217 ures_openU(const UChar* packageName, 00218 const char* locale, 00219 UErrorCode* status); 00220 00221 #ifndef U_HIDE_DEPRECATED_API 00222 00238 U_DEPRECATED int32_t U_EXPORT2 00239 ures_countArrayItems(const UResourceBundle* resourceBundle, 00240 const char* resourceKey, 00241 UErrorCode* err); 00242 #endif /* U_HIDE_DEPRECATED_API */ 00243 00252 U_CAPI void U_EXPORT2 00253 ures_close(UResourceBundle* resourceBundle); 00254 00255 #if U_SHOW_CPLUSPLUS_API 00256 00257 U_NAMESPACE_BEGIN 00258 00268 U_DEFINE_LOCAL_OPEN_POINTER(LocalUResourceBundlePointer, UResourceBundle, ures_close); 00269 00270 U_NAMESPACE_END 00271 00272 #endif 00273 00274 #ifndef U_HIDE_DEPRECATED_API 00275 00285 U_DEPRECATED const char* U_EXPORT2 00286 ures_getVersionNumber(const UResourceBundle* resourceBundle); 00287 #endif /* U_HIDE_DEPRECATED_API */ 00288 00298 U_CAPI void U_EXPORT2 00299 ures_getVersion(const UResourceBundle* resB, 00300 UVersionInfo versionInfo); 00301 00302 #ifndef U_HIDE_DEPRECATED_API 00303 00315 U_DEPRECATED const char* U_EXPORT2 00316 ures_getLocale(const UResourceBundle* resourceBundle, 00317 UErrorCode* status); 00318 #endif /* U_HIDE_DEPRECATED_API */ 00319 00332 U_CAPI const char* U_EXPORT2 00333 ures_getLocaleByType(const UResourceBundle* resourceBundle, 00334 ULocDataLocaleType type, 00335 UErrorCode* status); 00336 00337 00338 #ifndef U_HIDE_INTERNAL_API 00339 00355 U_CAPI void U_EXPORT2 00356 ures_openFillIn(UResourceBundle *r, 00357 const char* packageName, 00358 const char* localeID, 00359 UErrorCode* status); 00360 #endif /* U_HIDE_INTERNAL_API */ 00361 00379 U_CAPI const UChar* U_EXPORT2 00380 ures_getString(const UResourceBundle* resourceBundle, 00381 int32_t* len, 00382 UErrorCode* status); 00383 00431 U_CAPI const char * U_EXPORT2 00432 ures_getUTF8String(const UResourceBundle *resB, 00433 char *dest, int32_t *length, 00434 UBool forceCopy, 00435 UErrorCode *status); 00436 00454 U_CAPI const uint8_t* U_EXPORT2 00455 ures_getBinary(const UResourceBundle* resourceBundle, 00456 int32_t* len, 00457 UErrorCode* status); 00458 00476 U_CAPI const int32_t* U_EXPORT2 00477 ures_getIntVector(const UResourceBundle* resourceBundle, 00478 int32_t* len, 00479 UErrorCode* status); 00480 00497 U_CAPI uint32_t U_EXPORT2 00498 ures_getUInt(const UResourceBundle* resourceBundle, 00499 UErrorCode *status); 00500 00517 U_CAPI int32_t U_EXPORT2 00518 ures_getInt(const UResourceBundle* resourceBundle, 00519 UErrorCode *status); 00520 00531 U_CAPI int32_t U_EXPORT2 00532 ures_getSize(const UResourceBundle *resourceBundle); 00533 00542 U_CAPI UResType U_EXPORT2 00543 ures_getType(const UResourceBundle *resourceBundle); 00544 00553 U_CAPI const char * U_EXPORT2 00554 ures_getKey(const UResourceBundle *resourceBundle); 00555 00556 /* ITERATION API 00557 This API provides means for iterating through a resource 00558 */ 00559 00566 U_CAPI void U_EXPORT2 00567 ures_resetIterator(UResourceBundle *resourceBundle); 00568 00576 U_CAPI UBool U_EXPORT2 00577 ures_hasNext(const UResourceBundle *resourceBundle); 00578 00591 U_CAPI UResourceBundle* U_EXPORT2 00592 ures_getNextResource(UResourceBundle *resourceBundle, 00593 UResourceBundle *fillIn, 00594 UErrorCode *status); 00595 00608 U_CAPI const UChar* U_EXPORT2 00609 ures_getNextString(UResourceBundle *resourceBundle, 00610 int32_t* len, 00611 const char ** key, 00612 UErrorCode *status); 00613 00626 U_CAPI UResourceBundle* U_EXPORT2 00627 ures_getByIndex(const UResourceBundle *resourceBundle, 00628 int32_t indexR, 00629 UResourceBundle *fillIn, 00630 UErrorCode *status); 00631 00643 U_CAPI const UChar* U_EXPORT2 00644 ures_getStringByIndex(const UResourceBundle *resourceBundle, 00645 int32_t indexS, 00646 int32_t* len, 00647 UErrorCode *status); 00648 00697 U_CAPI const char * U_EXPORT2 00698 ures_getUTF8StringByIndex(const UResourceBundle *resB, 00699 int32_t stringIndex, 00700 char *dest, int32_t *pLength, 00701 UBool forceCopy, 00702 UErrorCode *status); 00703 00716 U_CAPI UResourceBundle* U_EXPORT2 00717 ures_getByKey(const UResourceBundle *resourceBundle, 00718 const char* key, 00719 UResourceBundle *fillIn, 00720 UErrorCode *status); 00721 00734 U_CAPI const UChar* U_EXPORT2 00735 ures_getStringByKey(const UResourceBundle *resB, 00736 const char* key, 00737 int32_t* len, 00738 UErrorCode *status); 00739 00790 U_CAPI const char * U_EXPORT2 00791 ures_getUTF8StringByKey(const UResourceBundle *resB, 00792 const char *key, 00793 char *dest, int32_t *pLength, 00794 UBool forceCopy, 00795 UErrorCode *status); 00796 00797 #if U_SHOW_CPLUSPLUS_API 00798 #include "unicode/unistr.h" 00799 00800 U_NAMESPACE_BEGIN 00812 inline UnicodeString 00813 ures_getUnicodeString(const UResourceBundle *resB, UErrorCode* status) { 00814 UnicodeString result; 00815 int32_t len = 0; 00816 const char16_t *r = ConstChar16Ptr(ures_getString(resB, &len, status)); 00817 if(U_SUCCESS(*status)) { 00818 result.setTo(true, r, len); 00819 } else { 00820 result.setToBogus(); 00821 } 00822 return result; 00823 } 00824 00837 inline UnicodeString 00838 ures_getNextUnicodeString(UResourceBundle *resB, const char ** key, UErrorCode* status) { 00839 UnicodeString result; 00840 int32_t len = 0; 00841 const char16_t* r = ConstChar16Ptr(ures_getNextString(resB, &len, key, status)); 00842 if(U_SUCCESS(*status)) { 00843 result.setTo(true, r, len); 00844 } else { 00845 result.setToBogus(); 00846 } 00847 return result; 00848 } 00849 00859 inline UnicodeString 00860 ures_getUnicodeStringByIndex(const UResourceBundle *resB, int32_t indexS, UErrorCode* status) { 00861 UnicodeString result; 00862 int32_t len = 0; 00863 const char16_t* r = ConstChar16Ptr(ures_getStringByIndex(resB, indexS, &len, status)); 00864 if(U_SUCCESS(*status)) { 00865 result.setTo(true, r, len); 00866 } else { 00867 result.setToBogus(); 00868 } 00869 return result; 00870 } 00871 00882 inline UnicodeString 00883 ures_getUnicodeStringByKey(const UResourceBundle *resB, const char* key, UErrorCode* status) { 00884 UnicodeString result; 00885 int32_t len = 0; 00886 const char16_t* r = ConstChar16Ptr(ures_getStringByKey(resB, key, &len, status)); 00887 if(U_SUCCESS(*status)) { 00888 result.setTo(true, r, len); 00889 } else { 00890 result.setToBogus(); 00891 } 00892 return result; 00893 } 00894 00895 U_NAMESPACE_END 00896 00897 #endif 00898 00907 U_CAPI UEnumeration* U_EXPORT2 00908 ures_openAvailableLocales(const char *packageName, UErrorCode *status); 00909 00910 00911 #endif /*_URES*/ 00912 /*eof*/
1.7.6.1