ICU 63.2  63.2
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 
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 
365 
366 #endif /* #if !UCONFIG_NO_FORMATTING */
367 
368 #endif // _SELFMT
369 //eof
utypes.h
Basic definitions for ICU, for both C and C++ APIs.
U_I18N_API
#define U_I18N_API
Definition: utypes.h:301
UBool
int8_t UBool
The ICU boolean type.
Definition: umachine.h:225
icu::operator==
U_EXPORT UBool operator==(const StringPiece &x, const StringPiece &y)
Global operator == for StringPiece.
UClassID
void * UClassID
UClassID is used to identify classes without using the compiler's RTTI.
Definition: uobject.h:90
UErrorCode
UErrorCode
Error code to replace exception handling, so that the code is compatible with all C++ compilers,...
Definition: utypes.h:401
icu::operator!=
UBool operator!=(const StringPiece &x, const StringPiece &y)
Global operator != for StringPiece.
Definition: stringpiece.h:218
messagepattern.h
C++ API: MessagePattern class: Parses and represents ICU MessageFormat patterns.
numfmt.h
C++ API: Compatibility APIs for number formatting.
U_NAMESPACE_END
#define U_NAMESPACE_END
Definition: uversion.h:138
U_NAMESPACE_BEGIN
#define U_NAMESPACE_BEGIN
Definition: uversion.h:137