ICU 62.1  62.1
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 
60 public:
61 
72  static CompactDecimalFormat* U_EXPORT2 createInstance(
73  const Locale& inLocale, UNumberCompactStyle style, UErrorCode& status);
74 
82 
87  ~CompactDecimalFormat() U_OVERRIDE;
88 
96 
104  Format* clone() const U_OVERRIDE;
105 
106  using DecimalFormat::format;
107 
117  void parse(const UnicodeString& text, Formattable& result,
118  ParsePosition& parsePosition) const U_OVERRIDE;
119 
129  void parse(const UnicodeString& text, Formattable& result, UErrorCode& status) const U_OVERRIDE;
130 
131 #ifndef U_HIDE_INTERNAL_API
132 
152  CurrencyAmount* parseCurrency(const UnicodeString& text, ParsePosition& pos) const U_OVERRIDE;
153 #endif /* U_HIDE_INTERNAL_API */
154 
166  static UClassID U_EXPORT2 getStaticClassID();
167 
179  UClassID getDynamicClassID() const U_OVERRIDE;
180 
181  private:
182  CompactDecimalFormat(const Locale& inLocale, UNumberCompactStyle style, UErrorCode& status);
183 };
184 
186 
187 #endif /* #if !UCONFIG_NO_FORMATTING */
188 
189 #endif // __COMPACT_DECIMAL_FORMAT_H__
190 //eof
Base class for all formats.
Definition: format.h:96
DecimalFormat & operator=(const DecimalFormat &rhs)
Assignment operator.
Format * clone(void) const
Clone this Format object polymorphically.
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.
#define U_I18N_API
Set to export library symbols from inside the i18n library, and to import them from outside...
Definition: utypes.h:360
void parse(const UnicodeString &text, Formattable &result, ParsePosition &parsePosition) const
Parse the given string using this object's choices.
#define U_NAMESPACE_BEGIN
This is used to begin a declaration of a public ICU C++ API.
Definition: uversion.h:137
static UClassID getStaticClassID(void)
Return the class ID for this class.
#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:396
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.
UClassID getDynamicClassID(void) const
Returns a unique class ID POLYMORPHICALLY.
CurrencyAmount * parseCurrency(const UnicodeString &text, ParsePosition &pos) const
Parses text from the given string as a currency amount.
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:286
Formattable objects can be passed to the Format class or its subclasses for formatting.
Definition: fmtable.h:62
A currency together with a numeric amount, such as 200 USD.
Definition: curramt.h:37
UnicodeString & format(double number, UnicodeString &appendTo, FieldPosition &pos) const
Format a double or long number using base-10 representation.
A Locale object represents a specific geographical, political, or cultural region.
Definition: locid.h:188