00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef FORMAT_H
00024 #define FORMAT_H
00025
00026
00027 #include "unicode/utypes.h"
00028
00029 #if U_SHOW_CPLUSPLUS_API
00030
00036 #if !UCONFIG_NO_FORMATTING
00037
00038 #include "unicode/unistr.h"
00039 #include "unicode/fmtable.h"
00040 #include "unicode/fieldpos.h"
00041 #include "unicode/fpositer.h"
00042 #include "unicode/parsepos.h"
00043 #include "unicode/parseerr.h"
00044 #include "unicode/locid.h"
00045
00046 U_NAMESPACE_BEGIN
00047
00098 class U_I18N_API Format : public UObject {
00099 public:
00100
00104 virtual ~Format();
00105
00114 virtual UBool operator==(const Format& other) const = 0;
00115
00123 UBool operator!=(const Format& other) const { return !operator==(other); }
00124
00131 virtual Format* clone() const = 0;
00132
00143 UnicodeString& format(const Formattable& obj,
00144 UnicodeString& appendTo,
00145 UErrorCode& status) const;
00146
00163 virtual UnicodeString& format(const Formattable& obj,
00164 UnicodeString& appendTo,
00165 FieldPosition& pos,
00166 UErrorCode& status) const = 0;
00183 virtual UnicodeString& format(const Formattable& obj,
00184 UnicodeString& appendTo,
00185 FieldPositionIterator* posIter,
00186 UErrorCode& status) const;
00187
00227 virtual void parseObject(const UnicodeString& source,
00228 Formattable& result,
00229 ParsePosition& parse_pos) const = 0;
00230
00243 void parseObject(const UnicodeString& source,
00244 Formattable& result,
00245 UErrorCode& status) const;
00246
00253 Locale getLocale(ULocDataLocaleType type, UErrorCode& status) const;
00254
00255 #ifndef U_HIDE_INTERNAL_API
00256
00262 const char* getLocaleID(ULocDataLocaleType type, UErrorCode &status) const;
00263 #endif
00264
00265 protected:
00267 void setLocaleIDs(const char* valid, const char* actual);
00268
00269 protected:
00274 Format();
00275
00279 Format(const Format&);
00280
00284 Format& operator=(const Format&);
00285
00286
00295 static void syntaxError(const UnicodeString& pattern,
00296 int32_t pos,
00297 UParseError& parseError);
00298
00299 private:
00300 char actualLocale[ULOC_FULLNAME_CAPACITY];
00301 char validLocale[ULOC_FULLNAME_CAPACITY];
00302 };
00303
00304 U_NAMESPACE_END
00305
00306 #endif
00307
00308 #endif
00309
00310 #endif // _FORMAT
00311