ICU 50.1.2  50.1.2
format.h
Go to the documentation of this file.
1 /*
2 ********************************************************************************
3 * Copyright (C) 1997-2011, International Business Machines Corporation and others.
4 * All Rights Reserved.
5 ********************************************************************************
6 *
7 * File FORMAT.H
8 *
9 * Modification History:
10 *
11 * Date Name Description
12 * 02/19/97 aliu Converted from java.
13 * 03/17/97 clhuang Updated per C++ implementation.
14 * 03/27/97 helena Updated to pass the simple test after code review.
15 ********************************************************************************
16 */
17 // *****************************************************************************
18 // This file was generated from the java source file Format.java
19 // *****************************************************************************
20 
21 #ifndef FORMAT_H
22 #define FORMAT_H
23 
24 
25 #include "unicode/utypes.h"
26 
32 #if !UCONFIG_NO_FORMATTING
33 
34 #include "unicode/unistr.h"
35 #include "unicode/fmtable.h"
36 #include "unicode/fieldpos.h"
37 #include "unicode/fpositer.h"
38 #include "unicode/parsepos.h"
39 #include "unicode/parseerr.h"
40 #include "unicode/locid.h"
41 
43 
94 class U_I18N_API Format : public UObject {
95 public:
96 
100  virtual ~Format();
101 
110  virtual UBool operator==(const Format& other) const = 0;
111 
119  UBool operator!=(const Format& other) const { return !operator==(other); }
120 
127  virtual Format* clone() const = 0;
128 
139  UnicodeString& format(const Formattable& obj,
140  UnicodeString& appendTo,
141  UErrorCode& status) const;
142 
159  virtual UnicodeString& format(const Formattable& obj,
160  UnicodeString& appendTo,
161  FieldPosition& pos,
162  UErrorCode& status) const = 0;
179  virtual UnicodeString& format(const Formattable& obj,
180  UnicodeString& appendTo,
181  FieldPositionIterator* posIter,
182  UErrorCode& status) const;
183 
223  virtual void parseObject(const UnicodeString& source,
224  Formattable& result,
225  ParsePosition& parse_pos) const = 0;
226 
239  void parseObject(const UnicodeString& source,
240  Formattable& result,
241  UErrorCode& status) const;
242 
249  Locale getLocale(ULocDataLocaleType type, UErrorCode& status) const;
250 
251 #ifndef U_HIDE_INTERNAL_API
252 
258  const char* getLocaleID(ULocDataLocaleType type, UErrorCode &status) const;
259 #endif /* U_HIDE_INTERNAL_API */
260 
261  protected:
263  void setLocaleIDs(const char* valid, const char* actual);
264 
265 protected:
270  Format();
271 
275  Format(const Format&); // Does nothing; for subclasses only
276 
280  Format& operator=(const Format&); // Does nothing; for subclasses
281 
282 
291  static void syntaxError(const UnicodeString& pattern,
292  int32_t pos,
293  UParseError& parseError);
294 
295  private:
296  char actualLocale[ULOC_FULLNAME_CAPACITY];
297  char validLocale[ULOC_FULLNAME_CAPACITY];
298 };
299 
301 
302 #endif /* #if !UCONFIG_NO_FORMATTING */
303 
304 #endif // _FORMAT
305 //eof