- Main Page
- Related Pages
- Modules
- Data Structures
- Files

- Search for |

- File List
- Globals

# ures.h

Go to the documentation of this file.

    00001 /*
    00002 **********************************************************************
    00003 *   Copyright (C) 1997-2009, 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
    00085 #ifndef U_HIDE_INTERNAL_API
    00086
    00093     URES_TABLE32=4,
    00094
    00095 #endif /* U_HIDE_INTERNAL_API */
    00096
    00104     URES_INT=7,
    00105
    00107     URES_ARRAY=8,
    00108
    00114     URES_INT_VECTOR = 14,
    00115 #ifndef U_HIDE_DEPRECATED_API
    00116
    00117     RES_NONE=URES_NONE,
    00119     RES_STRING=URES_STRING,
    00121     RES_BINARY=URES_BINARY,
    00123     RES_TABLE=URES_TABLE,
    00125     RES_ALIAS=URES_ALIAS,
    00127     RES_INT=URES_INT,
    00129     RES_ARRAY=URES_ARRAY,
    00131     RES_INT_VECTOR=URES_INT_VECTOR,
    00133     RES_RESERVED=15,
    00134 #endif /* U_HIDE_DEPRECATED_API */
    00135
    00136     URES_LIMIT = 16
    00137 } UResType;
    00138
    00139 /*
    00140  * Functions to create and destroy resource bundles.
    00141  */
    00142
    00171 U_STABLE UResourceBundle*  U_EXPORT2
    00172 ures_open(const char*    packageName,
    00173           const char*  locale,
    00174           UErrorCode*     status);
    00175
    00176
    00194 U_STABLE UResourceBundle* U_EXPORT2
    00195 ures_openDirect(const char* packageName,
    00196                 const char* locale,
    00197                 UErrorCode* status);
    00198
    00217 U_STABLE UResourceBundle* U_EXPORT2
    00218 ures_openU(const UChar* packageName,
    00219            const char* locale,
    00220            UErrorCode* status);
    00221
    00238 U_DEPRECATED int32_t U_EXPORT2
    00239 ures_countArrayItems(const UResourceBundle* resourceBundle,
    00240                      const char* resourceKey,
    00241                      UErrorCode* err);
    00250 U_STABLE void U_EXPORT2
    00251 ures_close(UResourceBundle* resourceBundle);
    00252
    00263 U_DEPRECATED const char* U_EXPORT2
    00264 ures_getVersionNumber(const UResourceBundle*   resourceBundle);
    00265
    00275 U_STABLE void U_EXPORT2
    00276 ures_getVersion(const UResourceBundle* resB,
    00277                 UVersionInfo versionInfo);
    00278
    00291 U_DEPRECATED const char* U_EXPORT2
    00292 ures_getLocale(const UResourceBundle* resourceBundle,
    00293                UErrorCode* status);
    00294
    00295
    00308 U_STABLE const char* U_EXPORT2
    00309 ures_getLocaleByType(const UResourceBundle* resourceBundle,
    00310                      ULocDataLocaleType type,
    00311                      UErrorCode* status);
    00312
    00313
    00330 U_INTERNAL void U_EXPORT2
    00331 ures_openFillIn(UResourceBundle *r,
    00332                 const char* packageName,
    00333                 const char* localeID,
    00334                 UErrorCode* status);
    00335
    00353 U_STABLE const UChar* U_EXPORT2
    00354 ures_getString(const UResourceBundle* resourceBundle,
    00355                int32_t* len,
    00356                UErrorCode* status);
    00357
    00405 U_STABLE const char * U_EXPORT2
    00406 ures_getUTF8String(const UResourceBundle *resB,
    00407                    char *dest, int32_t *length,
    00408                    UBool forceCopy,
    00409                    UErrorCode *status);
    00410
    00428 U_STABLE const uint8_t* U_EXPORT2
    00429 ures_getBinary(const UResourceBundle* resourceBundle,
    00430                int32_t* len,
    00431                UErrorCode* status);
    00432
    00450 U_STABLE const int32_t* U_EXPORT2
    00451 ures_getIntVector(const UResourceBundle* resourceBundle,
    00452                   int32_t* len,
    00453                   UErrorCode* status);
    00454
    00471 U_STABLE uint32_t U_EXPORT2
    00472 ures_getUInt(const UResourceBundle* resourceBundle,
    00473              UErrorCode *status);
    00474
    00491 U_STABLE int32_t U_EXPORT2
    00492 ures_getInt(const UResourceBundle* resourceBundle,
    00493             UErrorCode *status);
    00494
    00505 U_STABLE int32_t U_EXPORT2
    00506 ures_getSize(const UResourceBundle *resourceBundle);
    00507
    00516 U_STABLE UResType U_EXPORT2
    00517 ures_getType(const UResourceBundle *resourceBundle);
    00518
    00527 U_STABLE const char * U_EXPORT2
    00528 ures_getKey(const UResourceBundle *resourceBundle);
    00529
    00530 /* ITERATION API
    00531     This API provides means for iterating through a resource
    00532 */
    00533
    00540 U_STABLE void U_EXPORT2
    00541 ures_resetIterator(UResourceBundle *resourceBundle);
    00542
    00550 U_STABLE UBool U_EXPORT2
    00551 ures_hasNext(const UResourceBundle *resourceBundle);
    00552
    00565 U_STABLE UResourceBundle* U_EXPORT2
    00566 ures_getNextResource(UResourceBundle *resourceBundle,
    00567                      UResourceBundle *fillIn,
    00568                      UErrorCode *status);
    00569
    00582 U_STABLE const UChar* U_EXPORT2
    00583 ures_getNextString(UResourceBundle *resourceBundle,
    00584                    int32_t* len,
    00585                    const char ** key,
    00586                    UErrorCode *status);
    00587
    00600 U_STABLE UResourceBundle* U_EXPORT2
    00601 ures_getByIndex(const UResourceBundle *resourceBundle,
    00602                 int32_t indexR,
    00603                 UResourceBundle *fillIn,
    00604                 UErrorCode *status);
    00605
    00617 U_STABLE const UChar* U_EXPORT2
    00618 ures_getStringByIndex(const UResourceBundle *resourceBundle,
    00619                       int32_t indexS,
    00620                       int32_t* len,
    00621                       UErrorCode *status);
    00622
    00671 U_STABLE const char * U_EXPORT2
    00672 ures_getUTF8StringByIndex(const UResourceBundle *resB,
    00673                           int32_t stringIndex,
    00674                           char *dest, int32_t *pLength,
    00675                           UBool forceCopy,
    00676                           UErrorCode *status);
    00677
    00690 U_STABLE UResourceBundle* U_EXPORT2
    00691 ures_getByKey(const UResourceBundle *resourceBundle,
    00692               const char* key,
    00693               UResourceBundle *fillIn,
    00694               UErrorCode *status);
    00695
    00708 U_STABLE const UChar* U_EXPORT2
    00709 ures_getStringByKey(const UResourceBundle *resB,
    00710                     const char* key,
    00711                     int32_t* len,
    00712                     UErrorCode *status);
    00713
    00764 U_STABLE const char * U_EXPORT2
    00765 ures_getUTF8StringByKey(const UResourceBundle *resB,
    00766                         const char *key,
    00767                         char *dest, int32_t *pLength,
    00768                         UBool forceCopy,
    00769                         UErrorCode *status);
    00770
    00771 #ifdef XP_CPLUSPLUS
    00772 #include "unicode/unistr.h"
    00773
    00774 U_NAMESPACE_BEGIN
    00786 inline UnicodeString
    00787 ures_getUnicodeString(const UResourceBundle *resB,
    00788                       UErrorCode* status)
    00789 {
    00790     int32_t len = 0;
    00791     const UChar *r = ures_getString(resB, &len, status);
    00792     return UnicodeString(TRUE, r, len);
    00793 }
    00794
    00805 inline UnicodeString
    00806 ures_getNextUnicodeString(UResourceBundle *resB,
    00807                           const char ** key,
    00808                           UErrorCode* status)
    00809 {
    00810     int32_t len = 0;
    00811     const UChar* r = ures_getNextString(resB, &len, key, status);
    00812     return UnicodeString(TRUE, r, len);
    00813 }
    00814
    00824 inline UnicodeString
    00825 ures_getUnicodeStringByIndex(const UResourceBundle *resB,
    00826                              int32_t indexS,
    00827                              UErrorCode* status)
    00828 {
    00829     int32_t len = 0;
    00830     const UChar* r = ures_getStringByIndex(resB, indexS, &len, status);
    00831     return UnicodeString(TRUE, r, len);
    00832 }
    00833
    00844 inline UnicodeString
    00845 ures_getUnicodeStringByKey(const UResourceBundle *resB,
    00846                            const char* key,
    00847                            UErrorCode* status)
    00848 {
    00849     int32_t len = 0;
    00850     const UChar* r = ures_getStringByKey(resB, key, &len, status);
    00851     return UnicodeString(TRUE, r, len);
    00852 }
    00853
    00854 U_NAMESPACE_END
    00855
    00856 #endif
    00857
    00866 U_STABLE UEnumeration* U_EXPORT2
    00867 ures_openAvailableLocales(const char *packageName, UErrorCode *status);
    00868
    00869
    00870 #endif /*_URES*/
    00871 /*eof*/