ures.h

Go to the documentation of this file.
00001 /*
00002 **********************************************************************
00003 *   Copyright (C) 1997-2012, 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 
00211 #ifndef U_HIDE_DEPRECATED_API
00212 
00228 U_DEPRECATED int32_t U_EXPORT2 
00229 ures_countArrayItems(const UResourceBundle* resourceBundle,
00230                      const char* resourceKey,
00231                      UErrorCode* err);
00232 #endif  /* U_HIDE_DEPRECATED_API */
00233 
00241 U_STABLE void U_EXPORT2 
00242 ures_close(UResourceBundle* resourceBundle);
00243 
00244 #if U_SHOW_CPLUSPLUS_API
00245 
00246 U_NAMESPACE_BEGIN
00247 
00257 U_DEFINE_LOCAL_OPEN_POINTER(LocalUResourceBundlePointer, UResourceBundle, ures_close);
00258 
00259 U_NAMESPACE_END
00260 
00261 #endif
00262 
00263 #ifndef U_HIDE_DEPRECATED_API
00264 
00274 U_DEPRECATED const char* U_EXPORT2 
00275 ures_getVersionNumber(const UResourceBundle*   resourceBundle);
00276 #endif  /* U_HIDE_DEPRECATED_API */
00277 
00287 U_STABLE void U_EXPORT2 
00288 ures_getVersion(const UResourceBundle* resB, 
00289                 UVersionInfo versionInfo);
00290 
00291 #ifndef U_HIDE_DEPRECATED_API
00292 
00304 U_DEPRECATED const char* U_EXPORT2 
00305 ures_getLocale(const UResourceBundle* resourceBundle, 
00306                UErrorCode* status);
00307 #endif  /* U_HIDE_DEPRECATED_API */
00308 
00321 U_STABLE const char* U_EXPORT2 
00322 ures_getLocaleByType(const UResourceBundle* resourceBundle, 
00323                      ULocDataLocaleType type, 
00324                      UErrorCode* status);
00325 
00326 
00327 #ifndef U_HIDE_INTERNAL_API
00328 
00344 U_INTERNAL void U_EXPORT2 
00345 ures_openFillIn(UResourceBundle *r, 
00346                 const char* packageName,
00347                 const char* localeID, 
00348                 UErrorCode* status);
00349 #endif  /* U_HIDE_INTERNAL_API */
00350 
00368 U_STABLE const UChar* U_EXPORT2 
00369 ures_getString(const UResourceBundle* resourceBundle, 
00370                int32_t* len, 
00371                UErrorCode* status);
00372 
00420 U_STABLE const char * U_EXPORT2
00421 ures_getUTF8String(const UResourceBundle *resB,
00422                    char *dest, int32_t *length,
00423                    UBool forceCopy,
00424                    UErrorCode *status);
00425 
00443 U_STABLE const uint8_t* U_EXPORT2 
00444 ures_getBinary(const UResourceBundle* resourceBundle, 
00445                int32_t* len, 
00446                UErrorCode* status);
00447 
00465 U_STABLE const int32_t* U_EXPORT2 
00466 ures_getIntVector(const UResourceBundle* resourceBundle, 
00467                   int32_t* len, 
00468                   UErrorCode* status);
00469 
00486 U_STABLE uint32_t U_EXPORT2 
00487 ures_getUInt(const UResourceBundle* resourceBundle, 
00488              UErrorCode *status);
00489 
00506 U_STABLE int32_t U_EXPORT2 
00507 ures_getInt(const UResourceBundle* resourceBundle, 
00508             UErrorCode *status);
00509 
00520 U_STABLE int32_t U_EXPORT2 
00521 ures_getSize(const UResourceBundle *resourceBundle);
00522 
00531 U_STABLE UResType U_EXPORT2 
00532 ures_getType(const UResourceBundle *resourceBundle);
00533 
00542 U_STABLE const char * U_EXPORT2 
00543 ures_getKey(const UResourceBundle *resourceBundle);
00544 
00545 /* ITERATION API 
00546     This API provides means for iterating through a resource
00547 */
00548 
00555 U_STABLE void U_EXPORT2 
00556 ures_resetIterator(UResourceBundle *resourceBundle);
00557 
00565 U_STABLE UBool U_EXPORT2 
00566 ures_hasNext(const UResourceBundle *resourceBundle);
00567 
00580 U_STABLE UResourceBundle* U_EXPORT2 
00581 ures_getNextResource(UResourceBundle *resourceBundle, 
00582                      UResourceBundle *fillIn, 
00583                      UErrorCode *status);
00584 
00597 U_STABLE const UChar* U_EXPORT2 
00598 ures_getNextString(UResourceBundle *resourceBundle, 
00599                    int32_t* len, 
00600                    const char ** key, 
00601                    UErrorCode *status);
00602 
00615 U_STABLE UResourceBundle* U_EXPORT2 
00616 ures_getByIndex(const UResourceBundle *resourceBundle, 
00617                 int32_t indexR, 
00618                 UResourceBundle *fillIn, 
00619                 UErrorCode *status);
00620 
00632 U_STABLE const UChar* U_EXPORT2 
00633 ures_getStringByIndex(const UResourceBundle *resourceBundle, 
00634                       int32_t indexS, 
00635                       int32_t* len, 
00636                       UErrorCode *status);
00637 
00686 U_STABLE const char * U_EXPORT2
00687 ures_getUTF8StringByIndex(const UResourceBundle *resB,
00688                           int32_t stringIndex,
00689                           char *dest, int32_t *pLength,
00690                           UBool forceCopy,
00691                           UErrorCode *status);
00692 
00705 U_STABLE UResourceBundle* U_EXPORT2 
00706 ures_getByKey(const UResourceBundle *resourceBundle, 
00707               const char* key, 
00708               UResourceBundle *fillIn, 
00709               UErrorCode *status);
00710 
00723 U_STABLE const UChar* U_EXPORT2 
00724 ures_getStringByKey(const UResourceBundle *resB, 
00725                     const char* key, 
00726                     int32_t* len, 
00727                     UErrorCode *status);
00728 
00779 U_STABLE const char * U_EXPORT2
00780 ures_getUTF8StringByKey(const UResourceBundle *resB,
00781                         const char *key,
00782                         char *dest, int32_t *pLength,
00783                         UBool forceCopy,
00784                         UErrorCode *status);
00785 
00786 #if U_SHOW_CPLUSPLUS_API
00787 #include "unicode/unistr.h"
00788 
00789 U_NAMESPACE_BEGIN
00801 inline UnicodeString 
00802 ures_getUnicodeString(const UResourceBundle *resB, 
00803                       UErrorCode* status) 
00804 {
00805     int32_t len = 0;
00806     const UChar *r = ures_getString(resB, &len, status);
00807     return UnicodeString(TRUE, r, len);
00808 }
00809 
00820 inline UnicodeString 
00821 ures_getNextUnicodeString(UResourceBundle *resB, 
00822                           const char ** key, 
00823                           UErrorCode* status) 
00824 {
00825     int32_t len = 0;
00826     const UChar* r = ures_getNextString(resB, &len, key, status);
00827     return UnicodeString(TRUE, r, len);
00828 }
00829 
00839 inline UnicodeString 
00840 ures_getUnicodeStringByIndex(const UResourceBundle *resB, 
00841                              int32_t indexS, 
00842                              UErrorCode* status) 
00843 {
00844     int32_t len = 0;
00845     const UChar* r = ures_getStringByIndex(resB, indexS, &len, status);
00846     return UnicodeString(TRUE, r, len);
00847 }
00848 
00859 inline UnicodeString 
00860 ures_getUnicodeStringByKey(const UResourceBundle *resB, 
00861                            const char* key, 
00862                            UErrorCode* status) 
00863 {
00864     int32_t len = 0;
00865     const UChar* r = ures_getStringByKey(resB, key, &len, status);
00866     return UnicodeString(TRUE, r, len);
00867 }
00868 
00869 U_NAMESPACE_END
00870 
00871 #endif
00872 
00881 U_STABLE UEnumeration* U_EXPORT2
00882 ures_openAvailableLocales(const char *packageName, UErrorCode *status);
00883 
00884 
00885 #endif /*_URES*/
00886 /*eof*/

Generated on 27 Oct 2013 for ICU 50.1.2 by  doxygen 1.4.7