00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef FORMAT_H
00021 #define FORMAT_H
00022
00023
00024 #include "unicode/utypes.h"
00025
00026 #if !UCONFIG_NO_FORMATTING
00027
00028 #include "unicode/unistr.h"
00029 #include "unicode/fmtable.h"
00030 #include "unicode/fieldpos.h"
00031 #include "unicode/parsepos.h"
00032 #include "unicode/parseerr.h"
00033 #include "unicode/locid.h"
00034
00035 U_NAMESPACE_BEGIN
00036
00087 class U_I18N_API Format : public UObject {
00088 public:
00089
00093 virtual ~Format();
00094
00103 virtual UBool operator==(const Format& other) const = 0;
00104
00112 UBool operator!=(const Format& other) const { return !operator==(other); }
00113
00120 virtual Format* clone() const = 0;
00121
00132 UnicodeString& format(const Formattable& obj,
00133 UnicodeString& appendTo,
00134 UErrorCode& status) const;
00135
00152 virtual UnicodeString& format(const Formattable& obj,
00153 UnicodeString& appendTo,
00154 FieldPosition& pos,
00155 UErrorCode& status) const = 0;
00156
00196 virtual void parseObject(const UnicodeString& source,
00197 Formattable& result,
00198 ParsePosition& parse_pos) const = 0;
00199
00212 void parseObject(const UnicodeString& source,
00213 Formattable& result,
00214 UErrorCode& status) const;
00215
00228 virtual UClassID getDynamicClassID() const = 0;
00229
00236 Locale getLocale(ULocDataLocaleType type, UErrorCode& status) const;
00237
00244 const char* getLocaleID(ULocDataLocaleType type, UErrorCode &status) const;
00245
00246 protected:
00248 void setLocaleIDs(const char* valid, const char* actual);
00249
00250 protected:
00255 Format();
00256
00260 Format(const Format&);
00261
00265 Format& operator=(const Format&);
00266
00267
00276 static void syntaxError(const UnicodeString& pattern,
00277 int32_t pos,
00278 UParseError& parseError);
00279
00280 private:
00281 char actualLocale[ULOC_FULLNAME_CAPACITY];
00282 char validLocale[ULOC_FULLNAME_CAPACITY];
00283 };
00284
00285 U_NAMESPACE_END
00286
00287 #endif
00288
00289 #endif // _FORMAT
00290