ICU 62.1  62.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/messagepattern.h"
22 #include "unicode/numfmt.h"
23 #include "unicode/utypes.h"
24 
30 #if !UCONFIG_NO_FORMATTING
31 
33 
34 class MessageFormat;
35 
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 
365 
366 #endif /* #if !UCONFIG_NO_FORMATTING */
367 
368 #endif // _SELFMT
369 //eof
icu::FieldPosition
FieldPosition is a simple class used by Format and its subclasses to identify fields in formatted out...
Definition: fieldpos.h:108
icu::SelectFormat
Definition: selfmt.h:185
utypes.h
Basic definitions for ICU, for both C and C++ APIs.
U_I18N_API
#define U_I18N_API
Definition: utypes.h:360
UBool
int8_t UBool
The ICU boolean type.
Definition: umachine.h:236
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:62
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::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
icu::MessagePattern
Parses and represents ICU MessageFormat patterns.
Definition: messagepattern.h:360
icu::Format
Base class for all formats.
Definition: format.h:96
icu::UnicodeString
UnicodeString is a string class that stores Unicode characters directly and provides similar function...
Definition: unistr.h:286
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:93
UErrorCode
UErrorCode
Error code to replace exception handling, so that the code is compatible with all C++ compilers,...
Definition: utypes.h:396
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::Format::operator==
virtual UBool operator==(const Format &other) const =0
Return true if the given Format objects are semantically equal.
U_NAMESPACE_END
#define U_NAMESPACE_END
Definition: uversion.h:138
icu::ParsePosition
ParsePosition is a simple class used by Format and its subclasses to keep track of the current positi...
Definition: parsepos.h:49
U_NAMESPACE_BEGIN
#define U_NAMESPACE_BEGIN
Definition: uversion.h:137