ICU 58.2 58.2

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

- File List
- Globals

selfmt.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 * COPYRIGHT:
5 * Copyright (c) 1997-2011, International Business Machines Corporation and
6 * others. All Rights Reserved.
7 * Copyright (C) 2010 , Yahoo! Inc.
8 ********************************************************************
9 *
10 * File SELFMT.H
11 *
12 * Modification History:
13 *
14 * Date Name Description
15 * 11/11/09 kirtig Finished first cut of implementation.
16 ********************************************************************/
17
18 #ifndef SELFMT
19 #define SELFMT
20
21 #include "unicode/messagepattern.h"
22 #include "unicode/numfmt.h"
23 #include "unicode/utypes.h"
24
30 #if !UCONFIG_NO_FORMATTING
31
32 U_NAMESPACE_BEGIN
33
34 class MessageFormat;
35
185 class U_I18N_API SelectFormat : public Format {
186 public:
187
196 SelectFormat(const UnicodeString& pattern, UErrorCode& status);
197
202 SelectFormat(const SelectFormat& other);
203
208 virtual ~SelectFormat();
209
221 void applyPattern(const UnicodeString& pattern, UErrorCode& status);
222
223
224 using Format::format;
225
239 UnicodeString& format(const UnicodeString& keyword,
240 UnicodeString& appendTo,
241 FieldPosition& pos,
242 UErrorCode& status) const;
243
250 SelectFormat& operator=(const SelectFormat& other);
251
259 virtual UBool operator==(const Format& other) const;
260
268 virtual UBool operator!=(const Format& other) const;
269
275 virtual Format* clone(void) const;
276
292 UnicodeString& format(const Formattable& obj,
293 UnicodeString& appendTo,
294 FieldPosition& pos,
295 UErrorCode& status) const;
296
305 UnicodeString& toPattern(UnicodeString& appendTo);
306
329 virtual void parseObject(const UnicodeString& source,
330 Formattable& result,
331 ParsePosition& parse_pos) const;
332
337 static UClassID U_EXPORT2 getStaticClassID(void);
338
343 virtual UClassID getDynamicClassID() const;
344
345 private:
346 friend class MessageFormat;
347
348 SelectFormat(); // default constructor not implemented.
349
358 static int32_t findSubMessage(const MessagePattern& pattern, int32_t partIndex,
359 const UnicodeString& keyword, UErrorCode& ec);
360
361 MessagePattern msgPattern;
362 };
363
364 U_NAMESPACE_END
365
366 #endif /* #if !UCONFIG_NO_FORMATTING */
367
368 #endif // _SELFMT
369 //eof
icu::Format
Base class for all formats.
Definition: format.h:96
icu::UObject::getDynamicClassID
virtual UClassID getDynamicClassID() const
ICU4C "poor man&#39;s RTTI", returns a UClassID for the actual ICU class.
UClassID
void * UClassID
UClassID is used to identify classes without using the compiler&#39;s RTTI.
Definition: uobject.h:93
icu::Format::clone
virtual Format * clone() const =0
Clone this object polymorphically.
icu::MessagePattern
Parses and represents ICU MessageFormat patterns.
Definition: messagepattern.h:360
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
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::Format::format
UnicodeString & format(const Formattable &obj, UnicodeString &appendTo, UErrorCode &status) const
Formats an object to produce a string.
icu::MessageFormat
Definition: msgfmt.h:325
U_NAMESPACE_END
#define U_NAMESPACE_END
This is used to end a declaration of a public ICU C++ API.
Definition: uversion.h:132
icu::SelectFormat
Definition: selfmt.h:185
UErrorCode
UErrorCode
Error code to replace exception handling, so that the code is compatible with all C++ compilers...
Definition: utypes.h:396
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
icu::Format::operator==
virtual UBool operator==(const Format &other) const =0
Return true if the given Format objects are semantically equal.
icu::Format::parseObject
virtual void parseObject(const UnicodeString &source, Formattable &result, ParsePosition &parse_pos) const =0
Parse a string to produce an object.
utypes.h
Basic definitions for ICU, for both C and C++ APIs.
icu::Format::operator=
Format & operator=(const Format &)
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
messagepattern.h
C++ API: MessagePattern class: Parses and represents ICU MessageFormat patterns.
numfmt.h
C++ API: Abstract base class for all number formats.
UBool
int8_t UBool
The ICU boolean type.
Definition: umachine.h:259