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 
00178     int32_t 
00179       getSize(void) const;
00180 
00191     UnicodeString 
00192       getString(UErrorCode& status) const;
00193 
00206     const uint8_t*
00207       getBinary(int32_t& len, UErrorCode& status) const;
00208 
00209 
00221     const int32_t*
00222       getIntVector(int32_t& len, UErrorCode& status) const;
00223 
00235     uint32_t 
00236       getUInt(UErrorCode& status) const;
00237 
00249     int32_t 
00250       getInt(UErrorCode& status) const;
00251 
00258     UBool 
00259       hasNext(void) const;
00260 
00266     void 
00267       resetIterator(void);
00268 
00276     const char*
00277       getKey(void);
00278 
00286     const char*
00287       getName(void);
00288 
00289 
00296     UResType 
00297       getType(void);
00298 
00306     ResourceBundle 
00307       getNext(UErrorCode& status);
00308 
00317     UnicodeString 
00318       getNextString(UErrorCode& status);
00319 
00329     UnicodeString 
00330       getNextString(const char ** key, 
00331                     UErrorCode& status);
00332 
00341     ResourceBundle 
00342       get(int32_t index, 
00343           UErrorCode& status) const;
00344 
00353     UnicodeString 
00354       getStringEx(int32_t index, 
00355                   UErrorCode& status) const;
00356 
00366     ResourceBundle 
00367       get(const char* key, 
00368           UErrorCode& status) const;
00369 
00379     UnicodeString 
00380       getStringEx(const char* key, 
00381                   UErrorCode& status) const;
00382     
00392     const char*   
00393       getVersionNumber(void) const;
00394 
00402     void 
00403       getVersion(UVersionInfo versionInfo) const;
00404 
00411     const Locale&
00412       getLocale(void) const;
00413 
00419     virtual inline UClassID getDynamicClassID() const;
00420 
00426     static inline UClassID getStaticClassID();
00427 
00428 private:
00429     ResourceBundle(); // default constructor not implemented
00430 
00431     UResourceBundle *resource;
00432     void constructForLocale(const UnicodeString& path, const Locale& locale, UErrorCode& error);
00433     Locale *locName;
00434 
00439     static const char fgClassID;
00440 };
00441 
00442 inline UClassID 
00443 ResourceBundle::getStaticClassID() 
00444 { return (UClassID)&fgClassID; }
00445 
00446 inline UClassID 
00447 ResourceBundle::getDynamicClassID() const 
00448 { return ResourceBundle::getStaticClassID(); }
00449 
00450 U_NAMESPACE_END
00451 #endif

Generated on Wed Sep 3 17:47:09 2003 for ICU 2.6 by doxygen 1.3.2