ICU 73.2  73.2
format.h
Go to the documentation of this file.
00001 // © 2016 and later: Unicode, Inc. and others.
00002 // License & terms of use: http://www.unicode.org/copyright.html
00003 /*
00004 ********************************************************************************
00005 * Copyright (C) 1997-2011, International Business Machines Corporation and others.
00006 * All Rights Reserved.
00007 ********************************************************************************
00008 *
00009 * File FORMAT.H
00010 *
00011 * Modification History:
00012 *
00013 *   Date        Name        Description
00014 *   02/19/97    aliu        Converted from java.
00015 *   03/17/97    clhuang     Updated per C++ implementation.
00016 *   03/27/97    helena      Updated to pass the simple test after code review.
00017 ********************************************************************************
00018 */
00019 // *****************************************************************************
00020 // This file was generated from the java source file Format.java
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 bool operator==(const Format& other) const = 0;
00115 
00123     bool 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  /* U_HIDE_INTERNAL_API */
00264 
00265  protected:
00267     void setLocaleIDs(const char* valid, const char* actual);
00268 
00269 protected:
00274     Format();
00275 
00279     Format(const Format&); // Does nothing; for subclasses only
00280 
00284     Format& operator=(const Format&); // Does nothing; for subclasses
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 /* #if !UCONFIG_NO_FORMATTING */
00307 
00308 #endif /* U_SHOW_CPLUSPLUS_API */
00309 
00310 #endif // _FORMAT
00311 //eof