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
22#include "unicode/numfmt.h"
23#include "unicode/utypes.h"
24
30#if !UCONFIG_NO_FORMATTING
31
33
34class MessageFormat;
35
186public:
187
197
203
208 virtual ~SelectFormat();
209
222
223
224 using Format::format;
225
240 UnicodeString& appendTo,
241 FieldPosition& pos,
242 UErrorCode& status) const;
243
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
293 UnicodeString& appendTo,
294 FieldPosition& pos,
295 UErrorCode& status) const;
296
306
329 virtual void parseObject(const UnicodeString& source,
331 ParsePosition& parse_pos) const;
332
338
344
345private:
346 friend class MessageFormat;
347
348 SelectFormat(); // default constructor not implemented.
349
358 static int32_t findSubMessage(const MessagePattern& pattern, int32_t partIndex,
360
361 MessagePattern msgPattern;
362};
363
365
366#endif /* #if !UCONFIG_NO_FORMATTING */
367
368#endif // _SELFMT
369//eof
FieldPosition is a simple class used by Format and its subclasses to identify fields in formatted out...
Definition fieldpos.h:108
Base class for all formats.
Definition format.h:96
Formattable objects can be passed to the Format class or its subclasses for formatting.
Definition fmtable.h:62
"Smart pointer" base class; do not use directly: use LocalPointer etc.
Parses and represents ICU MessageFormat patterns.
ParsePosition is a simple class used by Format and its subclasses to keep track of the current positi...
Definition parsepos.h:49
virtual UBool operator==(const Format &other) const
Return true if another object is semantically equal to this one.
SelectFormat(const SelectFormat &other)
copy constructor.
static UClassID getStaticClassID(void)
ICU "poor man's RTTI", returns a UClassID for this class.
UnicodeString & format(const UnicodeString &keyword, UnicodeString &appendTo, FieldPosition &pos, UErrorCode &status) const
Selects the phrase for the given keyword.
virtual Format * clone(void) const
Clones this Format object polymorphically.
virtual ~SelectFormat()
Destructor.
UnicodeString & toPattern(UnicodeString &appendTo)
Returns the pattern from applyPattern() or constructor.
virtual UClassID getDynamicClassID() const
ICU "poor man's RTTI", returns a UClassID for the actual class.
virtual void parseObject(const UnicodeString &source, Formattable &result, ParsePosition &parse_pos) const
This method is not yet supported by SelectFormat.
void applyPattern(const UnicodeString &pattern, UErrorCode &status)
Sets the pattern used by this select format.
UnicodeString & format(const Formattable &obj, UnicodeString &appendTo, FieldPosition &pos, UErrorCode &status) const
Format an object to produce a string.
SelectFormat(const UnicodeString &pattern, UErrorCode &status)
Creates a new SelectFormat for a given pattern string.
virtual UBool operator!=(const Format &other) const
Return true if another object is semantically unequal to this one.
SelectFormat & operator=(const SelectFormat &other)
Assignment operator.
UnicodeString is a string class that stores Unicode characters directly and provides similar function...
Definition unistr.h:287
C++ API: MessagePattern class: Parses and represents ICU MessageFormat patterns.
C++ API: Compatibility APIs for number formatting.
int8_t UBool
The ICU boolean type.
Definition umachine.h:236
void * UClassID
UClassID is used to identify classes without using the compiler's RTTI.
Definition uobject.h:93
Basic definitions for ICU, for both C and C++ APIs.
UErrorCode
Error code to replace exception handling, so that the code is compatible with all C++ compilers,...
Definition utypes.h:396
#define U_I18N_API
Set to export library symbols from inside the i18n library, and to import them from outside.
Definition utypes.h:360
#define U_NAMESPACE_END
This is used to end a declaration of a public ICU C++ API.
Definition uversion.h:138
#define U_NAMESPACE_BEGIN
This is used to begin a declaration of a public ICU C++ API.
Definition uversion.h:137