ICU 4.2.1
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
format.h
Go to the documentation of this file.
1 /*
2 ********************************************************************************
3 * Copyright (C) 1997-2006, 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/parsepos.h"
38 #include "unicode/parseerr.h"
39 #include "unicode/locid.h"
40 
42 
93 class U_I18N_API Format : public UObject {
94 public:
95 
99  virtual ~Format();
100 
109  virtual UBool operator==(const Format& other) const = 0;
110 
118  UBool operator!=(const Format& other) const { return !operator==(other); }
119 
126  virtual Format* clone() const = 0;
127 
138  UnicodeString& format(const Formattable& obj,
139  UnicodeString& appendTo,
140  UErrorCode& status) const;
141 
158  virtual UnicodeString& format(const Formattable& obj,
159  UnicodeString& appendTo,
160  FieldPosition& pos,
161  UErrorCode& status) const = 0;
162 
202  virtual void parseObject(const UnicodeString& source,
203  Formattable& result,
204  ParsePosition& parse_pos) const = 0;
205 
218  void parseObject(const UnicodeString& source,
219  Formattable& result,
220  UErrorCode& status) const;
221 
234  virtual UClassID getDynamicClassID() const = 0;
235 
242  Locale getLocale(ULocDataLocaleType type, UErrorCode& status) const;
243 
250  const char* getLocaleID(ULocDataLocaleType type, UErrorCode &status) const;
251 
252  protected:
254  void setLocaleIDs(const char* valid, const char* actual);
255 
256 protected:
261  Format();
262 
266  Format(const Format&); // Does nothing; for subclasses only
267 
271  Format& operator=(const Format&); // Does nothing; for subclasses
272 
273 
282  static void syntaxError(const UnicodeString& pattern,
283  int32_t pos,
284  UParseError& parseError);
285 
286  private:
287  char actualLocale[ULOC_FULLNAME_CAPACITY];
288  char validLocale[ULOC_FULLNAME_CAPACITY];
289 };
290 
292 
293 #endif /* #if !UCONFIG_NO_FORMATTING */
294 
295 #endif // _FORMAT
296 //eof
UBool operator!=(const Format &other) const
Return true if the given Format objects are not semantically equal.
Definition: format.h:118
C++ API: Unicode String.
#define ULOC_FULLNAME_CAPACITY
Useful constant for the maximum size of the whole locale ID (including the terminating NULL and all k...
Definition: uloc.h:262
#define U_I18N_API
Set to export library symbols from inside the i18n library, and to import them from outside...
Definition: utypes.h:475
C++ API: FieldPosition identifies the fields in a formatted output.
#define U_NAMESPACE_BEGIN
This is used to begin a declaration of a public ICU C++ API.
Definition: uversion.h:183
ParsePosition is a simple class used by Format and its subclasses to keep track of the current positi...
Definition: parsepos.h:47
UnicodeString is a string class that stores Unicode characters directly and provides similar function...
Definition: unistr.h:187
FieldPosition is a simple class used by Format and its subclasses to identify fields in formatted out...
Definition: fieldpos.h:106
#define U_NAMESPACE_END
This is used to end a declaration of a public ICU C++ API If the compiler doesn't support namespaces...
Definition: uversion.h:184
UObject is the common ICU "boilerplate" class.
Definition: uobject.h:212
C API: Parse Error Information.
C++ API: Canonical Iterator.
Formattable objects can be passed to the Format class or its subclasses for formatting.
Definition: fmtable.h:47
void * UClassID
UClassID is used to identify classes without using RTTI, since RTTI is not yet supported by all C++ c...
Definition: utypes.h:339
UErrorCode
Error code to replace exception handling, so that the code is compatible with all C++ compilers...
Definition: utypes.h:593
ULocDataLocaleType
Constants for *_getLocale() Allow user to select whether she wants information on requested...
Definition: uloc.h:314
C++ API: Locale ID object.
A UParseError struct is used to returned detailed information about parsing errors.
Definition: parseerr.h:56
Base class for all formats.
Definition: format.h:93
Basic definitions for ICU, for both C and C++ APIs.
A Locale object represents a specific geographical, political, or cultural region.
Definition: locid.h:181
virtual UClassID getDynamicClassID() const =0
ICU4C "poor man's RTTI", returns a UClassID for the actual ICU class.
signed int int32_t
Define 64 bit limits.
Definition: pwin32.h:143
int8_t UBool
The ICU boolean type.
Definition: umachine.h:208
C++ API: Formattable is a thin wrapper for primitive numeric types.