ICU 56.1: compactdecimalformat.h Source File

ICU 56.1 56.1

- Main Page
- Related Pages
- Modules
- Namespaces
- Data Structures
- Files

- File List
- Globals

compactdecimalformat.h
Go to the documentation of this file.
1 /*
2 ********************************************************************************
3 * Copyright (C) 2012-2015, International Business Machines
4 * Corporation and others. All Rights Reserved.
5 ********************************************************************************
6 *
7 * File COMPACTDECIMALFORMAT.H
8 ********************************************************************************
9 */
10
11 #ifndef __COMPACT_DECIMAL_FORMAT_H__
12 #define __COMPACT_DECIMAL_FORMAT_H__
13
14 #include "unicode/utypes.h"
20 #if !UCONFIG_NO_FORMATTING
21
22 #include "unicode/decimfmt.h"
23
24 struct UHashtable;
25
26 U_NAMESPACE_BEGIN
27
28 class PluralRules;
29
52 class U_I18N_API CompactDecimalFormat : public DecimalFormat {
53 public:
54
62 static CompactDecimalFormat* U_EXPORT2 createInstance(
63 const Locale& inLocale, UNumberCompactStyle style, UErrorCode& status);
64
71 CompactDecimalFormat(const CompactDecimalFormat& source);
72
77 virtual ~CompactDecimalFormat();
78
85 CompactDecimalFormat& operator=(const CompactDecimalFormat& rhs);
86
94 virtual Format* clone() const;
95
104 virtual UBool operator==(const Format& other) const;
105
106
107 using DecimalFormat::format;
108
120 virtual UnicodeString& format(double number,
121 UnicodeString& appendTo,
122 FieldPosition& pos) const;
123
136 virtual UnicodeString& format(double number,
137 UnicodeString& appendTo,
138 FieldPosition& pos,
139 UErrorCode &status) const;
140
155 virtual UnicodeString& format(double number,
156 UnicodeString& appendTo,
157 FieldPositionIterator* posIter,
158 UErrorCode& status) const;
159
171 virtual UnicodeString& format(int32_t number,
172 UnicodeString& appendTo,
173 FieldPosition& pos) const;
174
186 virtual UnicodeString& format(int32_t number,
187 UnicodeString& appendTo,
188 FieldPosition& pos,
189 UErrorCode &status) const;
190
205 virtual UnicodeString& format(int32_t number,
206 UnicodeString& appendTo,
207 FieldPositionIterator* posIter,
208 UErrorCode& status) const;
209
221 virtual UnicodeString& format(int64_t number,
222 UnicodeString& appendTo,
223 FieldPosition& pos) const;
224
236 virtual UnicodeString& format(int64_t number,
237 UnicodeString& appendTo,
238 FieldPosition& pos,
239 UErrorCode &status) const;
240
255 virtual UnicodeString& format(int64_t number,
256 UnicodeString& appendTo,
257 FieldPositionIterator* posIter,
258 UErrorCode& status) const;
259
276 virtual UnicodeString& format(const StringPiece &number,
277 UnicodeString& appendTo,
278 FieldPositionIterator* posIter,
279 UErrorCode& status) const;
280
296 virtual UnicodeString& format(const DigitList &number,
297 UnicodeString& appendTo,
298 FieldPositionIterator* posIter,
299 UErrorCode& status) const;
300
316 virtual UnicodeString& format(const DigitList &number,
317 UnicodeString& appendTo,
318 FieldPosition& pos,
319 UErrorCode& status) const;
320
330 virtual void parse(const UnicodeString& text,
331 Formattable& result,
332 ParsePosition& parsePosition) const;
333
343 virtual void parse(const UnicodeString& text,
344 Formattable& result,
345 UErrorCode& status) const;
346
367 virtual CurrencyAmount* parseCurrency(const UnicodeString& text,
368 ParsePosition& pos) const;
369
381 static UClassID U_EXPORT2 getStaticClassID();
382
394 virtual UClassID getDynamicClassID() const;
395
396 private:
397
398 const UHashtable* _unitsByVariant;
399 const double* _divisors;
400 PluralRules* _pluralRules;
401
402 // Default constructor not implemented.
403 CompactDecimalFormat(const DecimalFormat &, const UHashtable* unitsByVariant, const double* divisors, PluralRules* pluralRules);
404
405 UBool eqHelper(const CompactDecimalFormat& that) const;
406 };
407
408 U_NAMESPACE_END
409
410 #endif /* #if !UCONFIG_NO_FORMATTING */
411
412 #endif // __COMPACT_DECIMAL_FORMAT_H__
413 //eof
icu::Format
Base class for all formats.
Definition: format.h:94
icu::DecimalFormat::operator=
DecimalFormat & operator=(const DecimalFormat &rhs)
Assignment operator.
icu::DecimalFormat
DecimalFormat is a concrete subclass of NumberFormat that formats decimal numbers.
Definition: decimfmt.h:668
UClassID
void * UClassID
UClassID is used to identify classes without using the compiler's RTTI.
Definition: uobject.h:91
icu::NumberFormat::createInstance
static NumberFormat * createInstance(UErrorCode &)
Returns the default number format for the current default locale.
icu::PluralRules
Defines rules for mapping non-negative numeric values onto a small set of keywords.
Definition: plurrule.h:192
icu::CompactDecimalFormat
The CompactDecimalFormat produces abbreviated numbers, suitable for display in environments will limi...
Definition: compactdecimalformat.h:52
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
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::FieldPositionIterator
FieldPositionIterator returns the field ids and their start/limit positions generated by a call to Fo...
Definition: fpositer.h:53
icu::DecimalFormat::getDynamicClassID
virtual UClassID getDynamicClassID(void) const
Returns a unique class ID POLYMORPHICALLY.
icu::DecimalFormat::parseCurrency
virtual CurrencyAmount * parseCurrency(const UnicodeString &text, ParsePosition &pos) const
Parses text from the given string as a currency amount.
icu::DecimalFormat::format
virtual UnicodeString & format(double number, UnicodeString &appendTo, FieldPosition &pos) const
Format a double or long number using base-10 representation.
icu::DecimalFormat::clone
virtual Format * clone(void) const
Clone this Format object polymorphically.
icu::DecimalFormat::getStaticClassID
static UClassID getStaticClassID(void)
Return the class ID for this class.
icu::DecimalFormat::parse
virtual void parse(const UnicodeString &text, Formattable &result, ParsePosition &parsePosition) const
Parse the given string using this object's choices.
U_NAMESPACE_END
#define U_NAMESPACE_END
This is used to end a declaration of a public ICU C++ API.
Definition: uversion.h:130
UNumberCompactStyle
UNumberCompactStyle
Constants for specifying short or long format.
Definition: unum.h:307
UErrorCode
UErrorCode
Error code to replace exception handling, so that the code is compatible with all C++ compilers...
Definition: utypes.h:476
icu::FieldPosition
FieldPosition is a simple class used by Format and its subclasses to identify fields in formatted out...
Definition: fieldpos.h:106
icu::ParsePosition
ParsePosition is a simple class used by Format and its subclasses to keep track of the current positi...
Definition: parsepos.h:47
icu::DecimalFormat::operator==
virtual UBool operator==(const Format &other) const
Return true if the given Format objects are semantically equal.
decimfmt.h
C++ API: Formats decimal numbers.
utypes.h
Basic definitions for ICU, for both C and C++ APIs.
icu::UnicodeString
UnicodeString is a string class that stores Unicode characters directly and provides similar function...
Definition: unistr.h:293
icu::Formattable
Formattable objects can be passed to the Format class or its subclasses for formatting.
Definition: fmtable.h:66
icu::StringPiece
A string-like object that points to a sized piece of memory.
Definition: stringpiece.h:52
icu::CurrencyAmount
A currency together with a numeric amount, such as 200 USD.
Definition: curramt.h:35
UBool
int8_t UBool
The ICU boolean type.
Definition: umachine.h:234
icu::Locale
A Locale object represents a specific geographical, political, or cultural region.
Definition: locid.h:185