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

resbund.h

Go to the documentation of this file.
00001 /*
00002 ******************************************************************************
00003 *
00004 *   Copyright (C) 1996-2001, 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 
00125 #ifdef ICU_RESOURCEBUNDLE_USE_DEPRECATES
00126 
00131     ResourceBundle(const wchar_t* path,
00132                    const Locale& locale,
00133                    UErrorCode& err);
00134 #endif /* ICU_RESOURCEBUNDLE_USE_DEPRECATES */
00135 
00146     ResourceBundle(const char* path,
00147                    const Locale& locale,
00148                    UErrorCode& err);
00149 
00156     ResourceBundle(const ResourceBundle &original);
00157 
00165     ResourceBundle(UResourceBundle *res, 
00166                    UErrorCode &status);
00167 
00174     ResourceBundle& 
00175       operator=(const ResourceBundle& other);
00176 
00180     ~ResourceBundle();
00181 
00189     int32_t 
00190       getSize(void) const;
00191 
00202     UnicodeString 
00203       getString(UErrorCode& status) const;
00204 
00218     const uint8_t*
00219       getBinary(int32_t& len, UErrorCode& status) const;
00220 
00221 
00234     const int32_t*
00235       getIntVector(int32_t& len, UErrorCode& status) const;
00236 
00248     uint32_t 
00249       getUInt(UErrorCode& status) const;
00250 
00262     int32_t 
00263       getInt(UErrorCode& status) const;
00264 
00271     UBool 
00272       hasNext(void) const;
00273 
00279     void 
00280       resetIterator(void);
00281 
00289     const char*
00290       getKey(void);
00291 
00299     const char*
00300       getName(void);
00301 
00302 
00309     UResType 
00310       getType(void);
00311 
00319     ResourceBundle 
00320       getNext(UErrorCode& status);
00321 
00330     UnicodeString 
00331       getNextString(UErrorCode& status);
00332 
00342     UnicodeString 
00343       getNextString(const char ** key, 
00344                     UErrorCode& status);
00345 
00354     ResourceBundle 
00355       get(int32_t index, 
00356           UErrorCode& status) const;
00357 
00366     UnicodeString 
00367       getStringEx(int32_t index, 
00368                   UErrorCode& status) const;
00369 
00379     ResourceBundle 
00380       get(const char* key, 
00381           UErrorCode& status) const;
00382 
00392     UnicodeString 
00393       getStringEx(const char* key, 
00394                   UErrorCode& status) const;
00395     
00405     const char*   
00406       getVersionNumber(void) const;
00407 
00415     void 
00416       getVersion(UVersionInfo versionInfo) const;
00417 
00424     const Locale&
00425       getLocale(void) const;
00426 
00432     virtual inline UClassID 
00433       getDynamicClassID() const 
00434     { return getStaticClassID(); }
00435 
00441     static inline UClassID 
00442       getStaticClassID() 
00443     { return (UClassID)&fgClassID; }
00444 
00445 private:
00446     UResourceBundle *resource;
00447     void constructForLocale(const UnicodeString& path, const Locale& locale, UErrorCode& error);
00448 #ifdef ICU_RESOURCEBUNDLE_USE_DEPRECATES
00449 
00452     void constructForLocale(const wchar_t* path, const Locale& locale, UErrorCode& error);
00453 #endif /* ICU_RESOURCEBUNDLE_USE_DEPRECATES */
00454     Locale *locName;
00455 
00460     static const char fgClassID;
00461 };
00462 
00463 U_NAMESPACE_END
00464 #endif

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