ICU 71.1 71.1

selfmt.h
Go to the documentation of this file.
1 // © 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/utypes.h"
22
23 #if U_SHOW_CPLUSPLUS_API
24
25 #include "unicode/messagepattern.h"
26 #include "unicode/numfmt.h"
27
33 #if !UCONFIG_NO_FORMATTING
34
35 U_NAMESPACE_BEGIN
36
37 class MessageFormat;
38
188 class U_I18N_API SelectFormat : public Format {
189 public:
190
199 SelectFormat(const UnicodeString& pattern, UErrorCode& status);
200
205 SelectFormat(const SelectFormat& other);
206
211 virtual ~SelectFormat();
212
224 void applyPattern(const UnicodeString& pattern, UErrorCode& status);
225
226
227 using Format::format;
228
242 UnicodeString& format(const UnicodeString& keyword,
243 UnicodeString& appendTo,
244 FieldPosition& pos,
245 UErrorCode& status) const;
246
253 SelectFormat& operator=(const SelectFormat& other);
254
262 virtual bool operator==(const Format& other) const override;
263
271 virtual bool operator!=(const Format& other) const;
272
278 virtual SelectFormat* clone() const override;
279
295 UnicodeString& format(const Formattable& obj,
296 UnicodeString& appendTo,
297 FieldPosition& pos,
298 UErrorCode& status) const override;
299
308 UnicodeString& toPattern(UnicodeString& appendTo);
309
332 virtual void parseObject(const UnicodeString& source,
333 Formattable& result,
334 ParsePosition& parse_pos) const override;
335
340 static UClassID U_EXPORT2 getStaticClassID(void);
341
346 virtual UClassID getDynamicClassID() const override;
347
348 private:
349 friend class MessageFormat;
350
351 SelectFormat(); // default constructor not implemented.
352
361 static int32_t findSubMessage(const MessagePattern& pattern, int32_t partIndex,
362 const UnicodeString& keyword, UErrorCode& ec);
363
364 MessagePattern msgPattern;
365 };
366
367 U_NAMESPACE_END
368
369 #endif /* #if !UCONFIG_NO_FORMATTING */
370
371 #endif /* U_SHOW_CPLUSPLUS_API */
372
373 #endif // _SELFMT
374 //eof
icu::FieldPosition
FieldPosition is a simple class used by Format and its subclasses to identify fields in formatted out...
Definition: fieldpos.h:110
icu::SelectFormat
Definition: selfmt.h:188
utypes.h
Basic definitions for ICU, for both C and C++ APIs.
U_I18N_API
#define U_I18N_API
Definition: utypes.h:301
icu::Format::parseObject
virtual void parseObject(const UnicodeString &source, Formattable &result, ParsePosition &parse_pos) const =0
Parse a string to produce an object.
icu::Formattable
Formattable objects can be passed to the Format class or its subclasses for formatting.
Definition: fmtable.h:64
icu::Format::operator!=
bool operator!=(const Format &other) const
Return true if the given Format objects are not semantically equal.
Definition: format.h:123
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:345
icu::MessagePattern
Parses and represents ICU MessageFormat patterns.
Definition: messagepattern.h:362
icu::Format
Base class for all formats.
Definition: format.h:98
icu::UnicodeString
UnicodeString is a string class that stores Unicode characters directly and provides similar function...
Definition: unistr.h:295
icu::Format::operator=
Format & operator=(const Format &)
icu::Format::clone
virtual Format * clone() const =0
Clone this object polymorphically.
UClassID
void * UClassID
UClassID is used to identify classes without using the compiler's RTTI.
Definition: uobject.h:96
UErrorCode
UErrorCode
Standard ICU4C error code type, a substitute for exceptions.
Definition: utypes.h:415
icu::UObject::getDynamicClassID
virtual UClassID getDynamicClassID() const
ICU4C "poor man's RTTI", returns a UClassID for the actual ICU class.
messagepattern.h
C++ API: MessagePattern class: Parses and represents ICU MessageFormat patterns.
numfmt.h
C++ API: Compatibility APIs for number formatting.
icu::ParsePosition
ParsePosition is a simple class used by Format and its subclasses to keep track of the current positi...
Definition: parsepos.h:52
icu::Format::operator==
virtual bool operator==(const Format &other) const =0
Return true if the given Format objects are semantically equal.