00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef FORMAT_H
00022 #define FORMAT_H
00023
00024
00025 #include "unicode/utypes.h"
00026
00032 #if !UCONFIG_NO_FORMATTING
00033
00034 #include "unicode/unistr.h"
00035 #include "unicode/fmtable.h"
00036 #include "unicode/fieldpos.h"
00037 #include "unicode/parsepos.h"
00038 #include "unicode/parseerr.h"
00039 #include "unicode/locid.h"
00040
00041 U_NAMESPACE_BEGIN
00042
00093 class U_I18N_API Format : public UObject {
00094 public:
00095
00099 virtual ~Format();
00100
00109 virtual UBool operator==(const Format& other) const = 0;
00110
00118 UBool operator!=(const Format& other) const { return !operator==(other); }
00119
00126 virtual Format* clone() const = 0;
00127
00138 UnicodeString& format(const Formattable& obj,
00139 UnicodeString& appendTo,
00140 UErrorCode& status) const;
00141
00158 virtual UnicodeString& format(const Formattable& obj,
00159 UnicodeString& appendTo,
00160 FieldPosition& pos,
00161 UErrorCode& status) const = 0;
00162
00202 virtual void parseObject(const UnicodeString& source,
00203 Formattable& result,
00204 ParsePosition& parse_pos) const = 0;
00205
00218 void parseObject(const UnicodeString& source,
00219 Formattable& result,
00220 UErrorCode& status) const;
00221
00234 virtual UClassID getDynamicClassID() const = 0;
00235
00242 Locale getLocale(ULocDataLocaleType type, UErrorCode& status) const;
00243
00250 const char* getLocaleID(ULocDataLocaleType type, UErrorCode &status) const;
00251
00252 protected:
00254 void setLocaleIDs(const char* valid, const char* actual);
00255
00256 protected:
00261 Format();
00262
00266 Format(const Format&);
00267
00271 Format& operator=(const Format&);
00272
00273
00282 static void syntaxError(const UnicodeString& pattern,
00283 int32_t pos,
00284 UParseError& parseError);
00285
00286 private:
00287 char actualLocale[ULOC_FULLNAME_CAPACITY];
00288 char validLocale[ULOC_FULLNAME_CAPACITY];
00289 };
00290
00291 U_NAMESPACE_END
00292
00293 #endif
00294
00295 #endif // _FORMAT
00296