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
00031 #if !UCONFIG_NO_FORMATTING
00032
00033 #include "unicode/unistr.h"
00034 #include "unicode/fmtable.h"
00035 #include "unicode/fieldpos.h"
00036 #include "unicode/parsepos.h"
00037 #include "unicode/parseerr.h"
00038 #include "unicode/locid.h"
00039
00040 U_NAMESPACE_BEGIN
00041
00092 class U_I18N_API Format : public UObject {
00093 public:
00094
00098 virtual ~Format();
00099
00108 virtual UBool operator==(const Format& other) const = 0;
00109
00117 UBool operator!=(const Format& other) const { return !operator==(other); }
00118
00125 virtual Format* clone() const = 0;
00126
00137 UnicodeString& format(const Formattable& obj,
00138 UnicodeString& appendTo,
00139 UErrorCode& status) const;
00140
00157 virtual UnicodeString& format(const Formattable& obj,
00158 UnicodeString& appendTo,
00159 FieldPosition& pos,
00160 UErrorCode& status) const = 0;
00161
00201 virtual void parseObject(const UnicodeString& source,
00202 Formattable& result,
00203 ParsePosition& parse_pos) const = 0;
00204
00217 void parseObject(const UnicodeString& source,
00218 Formattable& result,
00219 UErrorCode& status) const;
00220
00233 virtual UClassID getDynamicClassID() const = 0;
00234
00241 Locale getLocale(ULocDataLocaleType type, UErrorCode& status) const;
00242
00249 const char* getLocaleID(ULocDataLocaleType type, UErrorCode &status) const;
00250
00251 protected:
00253 void setLocaleIDs(const char* valid, const char* actual);
00254
00255 protected:
00260 Format();
00261
00265 Format(const Format&);
00266
00270 Format& operator=(const Format&);
00271
00272
00281 static void syntaxError(const UnicodeString& pattern,
00282 int32_t pos,
00283 UParseError& parseError);
00284
00285 private:
00286 char actualLocale[ULOC_FULLNAME_CAPACITY];
00287 char validLocale[ULOC_FULLNAME_CAPACITY];
00288 };
00289
00290 U_NAMESPACE_END
00291
00292 #endif
00293
00294 #endif // _FORMAT
00295