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

resbund.h

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/ures.h"
00050 #include "unicode/utypes.h"
00051 #include "unicode/unistr.h"
00052 #include "unicode/locid.h"
00053 
00054 U_NAMESPACE_BEGIN
00055 /* forward declarations */
00056 class RuleBasedCollator;
00057 
00158 class U_COMMON_API ResourceBundle {
00159 public:
00187     ResourceBundle( const UnicodeString&    path,
00188                     const Locale&           locale,
00189                     UErrorCode&              err);
00190 
00198     ResourceBundle( const UnicodeString&    path,
00199                     UErrorCode&              err);
00200 
00207     ResourceBundle(UErrorCode &err);
00208 
00214     ResourceBundle( const wchar_t* path,
00215                     const Locale& locale,
00216                     UErrorCode& err);
00217 
00228     ResourceBundle( const char* path,
00229                     const Locale& locale,
00230                     UErrorCode& err);
00231 
00238     ResourceBundle(const ResourceBundle &original);
00239 
00247     ResourceBundle(UResourceBundle *res, UErrorCode &status);
00248 
00255     ResourceBundle& operator=(const ResourceBundle& other);
00256 
00258     ~ResourceBundle();
00259 
00267     int32_t getSize(void) const;
00268 
00279     UnicodeString getString(UErrorCode& status) const;
00280 
00294     const uint8_t *getBinary(int32_t& len, UErrorCode& status) const;
00295 
00296 
00309     const int32_t *getIntVector(int32_t& len, UErrorCode& status) const;
00310 
00322     uint32_t getUInt(UErrorCode& status) const;
00323 
00335     int32_t getInt(UErrorCode& status) const;
00336 
00343     UBool hasNext(void) const;
00344 
00350     void resetIterator(void);
00351 
00359     const char *getKey(void);
00360 
00367     const char *getName(void);
00368 
00369 
00376     UResType getType(void);
00377 
00385     ResourceBundle getNext(UErrorCode& status);
00386 
00395     UnicodeString getNextString(UErrorCode& status);
00396 
00406     UnicodeString getNextString(const char ** key, UErrorCode& status);
00407 
00416     ResourceBundle get(int32_t index, UErrorCode& status) const;
00417 
00426     UnicodeString getStringEx(int32_t index, UErrorCode& status) const;
00427 
00437     ResourceBundle get(const char* key, UErrorCode& status) const;
00438 
00448     UnicodeString getStringEx(const char* key, UErrorCode& status) const;
00449     
00457     const char*   getVersionNumber(void) const;
00458 
00466     void getVersion(UVersionInfo versionInfo) const;
00467 
00474     const Locale &getLocale(void) const ;
00475 
00476 private:
00477     UResourceBundle *resource;
00478     void constructForLocale(const UnicodeString& path, const Locale& locale, UErrorCode& error);
00482     void constructForLocale(const wchar_t* path, const Locale& locale, UErrorCode& error);
00483     Locale *locName;
00484 };
00485 
00486 U_NAMESPACE_END
00487 #endif

Generated on Sun Jan 18 22:55:41 2004 for ICU 2.1 by doxygen 1.3.4