Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Search  

ures.h

Go to the documentation of this file.
00001 /*
00002 **********************************************************************
00003 *   Copyright (C) 1997-2002, 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 
00125 struct UResourceBundle;
00126 
00130 typedef struct UResourceBundle UResourceBundle;
00131 
00136 typedef enum {
00137     RES_NONE=-1,
00138     RES_STRING=0,
00139     RES_BINARY=1,
00140     RES_TABLE=2,
00141   /* this resource is an alias - contains a string 
00142    * that is the name of resource containing data 
00143    */
00144     RES_ALIAS=3, 
00145 
00146     RES_INT=7,
00147     RES_ARRAY=8,
00148 
00149     RES_INT_VECTOR=14,
00150     RES_RESERVED=15
00151 } UResType;
00152 
00153 /*
00154  * Functions to create and destroy resource bundles.
00155  */
00156 
00183 U_CAPI UResourceBundle*  U_EXPORT2 
00184 ures_open(const char*    path,
00185           const char*  locale, 
00186           UErrorCode*     status);
00187 
00188 
00205 U_CAPI UResourceBundle* U_EXPORT2 
00206 ures_openDirect(const char* path, 
00207                 const char* locale, 
00208                 UErrorCode* status);
00209 
00229 U_CAPI UResourceBundle* U_EXPORT2 
00230 ures_openW(const wchar_t* path, 
00231            const char* locale, 
00232            UErrorCode* status);
00233 
00248 U_CAPI UResourceBundle* U_EXPORT2 
00249 ures_openU(const UChar* path, 
00250            const char* locale, 
00251            UErrorCode* status);
00252 
00269 U_CAPI int32_t U_EXPORT2 
00270 ures_countArrayItems(const UResourceBundle* resourceBundle,
00271                      const char* resourceKey,
00272                      UErrorCode* err);
00281 U_CAPI void U_EXPORT2 
00282 ures_close(UResourceBundle* resourceBundle);
00283 
00294 U_CAPI const char* U_EXPORT2 
00295 ures_getVersionNumber(const UResourceBundle*   resourceBundle);
00296 
00306 U_CAPI void U_EXPORT2 
00307 ures_getVersion(const UResourceBundle* resB, 
00308                 UVersionInfo versionInfo);
00309 
00321 U_CAPI const char* U_EXPORT2 
00322 ures_getLocale(const UResourceBundle* resourceBundle, 
00323                UErrorCode* status);
00324 
00338 U_CAPI void U_EXPORT2 
00339 ures_openFillIn(UResourceBundle *r, 
00340                 const char* path,
00341                 const char* localeID, 
00342                 UErrorCode* status);
00343 
00361 U_CAPI const UChar* U_EXPORT2 
00362 ures_getString(const UResourceBundle* resourceBundle, 
00363                int32_t* len, 
00364                UErrorCode* status);
00365 
00383 U_CAPI const uint8_t* U_EXPORT2 
00384 ures_getBinary(const UResourceBundle* resourceBundle, 
00385                int32_t* len, 
00386                UErrorCode* status);
00387 
00405 U_CAPI const int32_t* U_EXPORT2 
00406 ures_getIntVector(const UResourceBundle* resourceBundle, 
00407                   int32_t* len, 
00408                   UErrorCode* status);
00409 
00426 U_CAPI uint32_t U_EXPORT2 
00427 ures_getUInt(const UResourceBundle* resourceBundle, 
00428              UErrorCode *status);
00429 
00446 U_CAPI int32_t U_EXPORT2 
00447 ures_getInt(const UResourceBundle* resourceBundle, 
00448             UErrorCode *status);
00449 
00461 U_CAPI int32_t U_EXPORT2 
00462 ures_getSize(UResourceBundle *resourceBundle);
00463 
00472 U_CAPI UResType U_EXPORT2 
00473 ures_getType(UResourceBundle *resourceBundle);
00474 
00483 U_CAPI const char * U_EXPORT2 
00484 ures_getKey(UResourceBundle *resB);
00485 
00486 /* ITERATION API 
00487     This API provides means for iterating through a resource
00488 */
00489 
00496 U_CAPI void U_EXPORT2 
00497 ures_resetIterator(UResourceBundle *resourceBundle);
00498 
00506 U_CAPI UBool U_EXPORT2 
00507 ures_hasNext(UResourceBundle *resourceBundle);
00508 
00521 U_CAPI UResourceBundle* U_EXPORT2 
00522 ures_getNextResource(UResourceBundle *resourceBundle, 
00523                      UResourceBundle *fillIn, 
00524                      UErrorCode *status);
00525 
00538 U_CAPI const UChar* U_EXPORT2 
00539 ures_getNextString(UResourceBundle *resourceBundle, 
00540                    int32_t* len, 
00541                    const char ** key, 
00542                    UErrorCode *status);
00543 
00556 U_CAPI UResourceBundle* U_EXPORT2 
00557 ures_getByIndex(const UResourceBundle *resourceBundle, 
00558                 int32_t indexR, 
00559                 UResourceBundle *fillIn, 
00560                 UErrorCode *status);
00561 
00573 U_CAPI const UChar* U_EXPORT2 
00574 ures_getStringByIndex(const UResourceBundle *resB, 
00575                       int32_t indexS, 
00576                       int32_t* len, 
00577                       UErrorCode *status);
00578 
00591 U_CAPI UResourceBundle* U_EXPORT2 
00592 ures_getByKey(const UResourceBundle *resourceBundle, 
00593               const char* key, 
00594               UResourceBundle *fillIn, 
00595               UErrorCode *status);
00596 
00609 U_CAPI const UChar* U_EXPORT2 
00610 ures_getStringByKey(const UResourceBundle *resB, 
00611                     const char* key, 
00612                     int32_t* len, 
00613                     UErrorCode *status);
00614 
00615 #ifdef XP_CPLUSPLUS
00616 #include "unicode/unistr.h"
00617 
00618 U_NAMESPACE_BEGIN
00630 inline UnicodeString 
00631 ures_getUnicodeString(const UResourceBundle *resB, 
00632                       UErrorCode* status) 
00633 {
00634     int32_t len = 0;
00635     const UChar *r = ures_getString(resB, &len, status);
00636     return UnicodeString(TRUE, r, len);
00637 }
00638 
00649 inline UnicodeString 
00650 ures_getNextUnicodeString(UResourceBundle *resB, 
00651                           const char ** key, 
00652                           UErrorCode* status) 
00653 {
00654     int32_t len = 0;
00655     const UChar* r = ures_getNextString(resB, &len, key, status);
00656     return UnicodeString(TRUE, r, len);
00657 }
00658 
00668 inline UnicodeString 
00669 ures_getUnicodeStringByIndex(const UResourceBundle *resB, 
00670                              int32_t indexS, 
00671                              UErrorCode* status) 
00672 {
00673     int32_t len = 0;
00674     const UChar* r = ures_getStringByIndex(resB, indexS, &len, status);
00675     return UnicodeString(TRUE, r, len);
00676 }
00677 
00688 inline UnicodeString 
00689 ures_getUnicodeStringByKey(const UResourceBundle *resB, 
00690                            const char* key, 
00691                            UErrorCode* status) 
00692 {
00693     int32_t len = 0;
00694     const UChar* r = ures_getStringByKey(resB, key, &len, status);
00695     return UnicodeString(TRUE, r, len);
00696 }
00697 
00698 U_NAMESPACE_END
00699 
00700 #endif
00701 
00702 #endif /*_URES*/
00703 /*eof*/

Generated on Thu Aug 15 14:13:33 2002 for ICU 2.2 by doxygen1.2.11.1 written by Dimitri van Heesch, © 1997-2001