Main Page | Class Hierarchy | Alphabetical List | Data Structures | File List | Data Fields | Globals | Related Pages

ures.h

Go to the documentation of this file.
00001 /* 00002 ********************************************************************** 00003 * Copyright (C) 1997-2003, 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 00051 struct UResourceBundle; 00052 00056 typedef struct UResourceBundle UResourceBundle; 00057 00063 typedef enum { 00065 URES_NONE=-1, 00066 00068 URES_STRING=0, 00069 00071 URES_BINARY=1, 00072 00074 URES_TABLE=2, 00075 00083 URES_ALIAS=3, 00084 00091 URES_TABLE32=4, 00092 00100 URES_INT=7, 00101 00103 URES_ARRAY=8, 00104 00110 URES_INT_VECTOR=14, 00111 00112 00114 RES_NONE=URES_NONE, 00116 RES_STRING=URES_STRING, 00118 RES_BINARY=URES_BINARY, 00120 RES_TABLE=URES_TABLE, 00122 RES_ALIAS=URES_ALIAS, 00124 RES_INT=URES_INT, 00126 RES_ARRAY=URES_ARRAY, 00128 RES_INT_VECTOR=URES_INT_VECTOR, 00130 RES_RESERVED=15 00131 } UResType; 00132 00133 /* 00134 * Functions to create and destroy resource bundles. 00135 */ 00136 00164 U_CAPI UResourceBundle* U_EXPORT2 00165 ures_open(const char* path, 00166 const char* locale, 00167 UErrorCode* status); 00168 00169 00186 U_CAPI UResourceBundle* U_EXPORT2 00187 ures_openDirect(const char* path, 00188 const char* locale, 00189 UErrorCode* status); 00190 00206 U_CAPI UResourceBundle* U_EXPORT2 00207 ures_openU(const UChar* path, 00208 const char* locale, 00209 UErrorCode* status); 00210 00227 U_CAPI int32_t U_EXPORT2 00228 ures_countArrayItems(const UResourceBundle* resourceBundle, 00229 const char* resourceKey, 00230 UErrorCode* err); 00239 U_CAPI void U_EXPORT2 00240 ures_close(UResourceBundle* resourceBundle); 00241 00252 U_CAPI const char* U_EXPORT2 00253 ures_getVersionNumber(const UResourceBundle* resourceBundle); 00254 00264 U_CAPI void U_EXPORT2 00265 ures_getVersion(const UResourceBundle* resB, 00266 UVersionInfo versionInfo); 00267 00280 U_CAPI const char* U_EXPORT2 00281 ures_getLocale(const UResourceBundle* resourceBundle, 00282 UErrorCode* status); 00283 00284 00297 U_CAPI const char* U_EXPORT2 00298 ures_getLocaleByType(const UResourceBundle* resourceBundle, 00299 ULocDataLocaleType type, 00300 UErrorCode* status); 00301 00302 00316 U_CAPI void U_EXPORT2 00317 ures_openFillIn(UResourceBundle *r, 00318 const char* path, 00319 const char* localeID, 00320 UErrorCode* status); 00321 00339 U_CAPI const UChar* U_EXPORT2 00340 ures_getString(const UResourceBundle* resourceBundle, 00341 int32_t* len, 00342 UErrorCode* status); 00343 00361 U_CAPI const uint8_t* U_EXPORT2 00362 ures_getBinary(const UResourceBundle* resourceBundle, 00363 int32_t* len, 00364 UErrorCode* status); 00365 00383 U_CAPI const int32_t* U_EXPORT2 00384 ures_getIntVector(const UResourceBundle* resourceBundle, 00385 int32_t* len, 00386 UErrorCode* status); 00387 00404 U_CAPI uint32_t U_EXPORT2 00405 ures_getUInt(const UResourceBundle* resourceBundle, 00406 UErrorCode *status); 00407 00424 U_CAPI int32_t U_EXPORT2 00425 ures_getInt(const UResourceBundle* resourceBundle, 00426 UErrorCode *status); 00427 00438 U_CAPI int32_t U_EXPORT2 00439 ures_getSize(UResourceBundle *resourceBundle); 00440 00449 U_CAPI UResType U_EXPORT2 00450 ures_getType(UResourceBundle *resourceBundle); 00451 00460 U_CAPI const char * U_EXPORT2 00461 ures_getKey(UResourceBundle *resourceBundle); 00462 00463 /* ITERATION API 00464 This API provides means for iterating through a resource 00465 */ 00466 00473 U_CAPI void U_EXPORT2 00474 ures_resetIterator(UResourceBundle *resourceBundle); 00475 00483 U_CAPI UBool U_EXPORT2 00484 ures_hasNext(UResourceBundle *resourceBundle); 00485 00498 U_CAPI UResourceBundle* U_EXPORT2 00499 ures_getNextResource(UResourceBundle *resourceBundle, 00500 UResourceBundle *fillIn, 00501 UErrorCode *status); 00502 00515 U_CAPI const UChar* U_EXPORT2 00516 ures_getNextString(UResourceBundle *resourceBundle, 00517 int32_t* len, 00518 const char ** key, 00519 UErrorCode *status); 00520 00533 U_CAPI UResourceBundle* U_EXPORT2 00534 ures_getByIndex(const UResourceBundle *resourceBundle, 00535 int32_t indexR, 00536 UResourceBundle *fillIn, 00537 UErrorCode *status); 00538 00550 U_CAPI const UChar* U_EXPORT2 00551 ures_getStringByIndex(const UResourceBundle *resourceBundle, 00552 int32_t indexS, 00553 int32_t* len, 00554 UErrorCode *status); 00555 00568 U_CAPI UResourceBundle* U_EXPORT2 00569 ures_getByKey(const UResourceBundle *resourceBundle, 00570 const char* key, 00571 UResourceBundle *fillIn, 00572 UErrorCode *status); 00573 00586 U_CAPI const UChar* U_EXPORT2 00587 ures_getStringByKey(const UResourceBundle *resB, 00588 const char* key, 00589 int32_t* len, 00590 UErrorCode *status); 00591 00592 #ifdef XP_CPLUSPLUS 00593 #include "unicode/unistr.h" 00594 00595 U_NAMESPACE_BEGIN 00607 inline UnicodeString 00608 ures_getUnicodeString(const UResourceBundle *resB, 00609 UErrorCode* status) 00610 { 00611 int32_t len = 0; 00612 const UChar *r = ures_getString(resB, &len, status); 00613 return UnicodeString(TRUE, r, len); 00614 } 00615 00626 inline UnicodeString 00627 ures_getNextUnicodeString(UResourceBundle *resB, 00628 const char ** key, 00629 UErrorCode* status) 00630 { 00631 int32_t len = 0; 00632 const UChar* r = ures_getNextString(resB, &len, key, status); 00633 return UnicodeString(TRUE, r, len); 00634 } 00635 00645 inline UnicodeString 00646 ures_getUnicodeStringByIndex(const UResourceBundle *resB, 00647 int32_t indexS, 00648 UErrorCode* status) 00649 { 00650 int32_t len = 0; 00651 const UChar* r = ures_getStringByIndex(resB, indexS, &len, status); 00652 return UnicodeString(TRUE, r, len); 00653 } 00654 00665 inline UnicodeString 00666 ures_getUnicodeStringByKey(const UResourceBundle *resB, 00667 const char* key, 00668 UErrorCode* status) 00669 { 00670 int32_t len = 0; 00671 const UChar* r = ures_getStringByKey(resB, key, &len, status); 00672 return UnicodeString(TRUE, r, len); 00673 } 00674 00675 U_NAMESPACE_END 00676 00677 #endif 00678 00679 #endif /*_URES*/ 00680 /*eof*/

Generated on Wed Sep 15 17:18:10 2004 for ICU 2.8 by doxygen 1.3.8