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 
00070 class U_COMMON_API ResourceBundle : public UObject {
00071 public:
00100     ResourceBundle(const UnicodeString&    path,
00101                    const Locale&           locale,
00102                    UErrorCode&              err);
00103 
00111     ResourceBundle(const UnicodeString&    path,
00112                    UErrorCode&              err);
00113 
00120     ResourceBundle(UErrorCode &err);
00121 
00127     ResourceBundle(const wchar_t* path,
00128                    const Locale& locale,
00129                    UErrorCode& err);
00130 
00141     ResourceBundle(const char* path,
00142                    const Locale& locale,
00143                    UErrorCode& err);
00144 
00151     ResourceBundle(const ResourceBundle &original);
00152 
00160     ResourceBundle(UResourceBundle *res, 
00161                    UErrorCode &status);
00162 
00169     ResourceBundle& 
00170       operator=(const ResourceBundle& other);
00171 
00175     ~ResourceBundle();
00176 
00184     int32_t 
00185       getSize(void) const;
00186 
00197     UnicodeString 
00198       getString(UErrorCode& status) const;
00199 
00213     const uint8_t*
00214       getBinary(int32_t& len, UErrorCode& status) const;
00215 
00216 
00229     const int32_t*
00230       getIntVector(int32_t& len, UErrorCode& status) const;
00231 
00243     uint32_t 
00244       getUInt(UErrorCode& status) const;
00245 
00257     int32_t 
00258       getInt(UErrorCode& status) const;
00259 
00266     UBool 
00267       hasNext(void) const;
00268 
00274     void 
00275       resetIterator(void);
00276 
00284     const char*
00285       getKey(void);
00286 
00294     const char*
00295       getName(void);
00296 
00297 
00304     UResType 
00305       getType(void);
00306 
00314     ResourceBundle 
00315       getNext(UErrorCode& status);
00316 
00325     UnicodeString 
00326       getNextString(UErrorCode& status);
00327 
00337     UnicodeString 
00338       getNextString(const char ** key, 
00339                     UErrorCode& status);
00340 
00349     ResourceBundle 
00350       get(int32_t index, 
00351           UErrorCode& status) const;
00352 
00361     UnicodeString 
00362       getStringEx(int32_t index, 
00363                   UErrorCode& status) const;
00364 
00374     ResourceBundle 
00375       get(const char* key, 
00376           UErrorCode& status) const;
00377 
00387     UnicodeString 
00388       getStringEx(const char* key, 
00389                   UErrorCode& status) const;
00390     
00400     const char*   
00401       getVersionNumber(void) const;
00402 
00410     void 
00411       getVersion(UVersionInfo versionInfo) const;
00412 
00419     const Locale&
00420       getLocale(void) const;
00421 
00427     virtual inline UClassID 
00428       getDynamicClassID() const 
00429     { return getStaticClassID(); }
00430 
00436     static inline UClassID 
00437       getStaticClassID() 
00438     { return (UClassID)&fgClassID; }
00439 
00440 private:
00441     UResourceBundle *resource;
00442     void constructForLocale(const UnicodeString& path, const Locale& locale, UErrorCode& error);
00446     void constructForLocale(const wchar_t* path, const Locale& locale, UErrorCode& error);
00447     Locale *locName;
00448 
00453     static const char fgClassID;
00454 };
00455 
00456 U_NAMESPACE_END
00457 #endif

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