Main Page   Class Hierarchy   Alphabetical List   Data Structures   File List   Data Fields   Globals  

ures.h

Go to the documentation of this file.
00001 /*
00002 **********************************************************************
00003 *   Copyright (C) 1997-2001, 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 ******************************************************************************
00020 */
00021 
00022 #ifndef URES_H
00023 #define URES_H
00024 
00025 #include "unicode/utypes.h"
00026 #include "unicode/uloc.h"
00027 
00170 struct UResourceBundle;
00171 
00175 typedef struct UResourceBundle UResourceBundle;
00176 
00181 typedef enum {
00182     RES_NONE=-1,
00183     RES_STRING=0,
00184     RES_BINARY=1,
00185     RES_TABLE=2,
00186 
00187     RES_INT=7,
00188     RES_ARRAY=8,
00189 
00190     RES_INT_VECTOR=14,
00191     RES_RESERVED=15
00192 } UResType;
00193 
00194 /*
00195  * Functions to create and destroy resource bundles.
00196  */
00197 
00224 U_CAPI UResourceBundle*  U_EXPORT2 ures_open(const char*    path,   /* NULL if none */
00225                                            const char*  locale, /* NULL if none */
00226                                            UErrorCode*     status);
00227 
00228 
00245 U_CAPI UResourceBundle* U_EXPORT2 
00246 ures_openDirect(const char* path, const char* locale, UErrorCode* status);
00247 
00267 U_CAPI UResourceBundle* U_EXPORT2 ures_openW(const wchar_t* path, 
00268                   const char* locale, 
00269                   UErrorCode* status);
00270 
00278 U_CAPI UResourceBundle* U_EXPORT2 ures_openU(const UChar* path, 
00279                   const char* locale, 
00280                   UErrorCode* status);
00281 
00298 U_CAPI int32_t U_EXPORT2 ures_countArrayItems(const UResourceBundle* resourceBundle,
00299                   const char* resourceKey,
00300                   UErrorCode* err);
00314 U_CAPI void U_EXPORT2 ures_close(UResourceBundle*    resourceBundle);
00315 
00324 U_CAPI const char* U_EXPORT2 ures_getVersionNumber(const UResourceBundle*   resourceBundle);
00325 
00334 U_CAPI void U_EXPORT2 ures_getVersion(const UResourceBundle* resB, UVersionInfo versionInfo);
00335 
00343 U_CAPI const char* U_EXPORT2 
00344 ures_getLocale(const UResourceBundle* resourceBundle, UErrorCode* status);
00345 
00353 U_CAPI void U_EXPORT2 
00354 ures_openFillIn(UResourceBundle *r, const char* path,
00355                     const char* localeID, UErrorCode* status);
00356 
00369 U_CAPI const UChar* U_EXPORT2 ures_getString(const UResourceBundle* resourceBundle, int32_t* len, 
00370                UErrorCode*               status);
00371 
00385 U_CAPI const uint8_t* U_EXPORT2 ures_getBinary(const UResourceBundle* resourceBundle, int32_t* len, 
00386                UErrorCode*               status);
00387 
00400 U_CAPI const int32_t* U_EXPORT2 ures_getIntVector(const UResourceBundle* resourceBundle, int32_t* len, 
00401                UErrorCode*               status);
00402 
00415 U_CAPI uint32_t U_EXPORT2 ures_getUInt(const UResourceBundle* resourceBundle, UErrorCode *status);
00416 
00429 U_CAPI int32_t U_EXPORT2 ures_getInt(const UResourceBundle* resourceBundle, UErrorCode *status);
00430 
00439 U_CAPI int32_t U_EXPORT2 ures_getSize(UResourceBundle *resourceBundle);
00440 
00448 U_CAPI UResType U_EXPORT2 ures_getType(UResourceBundle *resourceBundle);
00449 
00458 U_CAPI const char * U_EXPORT2 ures_getKey(UResourceBundle *resB);
00459 
00460 /* ITERATION API 
00461     This API provides means for iterating through a resource
00462 */
00463 
00470 U_CAPI void U_EXPORT2 ures_resetIterator(UResourceBundle *resourceBundle);
00471 
00479 U_CAPI UBool U_EXPORT2 ures_hasNext(UResourceBundle *resourceBundle);
00480 
00492 U_CAPI UResourceBundle* U_EXPORT2 ures_getNextResource(UResourceBundle *resourceBundle, UResourceBundle *fillIn, UErrorCode *status);
00493 
00505 U_CAPI const UChar* U_EXPORT2 ures_getNextString(UResourceBundle *resourceBundle, int32_t* len, const char ** key, UErrorCode *status);
00506 
00518 U_CAPI UResourceBundle* U_EXPORT2 ures_getByIndex(const UResourceBundle *resourceBundle, int32_t indexR, UResourceBundle *fillIn, UErrorCode *status);
00519 
00530 U_CAPI const UChar* U_EXPORT2 ures_getStringByIndex(const UResourceBundle *resB, int32_t indexS, int32_t* len, UErrorCode *status);
00531 
00544 U_CAPI UResourceBundle* U_EXPORT2 ures_getByKey(const UResourceBundle *resourceBundle, const char* key, UResourceBundle *fillIn, UErrorCode *status);
00545 
00557 U_CAPI const UChar* U_EXPORT2 ures_getStringByKey(const UResourceBundle *resB, const char* key, int32_t* len, UErrorCode *status);
00558 
00559 #ifdef XP_CPLUSPLUS
00560 #include "unicode/unistr.h"
00561 
00562 U_NAMESPACE_BEGIN
00574 inline UnicodeString ures_getUnicodeString(const UResourceBundle *resB, UErrorCode* status) {
00575     int32_t len = 0;
00576     const UChar *r = ures_getString(resB, &len, status);
00577     return UnicodeString(TRUE, r, len);
00578 }
00579 
00590 inline UnicodeString ures_getNextUnicodeString(UResourceBundle *resB, const char ** key, UErrorCode* status) {
00591     int32_t len = 0;
00592     const UChar* r = ures_getNextString(resB, &len, key, status);
00593     return UnicodeString(TRUE, r, len);
00594 }
00595 
00605 inline UnicodeString ures_getUnicodeStringByIndex(const UResourceBundle *resB, int32_t indexS, UErrorCode* status) {
00606     int32_t len = 0;
00607     const UChar* r = ures_getStringByIndex(resB, indexS, &len, status);
00608     return UnicodeString(TRUE, r, len);
00609 }
00610 
00621 inline UnicodeString ures_getUnicodeStringByKey(const UResourceBundle *resB, const char* key, UErrorCode* status) {
00622     int32_t len = 0;
00623     const UChar* r = ures_getStringByKey(resB, key, &len, status);
00624     return UnicodeString(TRUE, r, len);
00625 }
00626 
00627 U_NAMESPACE_END
00628 
00629 #endif
00630 
00631 #endif /*_URES*/
00632 /*eof*/

Generated on Tue Mar 5 06:25:08 2002 for ICU 2.0 by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002