ICU 60.2 60.2

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

- File List
- Globals

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
28 U_NAMESPACE_BEGIN
29
30 class PluralRules;
31
54 class U_I18N_API CompactDecimalFormat : public DecimalFormat {
55 public:
56
64 static CompactDecimalFormat* U_EXPORT2 createInstance(
65 const Locale& inLocale, UNumberCompactStyle style, UErrorCode& status);
66
73 CompactDecimalFormat(const CompactDecimalFormat& source);
74
79 virtual ~CompactDecimalFormat();
80
87 CompactDecimalFormat& operator=(const CompactDecimalFormat& rhs);
88
96 virtual Format* clone() const;
97
106 virtual UBool operator==(const Format& other) const;
107
108
109 using DecimalFormat::format;
110
122 virtual UnicodeString& format(double number,
123 UnicodeString& appendTo,
124 FieldPosition& pos) const;
125
138 virtual UnicodeString& format(double number,
139 UnicodeString& appendTo,
140 FieldPosition& pos,
141 UErrorCode &status) const;
142
157 virtual UnicodeString& format(double number,
158 UnicodeString& appendTo,
159 FieldPositionIterator* posIter,
160 UErrorCode& status) const;
161
173 virtual UnicodeString& format(int32_t number,
174 UnicodeString& appendTo,
175 FieldPosition& pos) const;
176
188 virtual UnicodeString& format(int32_t number,
189 UnicodeString& appendTo,
190 FieldPosition& pos,
191 UErrorCode &status) const;
192
207 virtual UnicodeString& format(int32_t number,
208 UnicodeString& appendTo,
209 FieldPositionIterator* posIter,
210 UErrorCode& status) const;
211
223 virtual UnicodeString& format(int64_t number,
224 UnicodeString& appendTo,
225 FieldPosition& pos) const;
226
238 virtual UnicodeString& format(int64_t number,
239 UnicodeString& appendTo,
240 FieldPosition& pos,
241 UErrorCode &status) const;
242
257 virtual UnicodeString& format(int64_t number,
258 UnicodeString& appendTo,
259 FieldPositionIterator* posIter,
260 UErrorCode& status) const;
261
278 virtual UnicodeString& format(StringPiece number,
279 UnicodeString& appendTo,
280 FieldPositionIterator* posIter,
281 UErrorCode& status) const;
282
298 virtual UnicodeString& format(const DigitList &number,
299 UnicodeString& appendTo,
300 FieldPositionIterator* posIter,
301 UErrorCode& status) const;
302
318 virtual UnicodeString& format(const DigitList &number,
319 UnicodeString& appendTo,
320 FieldPosition& pos,
321 UErrorCode& status) const;
322
332 virtual void parse(const UnicodeString& text,
333 Formattable& result,
334 ParsePosition& parsePosition) const;
335
345 virtual void parse(const UnicodeString& text,
346 Formattable& result,
347 UErrorCode& status) const;
348
369 virtual CurrencyAmount* parseCurrency(const UnicodeString& text,
370 ParsePosition& pos) const;
371
383 static UClassID U_EXPORT2 getStaticClassID();
384
396 virtual UClassID getDynamicClassID() const;
397
398 private:
399
400 const UHashtable* _unitsByVariant;
401 const double* _divisors;
402 PluralRules* _pluralRules;
403
404 // Default constructor not implemented.
405 CompactDecimalFormat(const DecimalFormat &, const UHashtable* unitsByVariant, const double* divisors, PluralRules* pluralRules);
406
407 UBool eqHelper(const CompactDecimalFormat& that) const;
408 };
409
410 U_NAMESPACE_END
411
412 #endif /* #if !UCONFIG_NO_FORMATTING */
413
414 #endif // __COMPACT_DECIMAL_FORMAT_H__
415 //eof
icu::Format
Base class for all formats.
Definition: format.h:96
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:669
UClassID
void * UClassID
UClassID is used to identify classes without using the compiler&#39;s RTTI.
Definition: uobject.h:93
icu::NumberFormat::createInstance
static NumberFormat * createInstance(UErrorCode &)
Create a default style NumberFormat for the current default locale.
icu::PluralRules
Defines rules for mapping non-negative numeric values onto a small set of keywords.
Definition: plurrule.h:197
icu::CompactDecimalFormat
The CompactDecimalFormat produces abbreviated numbers, suitable for display in environments will limi...
Definition: compactdecimalformat.h:54
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:360
U_NAMESPACE_BEGIN
#define U_NAMESPACE_BEGIN
This is used to begin a declaration of a public ICU C++ API.
Definition: uversion.h:131
icu::FieldPositionIterator
FieldPositionIterator returns the field ids and their start/limit positions generated by a call to Fo...
Definition: fpositer.h:62
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&#39;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:132
UNumberCompactStyle
UNumberCompactStyle
Constants for specifying short or long format.
Definition: unum.h:315
UErrorCode
UErrorCode
Error code to replace exception handling, so that the code is compatible with all C++ compilers...
Definition: utypes.h:396
icu::FieldPosition
FieldPosition is a simple class used by Format and its subclasses to identify fields in formatted out...
Definition: fieldpos.h:108
icu::ParsePosition
ParsePosition is a simple class used by Format and its subclasses to keep track of the current positi...
Definition: parsepos.h:49
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:286
icu::Formattable
Formattable objects can be passed to the Format class or its subclasses for formatting.
Definition: fmtable.h:68
icu::StringPiece
A string-like object that points to a sized piece of memory.
Definition: stringpiece.h:54
icu::CurrencyAmount
A currency together with a numeric amount, such as 200 USD.
Definition: curramt.h:37
UBool
int8_t UBool
The ICU boolean type.
Definition: umachine.h:236
icu::Locale
A Locale object represents a specific geographical, political, or cultural region.
Definition: locid.h:188