resbund.h

00001 /*
00002 ******************************************************************************
00003 *
00004 *   Copyright (C) 1996-2004, 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 
00156     ResourceBundle(UResourceBundle *res,
00157                    UErrorCode &status);
00158 
00165     ResourceBundle&
00166       operator=(const ResourceBundle& other);
00167 
00171     virtual ~ResourceBundle();
00172 
00184     ResourceBundle *clone() const;
00185 
00196     int32_t
00197       getSize(void) const;
00198 
00209     UnicodeString
00210       getString(UErrorCode& status) const;
00211 
00224     const uint8_t*
00225       getBinary(int32_t& len, UErrorCode& status) const;
00226 
00227 
00239     const int32_t*
00240       getIntVector(int32_t& len, UErrorCode& status) const;
00241 
00253     uint32_t
00254       getUInt(UErrorCode& status) const;
00255 
00267     int32_t
00268       getInt(UErrorCode& status) const;
00269 
00276     UBool
00277       hasNext(void) const;
00278 
00284     void
00285       resetIterator(void);
00286 
00294     const char*
00295       getKey(void) const;
00296 
00304     const char*
00305       getName(void) const;
00306 
00307 
00314     UResType
00315       getType(void) const;
00316 
00324     ResourceBundle
00325       getNext(UErrorCode& status);
00326 
00335     UnicodeString
00336       getNextString(UErrorCode& status);
00337 
00347     UnicodeString
00348       getNextString(const char ** key,
00349                     UErrorCode& status);
00350 
00359     ResourceBundle
00360       get(int32_t index,
00361           UErrorCode& status) const;
00362 
00371     UnicodeString
00372       getStringEx(int32_t index,
00373                   UErrorCode& status) const;
00374 
00384     ResourceBundle
00385       get(const char* key,
00386           UErrorCode& status) const;
00387 
00397     UnicodeString
00398       getStringEx(const char* key,
00399                   UErrorCode& status) const;
00400 
00410     const char*
00411       getVersionNumber(void) const;
00412 
00420     void
00421       getVersion(UVersionInfo versionInfo) const;
00422 
00429     const Locale&
00430       getLocale(void) const;
00431 
00442     const Locale
00443       getLocale(ULocDataLocaleType type, UErrorCode &status) const;
00448     ResourceBundle
00449         getWithFallback(const char* key, UErrorCode& status);
00455     virtual UClassID getDynamicClassID() const;
00456 
00462     static UClassID U_EXPORT2 getStaticClassID();
00463 
00464 private:
00465     ResourceBundle(); // default constructor not implemented
00466 
00467     UResourceBundle *fResource;
00468     void constructForLocale(const UnicodeString& path, const Locale& locale, UErrorCode& error);
00469     Locale *fLocale;
00470 
00471 };
00472 
00473 U_NAMESPACE_END
00474 #endif

Generated on Tue Nov 16 10:03:06 2004 for ICU 3.2 by  doxygen 1.3.9.1