ICU 55.1  55.1
selfmt.h
Go to the documentation of this file.
1 /********************************************************************
2  * COPYRIGHT:
3  * Copyright (c) 1997-2011, International Business Machines Corporation and
4  * others. All Rights Reserved.
5  * Copyright (C) 2010 , Yahoo! Inc.
6  ********************************************************************
7  *
8  * File SELFMT.H
9  *
10  * Modification History:
11  *
12  * Date Name Description
13  * 11/11/09 kirtig Finished first cut of implementation.
14  ********************************************************************/
15 
16 #ifndef SELFMT
17 #define SELFMT
18 
19 #include "unicode/messagepattern.h"
20 #include "unicode/numfmt.h"
21 #include "unicode/utypes.h"
22 
28 #if !UCONFIG_NO_FORMATTING
29 
31 
32 class MessageFormat;
33 
184 public:
185 
194  SelectFormat(const UnicodeString& pattern, UErrorCode& status);
195 
200  SelectFormat(const SelectFormat& other);
201 
206  virtual ~SelectFormat();
207 
219  void applyPattern(const UnicodeString& pattern, UErrorCode& status);
220 
221 
222  using Format::format;
223 
238  UnicodeString& appendTo,
239  FieldPosition& pos,
240  UErrorCode& status) const;
241 
249 
257  virtual UBool operator==(const Format& other) const;
258 
266  virtual UBool operator!=(const Format& other) const;
267 
273  virtual Format* clone(void) const;
274 
291  UnicodeString& appendTo,
292  FieldPosition& pos,
293  UErrorCode& status) const;
294 
304 
327  virtual void parseObject(const UnicodeString& source,
328  Formattable& result,
329  ParsePosition& parse_pos) const;
330 
335  static UClassID U_EXPORT2 getStaticClassID(void);
336 
341  virtual UClassID getDynamicClassID() const;
342 
343 private:
344  friend class MessageFormat;
345 
346  SelectFormat(); // default constructor not implemented.
347 
356  static int32_t findSubMessage(const MessagePattern& pattern, int32_t partIndex,
357  const UnicodeString& keyword, UErrorCode& ec);
358 
359  MessagePattern msgPattern;
360 };
361 
363 
364 #endif /* #if !UCONFIG_NO_FORMATTING */
365 
366 #endif // _SELFMT
367 //eof
icu::FieldPosition
FieldPosition is a simple class used by Format and its subclasses to identify fields in formatted out...
Definition: fieldpos.h:106
icu::SelectFormat::parseObject
virtual void parseObject(const UnicodeString &source, Formattable &result, ParsePosition &parse_pos) const
This method is not yet supported by SelectFormat.
icu::SelectFormat
Definition: selfmt.h:183
icu::SelectFormat::getDynamicClassID
virtual UClassID getDynamicClassID() const
ICU "poor man's RTTI", returns a UClassID for the actual class.
utypes.h
Basic definitions for ICU, for both C and C++ APIs.
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:358
UBool
int8_t UBool
The ICU boolean type.
Definition: umachine.h:234
icu::Formattable
Formattable objects can be passed to the Format class or its subclasses for formatting.
Definition: fmtable.h:66
icu::SelectFormat::clone
virtual Format * clone(void) const
Clones this Format object polymorphically.
icu::SelectFormat::operator==
virtual UBool operator==(const Format &other) const
Return true if another object is semantically equal to this one.
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:323
icu::MessagePattern
Parses and represents ICU MessageFormat patterns.
Definition: messagepattern.h:358
icu::Format
Base class for all formats.
Definition: format.h:94
icu::UnicodeString
UnicodeString is a string class that stores Unicode characters directly and provides similar function...
Definition: unistr.h:246
icu::SelectFormat::applyPattern
void applyPattern(const UnicodeString &pattern, UErrorCode &status)
Sets the pattern used by this select format.
icu::SelectFormat::SelectFormat
SelectFormat(const UnicodeString &pattern, UErrorCode &status)
Creates a new SelectFormat for a given pattern string.
UClassID
void * UClassID
UClassID is used to identify classes without using the compiler's RTTI.
Definition: uobject.h:91
UErrorCode
UErrorCode
Error code to replace exception handling, so that the code is compatible with all C++ compilers,...
Definition: utypes.h:476
icu::SelectFormat::format
UnicodeString & format(const Formattable &obj, UnicodeString &appendTo, FieldPosition &pos, UErrorCode &status) const
Format an object to produce a string.
icu::SelectFormat::format
UnicodeString & format(const UnicodeString &keyword, UnicodeString &appendTo, FieldPosition &pos, UErrorCode &status) const
Selects the phrase for the given keyword.
messagepattern.h
C++ API: MessagePattern class: Parses and represents ICU MessageFormat patterns.
icu::SelectFormat::operator!=
virtual UBool operator!=(const Format &other) const
Return true if another object is semantically unequal to this one.
icu::SelectFormat::toPattern
UnicodeString & toPattern(UnicodeString &appendTo)
Returns the pattern from applyPattern() or constructor.
icu::SelectFormat::~SelectFormat
virtual ~SelectFormat()
Destructor.
icu::SelectFormat::getStaticClassID
static UClassID getStaticClassID(void)
ICU "poor man's RTTI", returns a UClassID for this class.
numfmt.h
C++ API: Abstract base class for all number formats.
U_NAMESPACE_END
#define U_NAMESPACE_END
This is used to end a declaration of a public ICU C++ API.
Definition: uversion.h:130
icu::ParsePosition
ParsePosition is a simple class used by Format and its subclasses to keep track of the current positi...
Definition: parsepos.h:47
U_NAMESPACE_BEGIN
#define U_NAMESPACE_BEGIN
This is used to begin a declaration of a public ICU C++ API.
Definition: uversion.h:129
icu::SelectFormat::SelectFormat
SelectFormat(const SelectFormat &other)
copy constructor.
icu::SelectFormat::operator=
SelectFormat & operator=(const SelectFormat &other)
Assignment operator.