ICU 64.2  64.2
compactdecimalformat.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 ********************************************************************************
5 * Copyright (C) 2012-2016, International Business Machines
6 * Corporation and others. All Rights Reserved.
7 ********************************************************************************
8 *
9 * File COMPACTDECIMALFORMAT.H
10 ********************************************************************************
11 */
12 
13 #ifndef __COMPACT_DECIMAL_FORMAT_H__
14 #define __COMPACT_DECIMAL_FORMAT_H__
15 
16 #include "unicode/utypes.h"
22 #if !UCONFIG_NO_FORMATTING
23 
24 #include "unicode/decimfmt.h"
25 
26 struct UHashtable;
27 
29 
30 class PluralRules;
31 
61 public:
62 
73  static CompactDecimalFormat* U_EXPORT2 createInstance(
74  const Locale& inLocale, UNumberCompactStyle style, UErrorCode& status);
75 
83 
89 
97 
105  Format* clone() const U_OVERRIDE;
106 
107  using DecimalFormat::format;
108 
118  void parse(const UnicodeString& text, Formattable& result,
119  ParsePosition& parsePosition) const U_OVERRIDE;
120 
130  void parse(const UnicodeString& text, Formattable& result, UErrorCode& status) const U_OVERRIDE;
131 
132 #ifndef U_HIDE_INTERNAL_API
133 
154 #endif /* U_HIDE_INTERNAL_API */
155 
167  static UClassID U_EXPORT2 getStaticClassID();
168 
181 
182  private:
183  CompactDecimalFormat(const Locale& inLocale, UNumberCompactStyle style, UErrorCode& status);
184 };
185 
187 
188 #endif /* #if !UCONFIG_NO_FORMATTING */
189 
190 #endif // __COMPACT_DECIMAL_FORMAT_H__
191 //eof
Base class for all formats.
Definition: format.h:96
struct UHashtable UHashtable
Definition: msgfmt.h:41
DecimalFormat & operator=(const DecimalFormat &rhs)
Assignment operator.
#define U_OVERRIDE
Defined to the C++11 "override" keyword if available.
Definition: umachine.h:129
IMPORTANT: New users are strongly encouraged to see if numberformatter.h fits their use case...
Definition: decimfmt.h:665
void * UClassID
UClassID is used to identify classes without using the compiler's RTTI.
Definition: uobject.h:93
static NumberFormat * createInstance(UErrorCode &)
Create a default style NumberFormat for the current default locale.
IMPORTANT: New users are strongly encouraged to see if numberformatter.h fits their use case...
#define U_I18N_API
Set to export library symbols from inside the i18n library, and to import them from outside...
Definition: utypes.h:301
#define U_NAMESPACE_BEGIN
This is used to begin a declaration of a public ICU C++ API.
Definition: uversion.h:137
UnicodeString & format(double number, UnicodeString &appendTo, FieldPosition &pos) const U_OVERRIDE
Format a double or long number using base-10 representation.
static UClassID getStaticClassID(void)
Return the class ID for this class.
Format * clone(void) const U_OVERRIDE
Clone this Format object polymorphically.
#define U_NAMESPACE_END
This is used to end a declaration of a public ICU C++ API.
Definition: uversion.h:138
UNumberCompactStyle
Constants for specifying short or long format.
Definition: unum.h:319
UErrorCode
Error code to replace exception handling, so that the code is compatible with all C++ compilers...
Definition: utypes.h:401
ParsePosition is a simple class used by Format and its subclasses to keep track of the current positi...
Definition: parsepos.h:49
C++ API: Compatibility APIs for decimal formatting.
Basic definitions for ICU, for both C and C++ APIs.
UnicodeString is a string class that stores Unicode characters directly and provides similar function...
Definition: unistr.h:289
Formattable objects can be passed to the Format class or its subclasses for formatting.
Definition: fmtable.h:62
void parse(const UnicodeString &text, Formattable &result, ParsePosition &parsePosition) const U_OVERRIDE
Parse the given string using this object's choices.
CurrencyAmount * parseCurrency(const UnicodeString &text, ParsePosition &pos) const U_OVERRIDE
Parses text from the given string as a currency amount.
A currency together with a numeric amount, such as 200 USD.
Definition: curramt.h:37
UClassID getDynamicClassID(void) const U_OVERRIDE
Returns a unique class ID POLYMORPHICALLY.
A Locale object represents a specific geographical, political, or cultural region.
Definition: locid.h:192