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 
00092     URES_INT=7,
00093 
00095     URES_ARRAY=8,
00096 
00102     URES_INT_VECTOR=14,
00103 
00104 
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 } UResType;
00124 
00125 /*
00126  * Functions to create and destroy resource bundles.
00127  */
00128 
00156 U_CAPI UResourceBundle*  U_EXPORT2 
00157 ures_open(const char*    path,
00158           const char*  locale, 
00159           UErrorCode*     status);
00160 
00161 
00178 U_CAPI UResourceBundle* U_EXPORT2 
00179 ures_openDirect(const char* path, 
00180                 const char* locale, 
00181                 UErrorCode* status);
00182 
00198 U_CAPI UResourceBundle* U_EXPORT2 
00199 ures_openU(const UChar* path, 
00200            const char* locale, 
00201            UErrorCode* status);
00202 
00219 U_CAPI int32_t U_EXPORT2 
00220 ures_countArrayItems(const UResourceBundle* resourceBundle,
00221                      const char* resourceKey,
00222                      UErrorCode* err);
00231 U_CAPI void U_EXPORT2 
00232 ures_close(UResourceBundle* resourceBundle);
00233 
00244 U_CAPI const char* U_EXPORT2 
00245 ures_getVersionNumber(const UResourceBundle*   resourceBundle);
00246 
00256 U_CAPI void U_EXPORT2 
00257 ures_getVersion(const UResourceBundle* resB, 
00258                 UVersionInfo versionInfo);
00259 
00272 U_CAPI const char* U_EXPORT2 
00273 ures_getLocale(const UResourceBundle* resourceBundle, 
00274                UErrorCode* status);
00275 
00289 U_CAPI void U_EXPORT2 
00290 ures_openFillIn(UResourceBundle *r, 
00291                 const char* path,
00292                 const char* localeID, 
00293                 UErrorCode* status);
00294 
00312 U_CAPI const UChar* U_EXPORT2 
00313 ures_getString(const UResourceBundle* resourceBundle, 
00314                int32_t* len, 
00315                UErrorCode* status);
00316 
00334 U_CAPI const uint8_t* U_EXPORT2 
00335 ures_getBinary(const UResourceBundle* resourceBundle, 
00336                int32_t* len, 
00337                UErrorCode* status);
00338 
00356 U_CAPI const int32_t* U_EXPORT2 
00357 ures_getIntVector(const UResourceBundle* resourceBundle, 
00358                   int32_t* len, 
00359                   UErrorCode* status);
00360 
00377 U_CAPI uint32_t U_EXPORT2 
00378 ures_getUInt(const UResourceBundle* resourceBundle, 
00379              UErrorCode *status);
00380 
00397 U_CAPI int32_t U_EXPORT2 
00398 ures_getInt(const UResourceBundle* resourceBundle, 
00399             UErrorCode *status);
00400 
00412 U_CAPI int32_t U_EXPORT2 
00413 ures_getSize(UResourceBundle *resourceBundle);
00414 
00423 U_CAPI UResType U_EXPORT2 
00424 ures_getType(UResourceBundle *resourceBundle);
00425 
00434 U_CAPI const char * U_EXPORT2 
00435 ures_getKey(UResourceBundle *resourceBundle);
00436 
00437 /* ITERATION API 
00438     This API provides means for iterating through a resource
00439 */
00440 
00447 U_CAPI void U_EXPORT2 
00448 ures_resetIterator(UResourceBundle *resourceBundle);
00449 
00457 U_CAPI UBool U_EXPORT2 
00458 ures_hasNext(UResourceBundle *resourceBundle);
00459 
00472 U_CAPI UResourceBundle* U_EXPORT2 
00473 ures_getNextResource(UResourceBundle *resourceBundle, 
00474                      UResourceBundle *fillIn, 
00475                      UErrorCode *status);
00476 
00489 U_CAPI const UChar* U_EXPORT2 
00490 ures_getNextString(UResourceBundle *resourceBundle, 
00491                    int32_t* len, 
00492                    const char ** key, 
00493                    UErrorCode *status);
00494 
00507 U_CAPI UResourceBundle* U_EXPORT2 
00508 ures_getByIndex(const UResourceBundle *resourceBundle, 
00509                 int32_t indexR, 
00510                 UResourceBundle *fillIn, 
00511                 UErrorCode *status);
00512 
00524 U_CAPI const UChar* U_EXPORT2 
00525 ures_getStringByIndex(const UResourceBundle *resourceBundle, 
00526                       int32_t indexS, 
00527                       int32_t* len, 
00528                       UErrorCode *status);
00529 
00542 U_CAPI UResourceBundle* U_EXPORT2 
00543 ures_getByKey(const UResourceBundle *resourceBundle, 
00544               const char* key, 
00545               UResourceBundle *fillIn, 
00546               UErrorCode *status);
00547 
00560 U_CAPI const UChar* U_EXPORT2 
00561 ures_getStringByKey(const UResourceBundle *resB, 
00562                     const char* key, 
00563                     int32_t* len, 
00564                     UErrorCode *status);
00565 
00566 #ifdef XP_CPLUSPLUS
00567 #include "unicode/unistr.h"
00568 
00569 U_NAMESPACE_BEGIN
00581 inline UnicodeString 
00582 ures_getUnicodeString(const UResourceBundle *resB, 
00583                       UErrorCode* status) 
00584 {
00585     int32_t len = 0;
00586     const UChar *r = ures_getString(resB, &len, status);
00587     return UnicodeString(TRUE, r, len);
00588 }
00589 
00600 inline UnicodeString 
00601 ures_getNextUnicodeString(UResourceBundle *resB, 
00602                           const char ** key, 
00603                           UErrorCode* status) 
00604 {
00605     int32_t len = 0;
00606     const UChar* r = ures_getNextString(resB, &len, key, status);
00607     return UnicodeString(TRUE, r, len);
00608 }
00609 
00619 inline UnicodeString 
00620 ures_getUnicodeStringByIndex(const UResourceBundle *resB, 
00621                              int32_t indexS, 
00622                              UErrorCode* status) 
00623 {
00624     int32_t len = 0;
00625     const UChar* r = ures_getStringByIndex(resB, indexS, &len, status);
00626     return UnicodeString(TRUE, r, len);
00627 }
00628 
00639 inline UnicodeString 
00640 ures_getUnicodeStringByKey(const UResourceBundle *resB, 
00641                            const char* key, 
00642                            UErrorCode* status) 
00643 {
00644     int32_t len = 0;
00645     const UChar* r = ures_getStringByKey(resB, key, &len, status);
00646     return UnicodeString(TRUE, r, len);
00647 }
00648 
00649 U_NAMESPACE_END
00650 
00651 #endif
00652 
00653 #endif /*_URES*/
00654 /*eof*/

Generated on Wed Sep 3 17:47:10 2003 for ICU 2.6 by doxygen 1.3.2