ures.h

Go to the documentation of this file.
00001 /*
00002 **********************************************************************
00003 *   Copyright (C) 1997-2005, 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 #ifndef U_HIDE_DEPRECATED_API
00113 
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,
00129 #endif /* U_HIDE_DEPRECATED_API */
00130 
00132     RES_RESERVED=15
00133 } UResType;
00134 
00135 /*
00136  * Functions to create and destroy resource bundles.
00137  */
00138 
00167 U_STABLE UResourceBundle*  U_EXPORT2 
00168 ures_open(const char*    packageName,
00169           const char*  locale, 
00170           UErrorCode*     status);
00171 
00172 
00190 U_STABLE UResourceBundle* U_EXPORT2 
00191 ures_openDirect(const char* packageName, 
00192                 const char* locale, 
00193                 UErrorCode* status);
00194 
00213 U_STABLE UResourceBundle* U_EXPORT2 
00214 ures_openU(const UChar* packageName, 
00215            const char* locale, 
00216            UErrorCode* status);
00217 
00234 U_DEPRECATED int32_t U_EXPORT2 
00235 ures_countArrayItems(const UResourceBundle* resourceBundle,
00236                      const char* resourceKey,
00237                      UErrorCode* err);
00246 U_STABLE void U_EXPORT2 
00247 ures_close(UResourceBundle* resourceBundle);
00248 
00259 U_DEPRECATED const char* U_EXPORT2 
00260 ures_getVersionNumber(const UResourceBundle*   resourceBundle);
00261 
00271 U_STABLE void U_EXPORT2 
00272 ures_getVersion(const UResourceBundle* resB, 
00273                 UVersionInfo versionInfo);
00274 
00287 U_DEPRECATED const char* U_EXPORT2 
00288 ures_getLocale(const UResourceBundle* resourceBundle, 
00289                UErrorCode* status);
00290 
00291 
00304 U_DRAFT const char* U_EXPORT2 
00305 ures_getLocaleByType(const UResourceBundle* resourceBundle, 
00306                      ULocDataLocaleType type, 
00307                      UErrorCode* status);
00308 
00309 
00326 U_INTERNAL void U_EXPORT2 
00327 ures_openFillIn(UResourceBundle *r, 
00328                 const char* packageName,
00329                 const char* localeID, 
00330                 UErrorCode* status);
00331 
00349 U_STABLE const UChar* U_EXPORT2 
00350 ures_getString(const UResourceBundle* resourceBundle, 
00351                int32_t* len, 
00352                UErrorCode* status);
00353 
00371 U_STABLE const uint8_t* U_EXPORT2 
00372 ures_getBinary(const UResourceBundle* resourceBundle, 
00373                int32_t* len, 
00374                UErrorCode* status);
00375 
00393 U_STABLE const int32_t* U_EXPORT2 
00394 ures_getIntVector(const UResourceBundle* resourceBundle, 
00395                   int32_t* len, 
00396                   UErrorCode* status);
00397 
00414 U_STABLE uint32_t U_EXPORT2 
00415 ures_getUInt(const UResourceBundle* resourceBundle, 
00416              UErrorCode *status);
00417 
00434 U_STABLE int32_t U_EXPORT2 
00435 ures_getInt(const UResourceBundle* resourceBundle, 
00436             UErrorCode *status);
00437 
00448 U_STABLE int32_t U_EXPORT2 
00449 ures_getSize(const UResourceBundle *resourceBundle);
00450 
00459 U_STABLE UResType U_EXPORT2 
00460 ures_getType(const UResourceBundle *resourceBundle);
00461 
00470 U_STABLE const char * U_EXPORT2 
00471 ures_getKey(const UResourceBundle *resourceBundle);
00472 
00473 /* ITERATION API 
00474     This API provides means for iterating through a resource
00475 */
00476 
00483 U_STABLE void U_EXPORT2 
00484 ures_resetIterator(UResourceBundle *resourceBundle);
00485 
00493 U_STABLE UBool U_EXPORT2 
00494 ures_hasNext(const UResourceBundle *resourceBundle);
00495 
00508 U_STABLE UResourceBundle* U_EXPORT2 
00509 ures_getNextResource(UResourceBundle *resourceBundle, 
00510                      UResourceBundle *fillIn, 
00511                      UErrorCode *status);
00512 
00525 U_STABLE const UChar* U_EXPORT2 
00526 ures_getNextString(UResourceBundle *resourceBundle, 
00527                    int32_t* len, 
00528                    const char ** key, 
00529                    UErrorCode *status);
00530 
00543 U_STABLE UResourceBundle* U_EXPORT2 
00544 ures_getByIndex(const UResourceBundle *resourceBundle, 
00545                 int32_t indexR, 
00546                 UResourceBundle *fillIn, 
00547                 UErrorCode *status);
00548 
00560 U_STABLE const UChar* U_EXPORT2 
00561 ures_getStringByIndex(const UResourceBundle *resourceBundle, 
00562                       int32_t indexS, 
00563                       int32_t* len, 
00564                       UErrorCode *status);
00565 
00578 U_STABLE UResourceBundle* U_EXPORT2 
00579 ures_getByKey(const UResourceBundle *resourceBundle, 
00580               const char* key, 
00581               UResourceBundle *fillIn, 
00582               UErrorCode *status);
00583 
00596 U_STABLE const UChar* U_EXPORT2 
00597 ures_getStringByKey(const UResourceBundle *resB, 
00598                     const char* key, 
00599                     int32_t* len, 
00600                     UErrorCode *status);
00601 
00602 #ifdef XP_CPLUSPLUS
00603 #include "unicode/unistr.h"
00604 
00605 U_NAMESPACE_BEGIN
00617 inline UnicodeString 
00618 ures_getUnicodeString(const UResourceBundle *resB, 
00619                       UErrorCode* status) 
00620 {
00621     int32_t len = 0;
00622     const UChar *r = ures_getString(resB, &len, status);
00623     return UnicodeString(TRUE, r, len);
00624 }
00625 
00636 inline UnicodeString 
00637 ures_getNextUnicodeString(UResourceBundle *resB, 
00638                           const char ** key, 
00639                           UErrorCode* status) 
00640 {
00641     int32_t len = 0;
00642     const UChar* r = ures_getNextString(resB, &len, key, status);
00643     return UnicodeString(TRUE, r, len);
00644 }
00645 
00655 inline UnicodeString 
00656 ures_getUnicodeStringByIndex(const UResourceBundle *resB, 
00657                              int32_t indexS, 
00658                              UErrorCode* status) 
00659 {
00660     int32_t len = 0;
00661     const UChar* r = ures_getStringByIndex(resB, indexS, &len, status);
00662     return UnicodeString(TRUE, r, len);
00663 }
00664 
00675 inline UnicodeString 
00676 ures_getUnicodeStringByKey(const UResourceBundle *resB, 
00677                            const char* key, 
00678                            UErrorCode* status) 
00679 {
00680     int32_t len = 0;
00681     const UChar* r = ures_getStringByKey(resB, key, &len, status);
00682     return UnicodeString(TRUE, r, len);
00683 }
00684 
00685 U_NAMESPACE_END
00686 
00687 #endif
00688 
00689 
00707 U_INTERNAL UResourceBundle* U_EXPORT2 
00708 ures_getByKeyWithFallback(const UResourceBundle *resB, 
00709                           const char* inKey, 
00710                           UResourceBundle *fillIn, 
00711                           UErrorCode *status);
00712 
00713 
00722 U_DRAFT UEnumeration* U_EXPORT2
00723 ures_openAvailableLocales(const char *packageName, UErrorCode *status);
00724 
00725 
00726 #endif /*_URES*/
00727 /*eof*/

Generated on Tue Feb 28 01:37:40 2006 for ICU 3.4 by  doxygen 1.4.4