ICU 4.8.1.1
4.8.1.1
|
00001 /* 00002 ********************************************************************** 00003 * Copyright (C) 1997-2010, International Business Machines 00004 * Corporation and others. All Rights Reserved. 00005 ********************************************************************** 00006 * 00007 * File URES.H (formerly CRESBUND.H) 00008 * 00009 * Modification History: 00010 * 00011 * Date Name Description 00012 * 04/01/97 aliu Creation. 00013 * 02/22/99 damiba overhaul. 00014 * 04/04/99 helena Fixed internal header inclusion. 00015 * 04/15/99 Madhu Updated Javadoc 00016 * 06/14/99 stephen Removed functions taking a filename suffix. 00017 * 07/20/99 stephen Language-independent ypedef to void* 00018 * 11/09/99 weiv Added ures_getLocale() 00019 * 06/24/02 weiv Added support for resource sharing 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 /* U_HIDE_DEPRECATED_API */ 00124 00125 URES_LIMIT = 16 00126 } UResType; 00127 00128 /* 00129 * Functions to create and destroy resource bundles. 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 00227 U_DEPRECATED int32_t U_EXPORT2 00228 ures_countArrayItems(const UResourceBundle* resourceBundle, 00229 const char* resourceKey, 00230 UErrorCode* err); 00239 U_STABLE void U_EXPORT2 00240 ures_close(UResourceBundle* resourceBundle); 00241 00242 #if U_SHOW_CPLUSPLUS_API 00243 00244 U_NAMESPACE_BEGIN 00245 00255 U_DEFINE_LOCAL_OPEN_POINTER(LocalUResourceBundlePointer, UResourceBundle, ures_close); 00256 00257 U_NAMESPACE_END 00258 00259 #endif 00260 00271 U_DEPRECATED const char* U_EXPORT2 00272 ures_getVersionNumber(const UResourceBundle* resourceBundle); 00273 00283 U_STABLE void U_EXPORT2 00284 ures_getVersion(const UResourceBundle* resB, 00285 UVersionInfo versionInfo); 00286 00299 U_DEPRECATED const char* U_EXPORT2 00300 ures_getLocale(const UResourceBundle* resourceBundle, 00301 UErrorCode* status); 00302 00303 00316 U_STABLE const char* U_EXPORT2 00317 ures_getLocaleByType(const UResourceBundle* resourceBundle, 00318 ULocDataLocaleType type, 00319 UErrorCode* status); 00320 00321 00338 U_INTERNAL void U_EXPORT2 00339 ures_openFillIn(UResourceBundle *r, 00340 const char* packageName, 00341 const char* localeID, 00342 UErrorCode* status); 00343 00361 U_STABLE const UChar* U_EXPORT2 00362 ures_getString(const UResourceBundle* resourceBundle, 00363 int32_t* len, 00364 UErrorCode* status); 00365 00413 U_STABLE const char * U_EXPORT2 00414 ures_getUTF8String(const UResourceBundle *resB, 00415 char *dest, int32_t *length, 00416 UBool forceCopy, 00417 UErrorCode *status); 00418 00436 U_STABLE const uint8_t* U_EXPORT2 00437 ures_getBinary(const UResourceBundle* resourceBundle, 00438 int32_t* len, 00439 UErrorCode* status); 00440 00458 U_STABLE const int32_t* U_EXPORT2 00459 ures_getIntVector(const UResourceBundle* resourceBundle, 00460 int32_t* len, 00461 UErrorCode* status); 00462 00479 U_STABLE uint32_t U_EXPORT2 00480 ures_getUInt(const UResourceBundle* resourceBundle, 00481 UErrorCode *status); 00482 00499 U_STABLE int32_t U_EXPORT2 00500 ures_getInt(const UResourceBundle* resourceBundle, 00501 UErrorCode *status); 00502 00513 U_STABLE int32_t U_EXPORT2 00514 ures_getSize(const UResourceBundle *resourceBundle); 00515 00524 U_STABLE UResType U_EXPORT2 00525 ures_getType(const UResourceBundle *resourceBundle); 00526 00535 U_STABLE const char * U_EXPORT2 00536 ures_getKey(const UResourceBundle *resourceBundle); 00537 00538 /* ITERATION API 00539 This API provides means for iterating through a resource 00540 */ 00541 00548 U_STABLE void U_EXPORT2 00549 ures_resetIterator(UResourceBundle *resourceBundle); 00550 00558 U_STABLE UBool U_EXPORT2 00559 ures_hasNext(const UResourceBundle *resourceBundle); 00560 00573 U_STABLE UResourceBundle* U_EXPORT2 00574 ures_getNextResource(UResourceBundle *resourceBundle, 00575 UResourceBundle *fillIn, 00576 UErrorCode *status); 00577 00590 U_STABLE const UChar* U_EXPORT2 00591 ures_getNextString(UResourceBundle *resourceBundle, 00592 int32_t* len, 00593 const char ** key, 00594 UErrorCode *status); 00595 00608 U_STABLE UResourceBundle* U_EXPORT2 00609 ures_getByIndex(const UResourceBundle *resourceBundle, 00610 int32_t indexR, 00611 UResourceBundle *fillIn, 00612 UErrorCode *status); 00613 00625 U_STABLE const UChar* U_EXPORT2 00626 ures_getStringByIndex(const UResourceBundle *resourceBundle, 00627 int32_t indexS, 00628 int32_t* len, 00629 UErrorCode *status); 00630 00679 U_STABLE const char * U_EXPORT2 00680 ures_getUTF8StringByIndex(const UResourceBundle *resB, 00681 int32_t stringIndex, 00682 char *dest, int32_t *pLength, 00683 UBool forceCopy, 00684 UErrorCode *status); 00685 00698 U_STABLE UResourceBundle* U_EXPORT2 00699 ures_getByKey(const UResourceBundle *resourceBundle, 00700 const char* key, 00701 UResourceBundle *fillIn, 00702 UErrorCode *status); 00703 00716 U_STABLE const UChar* U_EXPORT2 00717 ures_getStringByKey(const UResourceBundle *resB, 00718 const char* key, 00719 int32_t* len, 00720 UErrorCode *status); 00721 00772 U_STABLE const char * U_EXPORT2 00773 ures_getUTF8StringByKey(const UResourceBundle *resB, 00774 const char *key, 00775 char *dest, int32_t *pLength, 00776 UBool forceCopy, 00777 UErrorCode *status); 00778 00779 #if U_SHOW_CPLUSPLUS_API 00780 #include "unicode/unistr.h" 00781 00782 U_NAMESPACE_BEGIN 00794 inline UnicodeString 00795 ures_getUnicodeString(const UResourceBundle *resB, 00796 UErrorCode* status) 00797 { 00798 int32_t len = 0; 00799 const UChar *r = ures_getString(resB, &len, status); 00800 return UnicodeString(TRUE, r, len); 00801 } 00802 00813 inline UnicodeString 00814 ures_getNextUnicodeString(UResourceBundle *resB, 00815 const char ** key, 00816 UErrorCode* status) 00817 { 00818 int32_t len = 0; 00819 const UChar* r = ures_getNextString(resB, &len, key, status); 00820 return UnicodeString(TRUE, r, len); 00821 } 00822 00832 inline UnicodeString 00833 ures_getUnicodeStringByIndex(const UResourceBundle *resB, 00834 int32_t indexS, 00835 UErrorCode* status) 00836 { 00837 int32_t len = 0; 00838 const UChar* r = ures_getStringByIndex(resB, indexS, &len, status); 00839 return UnicodeString(TRUE, r, len); 00840 } 00841 00852 inline UnicodeString 00853 ures_getUnicodeStringByKey(const UResourceBundle *resB, 00854 const char* key, 00855 UErrorCode* status) 00856 { 00857 int32_t len = 0; 00858 const UChar* r = ures_getStringByKey(resB, key, &len, status); 00859 return UnicodeString(TRUE, r, len); 00860 } 00861 00862 U_NAMESPACE_END 00863 00864 #endif 00865 00874 U_STABLE UEnumeration* U_EXPORT2 00875 ures_openAvailableLocales(const char *packageName, UErrorCode *status); 00876 00877 00878 #endif /*_URES*/ 00879 /*eof*/