Main Page | Class Hierarchy | Alphabetical List | Data Structures | File List | Data Fields | Globals | Related Pages

resbund.h

00001 /*
00002 ******************************************************************************
00003 *
00004 *   Copyright (C) 1996-2003, International Business Machines
00005 *   Corporation and others.  All Rights Reserved.
00006 *
00007 ******************************************************************************
00008 *
00009 * File resbund.h
00010 *
00011 *   CREATED BY
00012 *       Richard Gillam
00013 *
00014 * Modification History:
00015 *
00016 *   Date        Name        Description
00017 *   2/5/97      aliu        Added scanForLocaleInFile.  Added
00018 *                           constructor which attempts to read resource bundle
00019 *                           from a specific file, without searching other files.
00020 *   2/11/97     aliu        Added UErrorCode return values to constructors.  Fixed
00021 *                           infinite loops in scanForFile and scanForLocale.
00022 *                           Modified getRawResourceData to not delete storage
00023 *                           in localeData and resourceData which it doesn't own.
00024 *                           Added Mac compatibility #ifdefs for tellp() and
00025 *                           ios::nocreate.
00026 *   2/18/97     helena      Updated with 100% documentation coverage.
00027 *   3/13/97     aliu        Rewrote to load in entire resource bundle and store
00028 *                           it as a Hashtable of ResourceBundleData objects.
00029 *                           Added state table to govern parsing of files.
00030 *                           Modified to load locale index out of new file
00031 *                           distinct from default.txt.
00032 *   3/25/97     aliu        Modified to support 2-d arrays, needed for timezone
00033 *                           data. Added support for custom file suffixes.  Again,
00034 *                           needed to support timezone data.
00035 *   4/7/97      aliu        Cleaned up.
00036 * 03/02/99      stephen     Removed dependency on FILE*.
00037 * 03/29/99      helena      Merged Bertrand and Stephen's changes.
00038 * 06/11/99      stephen     Removed parsing of .txt files.
00039 *                           Reworked to use new binary format.
00040 *                           Cleaned up.
00041 * 06/14/99      stephen     Removed methods taking a filename suffix.
00042 * 11/09/99      weiv        Added getLocale(), fRealLocale, removed fRealLocaleID
00043 ******************************************************************************
00044 */
00045 
00046 #ifndef RESBUND_H
00047 #define RESBUND_H
00048   
00049 #include "unicode/utypes.h"
00050 #include "unicode/uobject.h"
00051 #include "unicode/ures.h"
00052 #include "unicode/unistr.h"
00053 #include "unicode/locid.h"
00054 
00055 U_NAMESPACE_BEGIN
00056 
00073 class U_COMMON_API ResourceBundle : public UObject {
00074 public:
00103     ResourceBundle(const UnicodeString&    path,
00104                    const Locale&           locale,
00105                    UErrorCode&              err);
00106 
00114     ResourceBundle(const UnicodeString&    path,
00115                    UErrorCode&              err);
00116 
00123     ResourceBundle(UErrorCode &err);
00124 
00135     ResourceBundle(const char* path,
00136                    const Locale& locale,
00137                    UErrorCode& err);
00138 
00145     ResourceBundle(const ResourceBundle &original);
00146 
00154     ResourceBundle(UResourceBundle *res, 
00155                    UErrorCode &status);
00156 
00163     ResourceBundle& 
00164       operator=(const ResourceBundle& other);
00165 
00169     ~ResourceBundle();
00170 
00182     ResourceBundle *clone() const;
00183 
00194     int32_t 
00195       getSize(void) const;
00196 
00207     UnicodeString 
00208       getString(UErrorCode& status) const;
00209 
00222     const uint8_t*
00223       getBinary(int32_t& len, UErrorCode& status) const;
00224 
00225 
00237     const int32_t*
00238       getIntVector(int32_t& len, UErrorCode& status) const;
00239 
00251     uint32_t 
00252       getUInt(UErrorCode& status) const;
00253 
00265     int32_t 
00266       getInt(UErrorCode& status) const;
00267 
00274     UBool 
00275       hasNext(void) const;
00276 
00282     void 
00283       resetIterator(void);
00284 
00292     const char*
00293       getKey(void);
00294 
00302     const char*
00303       getName(void);
00304 
00305 
00312     UResType 
00313       getType(void);
00314 
00322     ResourceBundle 
00323       getNext(UErrorCode& status);
00324 
00333     UnicodeString 
00334       getNextString(UErrorCode& status);
00335 
00345     UnicodeString 
00346       getNextString(const char ** key, 
00347                     UErrorCode& status);
00348 
00357     ResourceBundle 
00358       get(int32_t index, 
00359           UErrorCode& status) const;
00360 
00369     UnicodeString 
00370       getStringEx(int32_t index, 
00371                   UErrorCode& status) const;
00372 
00382     ResourceBundle 
00383       get(const char* key, 
00384           UErrorCode& status) const;
00385 
00395     UnicodeString 
00396       getStringEx(const char* key, 
00397                   UErrorCode& status) const;
00398     
00408     const char*   
00409       getVersionNumber(void) const;
00410 
00418     void 
00419       getVersion(UVersionInfo versionInfo) const;
00420 
00427     const Locale&
00428       getLocale(void) const;
00429 
00440     const Locale 
00441       getLocale(ULocDataLocaleType type, UErrorCode &status) const;
00442 
00448     virtual UClassID getDynamicClassID() const;
00449 
00455     static UClassID getStaticClassID();
00456 
00457 private:
00458     ResourceBundle(); // default constructor not implemented
00459 
00460     UResourceBundle *resource;
00461     void constructForLocale(const UnicodeString& path, const Locale& locale, UErrorCode& error);
00462     Locale *locName;
00463 
00464 };
00465 
00466 U_NAMESPACE_END
00467 #endif

Generated on Tue Oct 26 18:11:09 2004 for ICU 2.8 by  doxygen 1.3.9.1