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 
00210 #ifdef ICU_URES_USE_DEPRECATES
00211 
00230 U_CAPI UResourceBundle* U_EXPORT2 
00231 ures_openW(const wchar_t* path, 
00232            const char* locale, 
00233            UErrorCode* status);
00234 #endif /* ICU_URES_USE_DEPRECATES */
00235 
00250 U_CAPI UResourceBundle* U_EXPORT2 
00251 ures_openU(const UChar* path, 
00252            const char* locale, 
00253            UErrorCode* status);
00254 
00271 U_CAPI int32_t U_EXPORT2 
00272 ures_countArrayItems(const UResourceBundle* resourceBundle,
00273                      const char* resourceKey,
00274                      UErrorCode* err);
00283 U_CAPI void U_EXPORT2 
00284 ures_close(UResourceBundle* resourceBundle);
00285 
00296 U_CAPI const char* U_EXPORT2 
00297 ures_getVersionNumber(const UResourceBundle*   resourceBundle);
00298 
00308 U_CAPI void U_EXPORT2 
00309 ures_getVersion(const UResourceBundle* resB, 
00310                 UVersionInfo versionInfo);
00311 
00323 U_CAPI const char* U_EXPORT2 
00324 ures_getLocale(const UResourceBundle* resourceBundle, 
00325                UErrorCode* status);
00326 
00340 U_CAPI void U_EXPORT2 
00341 ures_openFillIn(UResourceBundle *r, 
00342                 const char* path,
00343                 const char* localeID, 
00344                 UErrorCode* status);
00345 
00363 U_CAPI const UChar* U_EXPORT2 
00364 ures_getString(const UResourceBundle* resourceBundle, 
00365                int32_t* len, 
00366                UErrorCode* status);
00367 
00385 U_CAPI const uint8_t* U_EXPORT2 
00386 ures_getBinary(const UResourceBundle* resourceBundle, 
00387                int32_t* len, 
00388                UErrorCode* status);
00389 
00407 U_CAPI const int32_t* U_EXPORT2 
00408 ures_getIntVector(const UResourceBundle* resourceBundle, 
00409                   int32_t* len, 
00410                   UErrorCode* status);
00411 
00428 U_CAPI uint32_t U_EXPORT2 
00429 ures_getUInt(const UResourceBundle* resourceBundle, 
00430              UErrorCode *status);
00431 
00448 U_CAPI int32_t U_EXPORT2 
00449 ures_getInt(const UResourceBundle* resourceBundle, 
00450             UErrorCode *status);
00451 
00463 U_CAPI int32_t U_EXPORT2 
00464 ures_getSize(UResourceBundle *resourceBundle);
00465 
00474 U_CAPI UResType U_EXPORT2 
00475 ures_getType(UResourceBundle *resourceBundle);
00476 
00485 U_CAPI const char * U_EXPORT2 
00486 ures_getKey(UResourceBundle *resB);
00487 
00488 /* ITERATION API 
00489     This API provides means for iterating through a resource
00490 */
00491 
00498 U_CAPI void U_EXPORT2 
00499 ures_resetIterator(UResourceBundle *resourceBundle);
00500 
00508 U_CAPI UBool U_EXPORT2 
00509 ures_hasNext(UResourceBundle *resourceBundle);
00510 
00523 U_CAPI UResourceBundle* U_EXPORT2 
00524 ures_getNextResource(UResourceBundle *resourceBundle, 
00525                      UResourceBundle *fillIn, 
00526                      UErrorCode *status);
00527 
00540 U_CAPI const UChar* U_EXPORT2 
00541 ures_getNextString(UResourceBundle *resourceBundle, 
00542                    int32_t* len, 
00543                    const char ** key, 
00544                    UErrorCode *status);
00545 
00558 U_CAPI UResourceBundle* U_EXPORT2 
00559 ures_getByIndex(const UResourceBundle *resourceBundle, 
00560                 int32_t indexR, 
00561                 UResourceBundle *fillIn, 
00562                 UErrorCode *status);
00563 
00575 U_CAPI const UChar* U_EXPORT2 
00576 ures_getStringByIndex(const UResourceBundle *resB, 
00577                       int32_t indexS, 
00578                       int32_t* len, 
00579                       UErrorCode *status);
00580 
00593 U_CAPI UResourceBundle* U_EXPORT2 
00594 ures_getByKey(const UResourceBundle *resourceBundle, 
00595               const char* key, 
00596               UResourceBundle *fillIn, 
00597               UErrorCode *status);
00598 
00611 U_CAPI const UChar* U_EXPORT2 
00612 ures_getStringByKey(const UResourceBundle *resB, 
00613                     const char* key, 
00614                     int32_t* len, 
00615                     UErrorCode *status);
00616 
00617 #ifdef XP_CPLUSPLUS
00618 #include "unicode/unistr.h"
00619 
00620 U_NAMESPACE_BEGIN
00632 inline UnicodeString 
00633 ures_getUnicodeString(const UResourceBundle *resB, 
00634                       UErrorCode* status) 
00635 {
00636     int32_t len = 0;
00637     const UChar *r = ures_getString(resB, &len, status);
00638     return UnicodeString(TRUE, r, len);
00639 }
00640 
00651 inline UnicodeString 
00652 ures_getNextUnicodeString(UResourceBundle *resB, 
00653                           const char ** key, 
00654                           UErrorCode* status) 
00655 {
00656     int32_t len = 0;
00657     const UChar* r = ures_getNextString(resB, &len, key, status);
00658     return UnicodeString(TRUE, r, len);
00659 }
00660 
00670 inline UnicodeString 
00671 ures_getUnicodeStringByIndex(const UResourceBundle *resB, 
00672                              int32_t indexS, 
00673                              UErrorCode* status) 
00674 {
00675     int32_t len = 0;
00676     const UChar* r = ures_getStringByIndex(resB, indexS, &len, status);
00677     return UnicodeString(TRUE, r, len);
00678 }
00679 
00690 inline UnicodeString 
00691 ures_getUnicodeStringByKey(const UResourceBundle *resB, 
00692                            const char* key, 
00693                            UErrorCode* status) 
00694 {
00695     int32_t len = 0;
00696     const UChar* r = ures_getStringByKey(resB, key, &len, status);
00697     return UnicodeString(TRUE, r, len);
00698 }
00699 
00700 U_NAMESPACE_END
00701 
00702 #endif
00703 
00704 #endif /*_URES*/
00705 /*eof*/

Generated on Wed Dec 18 16:50:04 2002 for ICU 2.4 by doxygen1.2.11.1 written by Dimitri van Heesch, © 1997-2001