ICU 58.2 58.2

- Main Page
- Related Pages
- Modules
- Namespaces
- Data Structures
- Files

- File List
- Globals

format.h
Go to the documentation of this file.
1 // Copyright (C) 2016 and later: Unicode, Inc. and others.
2 // License & terms of use: http://www.unicode.org/copyright.html
3 /*
4 ********************************************************************************
5 * Copyright (C) 1997-2011, International Business Machines Corporation and others.
6 * All Rights Reserved.
7 ********************************************************************************
8 *
9 * File FORMAT.H
10 *
11 * Modification History:
12 *
13 * Date Name Description
14 * 02/19/97 aliu Converted from java.
15 * 03/17/97 clhuang Updated per C++ implementation.
16 * 03/27/97 helena Updated to pass the simple test after code review.
17 ********************************************************************************
18 */
19 // *****************************************************************************
20 // This file was generated from the java source file Format.java
21 // *****************************************************************************
22
23 #ifndef FORMAT_H
24 #define FORMAT_H
25
26
27 #include "unicode/utypes.h"
28
34 #if !UCONFIG_NO_FORMATTING
35
36 #include "unicode/unistr.h"
37 #include "unicode/fmtable.h"
38 #include "unicode/fieldpos.h"
39 #include "unicode/fpositer.h"
40 #include "unicode/parsepos.h"
41 #include "unicode/parseerr.h"
42 #include "unicode/locid.h"
43
44 U_NAMESPACE_BEGIN
45
96 class U_I18N_API Format : public UObject {
97 public:
98
102 virtual ~Format();
103
112 virtual UBool operator==(const Format& other) const = 0;
113
121 UBool operator!=(const Format& other) const { return !operator==(other); }
122
129 virtual Format* clone() const = 0;
130
141 UnicodeString& format(const Formattable& obj,
142 UnicodeString& appendTo,
143 UErrorCode& status) const;
144
161 virtual UnicodeString& format(const Formattable& obj,
162 UnicodeString& appendTo,
163 FieldPosition& pos,
164 UErrorCode& status) const = 0;
181 virtual UnicodeString& format(const Formattable& obj,
182 UnicodeString& appendTo,
183 FieldPositionIterator* posIter,
184 UErrorCode& status) const;
185
225 virtual void parseObject(const UnicodeString& source,
226 Formattable& result,
227 ParsePosition& parse_pos) const = 0;
228
241 void parseObject(const UnicodeString& source,
242 Formattable& result,
243 UErrorCode& status) const;
244
251 Locale getLocale(ULocDataLocaleType type, UErrorCode& status) const;
252
253 #ifndef U_HIDE_INTERNAL_API
254
260 const char* getLocaleID(ULocDataLocaleType type, UErrorCode &status) const;
261 #endif /* U_HIDE_INTERNAL_API */
262
263 protected:
265 void setLocaleIDs(const char* valid, const char* actual);
266
267 protected:
272 Format();
273
277 Format(const Format&); // Does nothing; for subclasses only
278
282 Format& operator=(const Format&); // Does nothing; for subclasses
283
284
293 static void syntaxError(const UnicodeString& pattern,
294 int32_t pos,
295 UParseError& parseError);
296
297 private:
298 char actualLocale[ULOC_FULLNAME_CAPACITY];
299 char validLocale[ULOC_FULLNAME_CAPACITY];
300 };
301
302 U_NAMESPACE_END
303
304 #endif /* #if !UCONFIG_NO_FORMATTING */
305
306 #endif // _FORMAT
307 //eof
icu::Format
Base class for all formats.
Definition: format.h:96
fpositer.h
C++ API: FieldPosition Iterator.
unistr.h
C++ API: Unicode String.
icu::operator==
U_EXPORT UBool operator==(const StringPiece &x, const StringPiece &y)
Global operator == for StringPiece.
ULOC_FULLNAME_CAPACITY
#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:264
U_I18N_API
#define U_I18N_API
Set to export library symbols from inside the i18n library, and to import them from outside...
Definition: utypes.h:360
fieldpos.h
C++ API: FieldPosition identifies the fields in a formatted output.
U_NAMESPACE_BEGIN
#define U_NAMESPACE_BEGIN
This is used to begin a declaration of a public ICU C++ API.
Definition: uversion.h:131
icu::FieldPositionIterator
FieldPositionIterator returns the field ids and their start/limit positions generated by a call to Fo...
Definition: fpositer.h:55
U_NAMESPACE_END
#define U_NAMESPACE_END
This is used to end a declaration of a public ICU C++ API.
Definition: uversion.h:132
parseerr.h
C API: Parse Error Information.
parsepos.h
C++ API: Canonical Iterator.
UErrorCode
UErrorCode
Error code to replace exception handling, so that the code is compatible with all C++ compilers...
Definition: utypes.h:396
ULocDataLocaleType
ULocDataLocaleType
Constants for *_getLocale() Allow user to select whether she wants information on requested...
Definition: uloc.h:338
icu::FieldPosition
FieldPosition is a simple class used by Format and its subclasses to identify fields in formatted out...
Definition: fieldpos.h:108
icu::ParsePosition
ParsePosition is a simple class used by Format and its subclasses to keep track of the current positi...
Definition: parsepos.h:49
locid.h
C++ API: Locale ID object.
UParseError
A UParseError struct is used to returned detailed information about parsing errors.
Definition: parseerr.h:58
utypes.h
Basic definitions for ICU, for both C and C++ APIs.
icu::Format::operator!=
UBool operator!=(const Format &other) const
Return true if the given Format objects are not semantically equal.
Definition: format.h:121
icu::UnicodeString
UnicodeString is a string class that stores Unicode characters directly and provides similar function...
Definition: unistr.h:295
icu::Formattable
Formattable objects can be passed to the Format class or its subclasses for formatting.
Definition: fmtable.h:68
icu::UObject
UObject is the common ICU "boilerplate" class.
Definition: uobject.h:223
UBool
int8_t UBool
The ICU boolean type.
Definition: umachine.h:259
fmtable.h
C++ API: Formattable is a thin wrapper for primitive types used for formatting and parsing...
icu::Locale
A Locale object represents a specific geographical, political, or cultural region.
Definition: locid.h:187