Linux server.kiran-academy.com 3.10.0-1160.108.1.el7.x86_64 #1 SMP Thu Jan 25 16:17:31 UTC 2024 x86_64
Apache/2.4.57 (Unix) OpenSSL/1.0.2k-fips
: 194.233.91.196 | : 216.73.216.172
Cant Read [ /etc/named.conf ]
7.4.32
finalho
www.github.com/MadExploits
Terminal
AUTO ROOT
Adminer
Backdoor Destroyer
Linux Exploit
Lock Shell
Lock File
Create User
CREATE RDP
PHP Mailer
BACKCONNECT
UNLOCK SHELL
HASH IDENTIFIER
CPANEL RESET
CREATE WP USER
README
+ Create Folder
+ Create File
/
usr /
include /
unicode /
[ HOME SHELL ]
Name
Size
Permission
Action
alphaindex.h
25.29
KB
-rw-r--r--
appendable.h
8.38
KB
-rw-r--r--
basictz.h
8.77
KB
-rw-r--r--
bms.h
8.68
KB
-rw-r--r--
bmsearch.h
7.33
KB
-rw-r--r--
brkiter.h
24.24
KB
-rw-r--r--
bytestream.h
9.16
KB
-rw-r--r--
bytestrie.h
19.19
KB
-rw-r--r--
bytestriebuilder.h
6.73
KB
-rw-r--r--
calendar.h
102.76
KB
-rw-r--r--
caniter.h
7.23
KB
-rw-r--r--
chariter.h
23.71
KB
-rw-r--r--
choicfmt.h
27.82
KB
-rw-r--r--
coleitr.h
12.69
KB
-rw-r--r--
coll.h
53.44
KB
-rw-r--r--
colldata.h
12.42
KB
-rw-r--r--
curramt.h
3.57
KB
-rw-r--r--
currpinf.h
6.93
KB
-rw-r--r--
currunit.h
2.99
KB
-rw-r--r--
datefmt.h
33.67
KB
-rw-r--r--
dbbi.h
966
B
-rw-r--r--
dcfmtsym.h
14.91
KB
-rw-r--r--
decimfmt.h
97.38
KB
-rw-r--r--
docmain.h
6.28
KB
-rw-r--r--
dtfmtsym.h
30.27
KB
-rw-r--r--
dtintrv.h
3.65
KB
-rw-r--r--
dtitvfmt.h
39.24
KB
-rw-r--r--
dtitvinf.h
18.56
KB
-rw-r--r--
dtptngen.h
19.54
KB
-rw-r--r--
dtrule.h
8.51
KB
-rw-r--r--
enumset.h
1.8
KB
-rw-r--r--
errorcode.h
4.67
KB
-rw-r--r--
fieldpos.h
8.51
KB
-rw-r--r--
fmtable.h
22.09
KB
-rw-r--r--
format.h
12.33
KB
-rw-r--r--
fpositer.h
2.97
KB
-rw-r--r--
gender.h
3.02
KB
-rw-r--r--
gregocal.h
33.28
KB
-rw-r--r--
icudataver.h
990
B
-rw-r--r--
icuplug.h
11.49
KB
-rw-r--r--
idna.h
12.68
KB
-rw-r--r--
listformatter.h
3.97
KB
-rw-r--r--
localpointer.h
9.13
KB
-rw-r--r--
locdspnm.h
7.14
KB
-rw-r--r--
locid.h
30.48
KB
-rw-r--r--
measfmt.h
1.94
KB
-rw-r--r--
measunit.h
1.6
KB
-rw-r--r--
measure.h
3.24
KB
-rw-r--r--
messagepattern.h
33.6
KB
-rw-r--r--
msgfmt.h
43.59
KB
-rw-r--r--
normalizer2.h
28.34
KB
-rw-r--r--
normlzr.h
29.26
KB
-rw-r--r--
numfmt.h
43.59
KB
-rw-r--r--
numsys.h
5.37
KB
-rw-r--r--
parseerr.h
2.97
KB
-rw-r--r--
parsepos.h
5.34
KB
-rw-r--r--
platform.h
24.23
KB
-rw-r--r--
plurfmt.h
24.58
KB
-rw-r--r--
plurrule.h
14.56
KB
-rw-r--r--
ptypes.h
3.36
KB
-rw-r--r--
putil.h
5.61
KB
-rw-r--r--
rbbi.h
29.15
KB
-rw-r--r--
rbnf.h
45.32
KB
-rw-r--r--
rbtz.h
15.33
KB
-rw-r--r--
regex.h
83.1
KB
-rw-r--r--
rep.h
9.33
KB
-rw-r--r--
resbund.h
17.89
KB
-rw-r--r--
schriter.h
6.15
KB
-rw-r--r--
search.h
22.1
KB
-rw-r--r--
selfmt.h
14.13
KB
-rw-r--r--
simpletz.h
45.1
KB
-rw-r--r--
smpdtfmt.h
57.58
KB
-rw-r--r--
sortkey.h
10.98
KB
-rw-r--r--
std_string.h
783
B
-rw-r--r--
strenum.h
9.92
KB
-rw-r--r--
stringpiece.h
6.38
KB
-rw-r--r--
stringtriebuilder.h
14.75
KB
-rw-r--r--
stsearch.h
21.76
KB
-rw-r--r--
symtable.h
4.1
KB
-rw-r--r--
tblcoll.h
34.23
KB
-rw-r--r--
timezone.h
37.28
KB
-rw-r--r--
tmunit.h
3.39
KB
-rw-r--r--
tmutamt.h
4.69
KB
-rw-r--r--
tmutfmt.h
8.51
KB
-rw-r--r--
translit.h
53.76
KB
-rw-r--r--
tzfmt.h
32.06
KB
-rw-r--r--
tznames.h
14.83
KB
-rw-r--r--
tzrule.h
35.21
KB
-rw-r--r--
tztrans.h
5.96
KB
-rw-r--r--
ubidi.h
88.57
KB
-rw-r--r--
ubrk.h
19.13
KB
-rw-r--r--
ucal.h
50.49
KB
-rw-r--r--
ucasemap.h
16.45
KB
-rw-r--r--
ucat.h
5.25
KB
-rw-r--r--
uchar.h
115.43
KB
-rw-r--r--
ucharstrie.h
20.8
KB
-rw-r--r--
ucharstriebuilder.h
6.83
KB
-rw-r--r--
uchriter.h
12.82
KB
-rw-r--r--
uclean.h
10.38
KB
-rw-r--r--
ucnv.h
82.6
KB
-rw-r--r--
ucnv_cb.h
6.48
KB
-rw-r--r--
ucnv_err.h
20.87
KB
-rw-r--r--
ucnvsel.h
6.03
KB
-rw-r--r--
ucol.h
57.93
KB
-rw-r--r--
ucoleitr.h
12.25
KB
-rw-r--r--
uconfig.h
10.79
KB
-rw-r--r--
ucsdet.h
12.6
KB
-rw-r--r--
ucurr.h
12.96
KB
-rw-r--r--
udat.h
46.47
KB
-rw-r--r--
udata.h
14.81
KB
-rw-r--r--
udateintervalformat.h
6.5
KB
-rw-r--r--
udatpg.h
23.24
KB
-rw-r--r--
udisplaycontext.h
4.34
KB
-rw-r--r--
uenum.h
7.79
KB
-rw-r--r--
ugender.h
1.85
KB
-rw-r--r--
uidna.h
32.81
KB
-rw-r--r--
uiter.h
22.67
KB
-rw-r--r--
uldnames.h
10.5
KB
-rw-r--r--
uloc.h
44.07
KB
-rw-r--r--
ulocdata.h
10.37
KB
-rw-r--r--
umachine.h
10.23
KB
-rw-r--r--
umisc.h
1.23
KB
-rw-r--r--
umsg.h
24.12
KB
-rw-r--r--
unifilt.h
3.52
KB
-rw-r--r--
unifunct.h
3.87
KB
-rw-r--r--
unimatch.h
5.93
KB
-rw-r--r--
unirepl.h
3.21
KB
-rw-r--r--
uniset.h
63.07
KB
-rw-r--r--
unistr.h
164.33
KB
-rw-r--r--
unorm.h
22.89
KB
-rw-r--r--
unorm2.h
21.91
KB
-rw-r--r--
unum.h
39.21
KB
-rw-r--r--
uobject.h
12.21
KB
-rw-r--r--
upluralrules.h
4.47
KB
-rw-r--r--
uregex.h
71.47
KB
-rw-r--r--
urename.h
120.88
KB
-rw-r--r--
urep.h
5.27
KB
-rw-r--r--
ures.h
35.92
KB
-rw-r--r--
uscript.h
20.46
KB
-rw-r--r--
usearch.h
36.09
KB
-rw-r--r--
uset.h
39.45
KB
-rw-r--r--
usetiter.h
9.38
KB
-rw-r--r--
ushape.h
17.89
KB
-rw-r--r--
uspoof.h
38.91
KB
-rw-r--r--
usprep.h
8.02
KB
-rw-r--r--
ustdio.h
37.05
KB
-rw-r--r--
ustream.h
1.6
KB
-rw-r--r--
ustring.h
73.01
KB
-rw-r--r--
ustringtrie.h
3.04
KB
-rw-r--r--
utext.h
57.97
KB
-rw-r--r--
utf.h
7.64
KB
-rw-r--r--
utf16.h
18.24
KB
-rw-r--r--
utf32.h
653
B
-rw-r--r--
utf8.h
23.02
KB
-rw-r--r--
utf_old.h
42.5
KB
-rw-r--r--
utmscale.h
13.37
KB
-rw-r--r--
utrace.h
13.09
KB
-rw-r--r--
utrans.h
23.08
KB
-rw-r--r--
utypes.h
30.72
KB
-rw-r--r--
uvernum.h
5.53
KB
-rw-r--r--
uversion.h
6.29
KB
-rw-r--r--
vtzone.h
20.09
KB
-rw-r--r--
Delete
Unzip
Zip
${this.title}
Close
Code Editor : numfmt.h
/* ******************************************************************************** * Copyright (C) 1997-2012, International Business Machines Corporation and others. * All Rights Reserved. ******************************************************************************** * * File NUMFMT.H * * Modification History: * * Date Name Description * 02/19/97 aliu Converted from java. * 03/18/97 clhuang Updated per C++ implementation. * 04/17/97 aliu Changed DigitCount to int per code review. * 07/20/98 stephen JDK 1.2 sync up. Added scientific support. * Changed naming conventions to match C++ guidelines * Derecated Java style constants (eg, INTEGER_FIELD) ******************************************************************************** */ #ifndef NUMFMT_H #define NUMFMT_H #include "unicode/utypes.h" /** * \file * \brief C++ API: Abstract base class for all number formats. */ #if !UCONFIG_NO_FORMATTING #include "unicode/unistr.h" #include "unicode/format.h" #include "unicode/unum.h" // UNumberFormatStyle #include "unicode/locid.h" #include "unicode/stringpiece.h" #include "unicode/curramt.h" class NumberFormatTest; U_NAMESPACE_BEGIN #if !UCONFIG_NO_SERVICE class NumberFormatFactory; class StringEnumeration; #endif /** * * Abstract base class for all number formats. Provides interface for * formatting and parsing a number. Also provides methods for * determining which locales have number formats, and what their names * are. * <P> * NumberFormat helps you to format and parse numbers for any locale. * Your code can be completely independent of the locale conventions * for decimal points, thousands-separators, or even the particular * decimal digits used, or whether the number format is even decimal. * <P> * To format a number for the current Locale, use one of the static * factory methods: * <pre> * \code * double myNumber = 7.0; * UnicodeString myString; * UErrorCode success = U_ZERO_ERROR; * NumberFormat* nf = NumberFormat::createInstance(success) * nf->format(myNumber, myString); * cout << " Example 1: " << myString << endl; * \endcode * </pre> * If you are formatting multiple numbers, it is more efficient to get * the format and use it multiple times so that the system doesn't * have to fetch the information about the local language and country * conventions multiple times. * <pre> * \code * UnicodeString myString; * UErrorCode success = U_ZERO_ERROR; * nf = NumberFormat::createInstance( success ); * int32_t a[] = { 123, 3333, -1234567 }; * const int32_t a_len = sizeof(a) / sizeof(a[0]); * myString.remove(); * for (int32_t i = 0; i < a_len; i++) { * nf->format(a[i], myString); * myString += " ; "; * } * cout << " Example 2: " << myString << endl; * \endcode * </pre> * To format a number for a different Locale, specify it in the * call to createInstance(). * <pre> * \code * nf = NumberFormat::createInstance( Locale::FRENCH, success ); * \endcode * </pre> * You can use a NumberFormat to parse also. * <pre> * \code * UErrorCode success; * Formattable result(-999); // initialized with error code * nf->parse(myString, result, success); * \endcode * </pre> * Use createInstance to get the normal number format for that country. * There are other static factory methods available. Use getCurrency * to get the currency number format for that country. Use getPercent * to get a format for displaying percentages. With this format, a * fraction from 0.53 is displayed as 53%. * <P> * Starting from ICU 4.2, you can use createInstance() by passing in a 'style' * as parameter to get the correct instance. * For example, * use createInstance(...kNumberStyle...) to get the normal number format, * createInstance(...kPercentStyle...) to get a format for displaying * percentage, * createInstance(...kScientificStyle...) to get a format for displaying * scientific number, * createInstance(...kCurrencyStyle...) to get the currency number format, * in which the currency is represented by its symbol, for example, "$3.00". * createInstance(...kIsoCurrencyStyle...) to get the currency number format, * in which the currency is represented by its ISO code, for example "USD3.00". * createInstance(...kPluralCurrencyStyle...) to get the currency number format, * in which the currency is represented by its full name in plural format, * for example, "3.00 US dollars" or "1.00 US dollar". * <P> * You can also control the display of numbers with such methods as * getMinimumFractionDigits. If you want even more control over the * format or parsing, or want to give your users more control, you can * try casting the NumberFormat you get from the factory methods to a * DecimalNumberFormat. This will work for the vast majority of * countries; just remember to put it in a try block in case you * encounter an unusual one. * <P> * You can also use forms of the parse and format methods with * ParsePosition and FieldPosition to allow you to: * <ul type=round> * <li>(a) progressively parse through pieces of a string. * <li>(b) align the decimal point and other areas. * </ul> * For example, you can align numbers in two ways. * <P> * If you are using a monospaced font with spacing for alignment, you * can pass the FieldPosition in your format call, with field = * INTEGER_FIELD. On output, getEndIndex will be set to the offset * between the last character of the integer and the decimal. Add * (desiredSpaceCount - getEndIndex) spaces at the front of the * string. * <P> * If you are using proportional fonts, instead of padding with * spaces, measure the width of the string in pixels from the start to * getEndIndex. Then move the pen by (desiredPixelWidth - * widthToAlignmentPoint) before drawing the text. It also works * where there is no decimal, but possibly additional characters at * the end, e.g. with parentheses in negative numbers: "(12)" for -12. * <p> * <em>User subclasses are not supported.</em> While clients may write * subclasses, such code will not necessarily work and will not be * guaranteed to work stably from release to release. * * @stable ICU 2.0 */ class U_I18N_API NumberFormat : public Format { public: /** * Alignment Field constants used to construct a FieldPosition object. * Signifies that the position of the integer part or fraction part of * a formatted number should be returned. * * Note: as of ICU 4.4, the values in this enum have been extended to * support identification of all number format fields, not just those * pertaining to alignment. * * These constants are provided for backwards compatibility only. * Please use the C style constants defined in the header file unum.h. * * @see FieldPosition * @stable ICU 2.0 */ enum EAlignmentFields { /** @stable ICU 2.0 */ kIntegerField = UNUM_INTEGER_FIELD, /** @stable ICU 2.0 */ kFractionField = UNUM_FRACTION_FIELD, /** @stable ICU 2.0 */ kDecimalSeparatorField = UNUM_DECIMAL_SEPARATOR_FIELD, /** @stable ICU 2.0 */ kExponentSymbolField = UNUM_EXPONENT_SYMBOL_FIELD, /** @stable ICU 2.0 */ kExponentSignField = UNUM_EXPONENT_SIGN_FIELD, /** @stable ICU 2.0 */ kExponentField = UNUM_EXPONENT_FIELD, /** @stable ICU 2.0 */ kGroupingSeparatorField = UNUM_GROUPING_SEPARATOR_FIELD, /** @stable ICU 2.0 */ kCurrencyField = UNUM_CURRENCY_FIELD, /** @stable ICU 2.0 */ kPercentField = UNUM_PERCENT_FIELD, /** @stable ICU 2.0 */ kPermillField = UNUM_PERMILL_FIELD, /** @stable ICU 2.0 */ kSignField = UNUM_SIGN_FIELD, /** * These constants are provided for backwards compatibility only. * Please use the constants defined in the header file unum.h. */ /** @stable ICU 2.0 */ INTEGER_FIELD = UNUM_INTEGER_FIELD, /** @stable ICU 2.0 */ FRACTION_FIELD = UNUM_FRACTION_FIELD }; /** * Destructor. * @stable ICU 2.0 */ virtual ~NumberFormat(); /** * Return true if the given Format objects are semantically equal. * Objects of different subclasses are considered unequal. * @return true if the given Format objects are semantically equal. * @stable ICU 2.0 */ virtual UBool operator==(const Format& other) const; using Format::format; /** * Format an object to produce a string. This method handles * Formattable objects with numeric types. If the Formattable * object type is not a numeric type, then it returns a failing * UErrorCode. * * @param obj The object to format. * @param appendTo Output parameter to receive result. * Result is appended to existing contents. * @param pos On input: an alignment field, if desired. * On output: the offsets of the alignment field. * @param status Output param filled with success/failure status. * @return Reference to 'appendTo' parameter. * @stable ICU 2.0 */ virtual UnicodeString& format(const Formattable& obj, UnicodeString& appendTo, FieldPosition& pos, UErrorCode& status) const; /** * Format an object to produce a string. This method handles * Formattable objects with numeric types. If the Formattable * object type is not a numeric type, then it returns a failing * UErrorCode. * * @param obj The object to format. * @param appendTo Output parameter to receive result. * Result is appended to existing contents. * @param posIter On return, can be used to iterate over positions * of fields generated by this format call. Can be * NULL. * @param status Output param filled with success/failure status. * @return Reference to 'appendTo' parameter. * @stable 4.4 */ virtual UnicodeString& format(const Formattable& obj, UnicodeString& appendTo, FieldPositionIterator* posIter, UErrorCode& status) const; /** * Parse a string to produce an object. This methods handles * parsing of numeric strings into Formattable objects with numeric * types. * <P> * Before calling, set parse_pos.index to the offset you want to * start parsing at in the source. After calling, parse_pos.index * indicates the position after the successfully parsed text. If * an error occurs, parse_pos.index is unchanged. * <P> * When parsing, leading whitespace is discarded (with successful * parse), while trailing whitespace is left as is. * <P> * See Format::parseObject() for more. * * @param source The string to be parsed into an object. * @param result Formattable to be set to the parse result. * If parse fails, return contents are undefined. * @param parse_pos The position to start parsing at. Upon return * this param is set to the position after the * last character successfully parsed. If the * source is not parsed successfully, this param * will remain unchanged. * @return A newly created Formattable* object, or NULL * on failure. The caller owns this and should * delete it when done. * @stable ICU 2.0 */ virtual void parseObject(const UnicodeString& source, Formattable& result, ParsePosition& parse_pos) const; /** * Format a double number. These methods call the NumberFormat * pure virtual format() methods with the default FieldPosition. * * @param number The value to be formatted. * @param appendTo Output parameter to receive result. * Result is appended to existing contents. * @return Reference to 'appendTo' parameter. * @stable ICU 2.0 */ UnicodeString& format( double number, UnicodeString& appendTo) const; /** * Format a long number. These methods call the NumberFormat * pure virtual format() methods with the default FieldPosition. * * @param number The value to be formatted. * @param appendTo Output parameter to receive result. * Result is appended to existing contents. * @return Reference to 'appendTo' parameter. * @stable ICU 2.0 */ UnicodeString& format( int32_t number, UnicodeString& appendTo) const; /** * Format an int64 number. These methods call the NumberFormat * pure virtual format() methods with the default FieldPosition. * * @param number The value to be formatted. * @param appendTo Output parameter to receive result. * Result is appended to existing contents. * @return Reference to 'appendTo' parameter. * @stable ICU 2.8 */ UnicodeString& format( int64_t number, UnicodeString& appendTo) const; /** * Format a double number. Concrete subclasses must implement * these pure virtual methods. * * @param number The value to be formatted. * @param appendTo Output parameter to receive result. * Result is appended to existing contents. * @param pos On input: an alignment field, if desired. * On output: the offsets of the alignment field. * @return Reference to 'appendTo' parameter. * @stable ICU 2.0 */ virtual UnicodeString& format(double number, UnicodeString& appendTo, FieldPosition& pos) const = 0; /** * Format a double number. By default, the parent function simply * calls the base class and does not return an error status. * Therefore, the status may be ignored in some subclasses. * * @param number The value to be formatted. * @param appendTo Output parameter to receive result. * Result is appended to existing contents. * @param pos On input: an alignment field, if desired. * On output: the offsets of the alignment field. * @param status error status * @return Reference to 'appendTo' parameter. * @internal */ virtual UnicodeString& format(double number, UnicodeString& appendTo, FieldPosition& pos, UErrorCode &status) const; /** * Format a double number. Subclasses must implement * this method. * * @param number The value to be formatted. * @param appendTo Output parameter to receive result. * Result is appended to existing contents. * @param posIter On return, can be used to iterate over positions * of fields generated by this format call. * Can be NULL. * @param status Output param filled with success/failure status. * @return Reference to 'appendTo' parameter. * @stable 4.4 */ virtual UnicodeString& format(double number, UnicodeString& appendTo, FieldPositionIterator* posIter, UErrorCode& status) const; /** * Format a long number. Concrete subclasses must implement * these pure virtual methods. * * @param number The value to be formatted. * @param appendTo Output parameter to receive result. * Result is appended to existing contents. * @param pos On input: an alignment field, if desired. * On output: the offsets of the alignment field. * @return Reference to 'appendTo' parameter. * @stable ICU 2.0 */ virtual UnicodeString& format(int32_t number, UnicodeString& appendTo, FieldPosition& pos) const = 0; /** * Format a long number. Concrete subclasses may override * this function to provide status return. * * @param number The value to be formatted. * @param appendTo Output parameter to receive result. * Result is appended to existing contents. * @param pos On input: an alignment field, if desired. * On output: the offsets of the alignment field. * @param status the output status. * @return Reference to 'appendTo' parameter. * @internal */ virtual UnicodeString& format(int32_t number, UnicodeString& appendTo, FieldPosition& pos, UErrorCode &status) const; /** * Format an int32 number. Subclasses must implement * this method. * * @param number The value to be formatted. * @param appendTo Output parameter to receive result. * Result is appended to existing contents. * @param posIter On return, can be used to iterate over positions * of fields generated by this format call. * Can be NULL. * @param status Output param filled with success/failure status. * @return Reference to 'appendTo' parameter. * @stable 4.4 */ virtual UnicodeString& format(int32_t number, UnicodeString& appendTo, FieldPositionIterator* posIter, UErrorCode& status) const; /** * Format an int64 number. (Not abstract to retain compatibility * with earlier releases, however subclasses should override this * method as it just delegates to format(int32_t number...); * * @param number The value to be formatted. * @param appendTo Output parameter to receive result. * Result is appended to existing contents. * @param pos On input: an alignment field, if desired. * On output: the offsets of the alignment field. * @return Reference to 'appendTo' parameter. * @stable ICU 2.8 */ virtual UnicodeString& format(int64_t number, UnicodeString& appendTo, FieldPosition& pos) const; /** * Format an int64 number. (Not abstract to retain compatibility * with earlier releases, however subclasses should override this * method as it just delegates to format(int32_t number...); * * @param number The value to be formatted. * @param appendTo Output parameter to receive result. * Result is appended to existing contents. * @param pos On input: an alignment field, if desired. * On output: the offsets of the alignment field. * @return Reference to 'appendTo' parameter. * @internal */ virtual UnicodeString& format(int64_t number, UnicodeString& appendTo, FieldPosition& pos, UErrorCode& status) const; /** * Format an int64 number. Subclasses must implement * this method. * * @param number The value to be formatted. * @param appendTo Output parameter to receive result. * Result is appended to existing contents. * @param posIter On return, can be used to iterate over positions * of fields generated by this format call. * Can be NULL. * @param status Output param filled with success/failure status. * @return Reference to 'appendTo' parameter. * @stable 4.4 */ virtual UnicodeString& format(int64_t number, UnicodeString& appendTo, FieldPositionIterator* posIter, UErrorCode& status) const; /** * Format a decimal number. Subclasses must implement * this method. The syntax of the unformatted number is a "numeric string" * as defined in the Decimal Arithmetic Specification, available at * http://speleotrove.com/decimal * * @param number The unformatted number, as a string, to be formatted. * @param appendTo Output parameter to receive result. * Result is appended to existing contents. * @param posIter On return, can be used to iterate over positions * of fields generated by this format call. * Can be NULL. * @param status Output param filled with success/failure status. * @return Reference to 'appendTo' parameter. * @stable 4.4 */ virtual UnicodeString& format(const StringPiece &number, UnicodeString& appendTo, FieldPositionIterator* posIter, UErrorCode& status) const; public: /** * Format a decimal number. * The number is a DigitList wrapper onto a floating point decimal number. * The default implementation in NumberFormat converts the decimal number * to a double and formats that. Subclasses of NumberFormat that want * to specifically handle big decimal numbers must override this method. * class DecimalFormat does so. * * @param number The number, a DigitList format Decimal Floating Point. * @param appendTo Output parameter to receive result. * Result is appended to existing contents. * @param posIter On return, can be used to iterate over positions * of fields generated by this format call. * @param status Output param filled with success/failure status. * @return Reference to 'appendTo' parameter. * @internal */ virtual UnicodeString& format(const DigitList &number, UnicodeString& appendTo, FieldPositionIterator* posIter, UErrorCode& status) const; /** * Format a decimal number. * The number is a DigitList wrapper onto a floating point decimal number. * The default implementation in NumberFormat converts the decimal number * to a double and formats that. Subclasses of NumberFormat that want * to specifically handle big decimal numbers must override this method. * class DecimalFormat does so. * * @param number The number, a DigitList format Decimal Floating Point. * @param appendTo Output parameter to receive result. * Result is appended to existing contents. * @param pos On input: an alignment field, if desired. * On output: the offsets of the alignment field. * @param status Output param filled with success/failure status. * @return Reference to 'appendTo' parameter. * @internal */ virtual UnicodeString& format(const DigitList &number, UnicodeString& appendTo, FieldPosition& pos, UErrorCode& status) const; public: /** * Redeclared Format method. * @param obj The object to be formatted. * @param appendTo Output parameter to receive result. * Result is appended to existing contents. * @param status Output parameter set to a failure error code * when a failure occurs. * @return Reference to 'appendTo' parameter. * @stable ICU 2.0 */ UnicodeString& format(const Formattable& obj, UnicodeString& appendTo, UErrorCode& status) const; /** * Return a long if possible (e.g. within range LONG_MAX, * LONG_MAX], and with no decimals), otherwise a double. If * IntegerOnly is set, will stop at a decimal point (or equivalent; * e.g. for rational numbers "1 2/3", will stop after the 1). * <P> * If no object can be parsed, index is unchanged, and NULL is * returned. * <P> * This is a pure virtual which concrete subclasses must implement. * * @param text The text to be parsed. * @param result Formattable to be set to the parse result. * If parse fails, return contents are undefined. * @param parsePosition The position to start parsing at on input. * On output, moved to after the last successfully * parse character. On parse failure, does not change. * @stable ICU 2.0 */ virtual void parse(const UnicodeString& text, Formattable& result, ParsePosition& parsePosition) const = 0; /** * Parse a string as a numeric value, and return a Formattable * numeric object. This method parses integers only if IntegerOnly * is set. * * @param text The text to be parsed. * @param result Formattable to be set to the parse result. * If parse fails, return contents are undefined. * @param status Output parameter set to a failure error code * when a failure occurs. * @see NumberFormat::isParseIntegerOnly * @stable ICU 2.0 */ virtual void parse(const UnicodeString& text, Formattable& result, UErrorCode& status) const; /* Cannot use #ifndef U_HIDE_DRAFT_API for the following draft method since it is virtual */ /** * Parses text from the given string as a currency amount. Unlike * the parse() method, this method will attempt to parse a generic * currency name, searching for a match of this object's locale's * currency display names, or for a 3-letter ISO currency code. * This method will fail if this format is not a currency format, * that is, if it does not contain the currency pattern symbol * (U+00A4) in its prefix or suffix. * * @param text the string to parse * @param pos input-output position; on input, the position within text * to match; must have 0 <= pos.getIndex() < text.length(); * on output, the position after the last matched character. * If the parse fails, the position in unchanged upon output. * @return if parse succeeds, a pointer to a newly-created CurrencyAmount * object (owned by the caller) containing information about * the parsed currency; if parse fails, this is NULL. * @draft ICU 49 */ virtual CurrencyAmount* parseCurrency(const UnicodeString& text, ParsePosition& pos) const; /** * Return true if this format will parse numbers as integers * only. For example in the English locale, with ParseIntegerOnly * true, the string "1234." would be parsed as the integer value * 1234 and parsing would stop at the "." character. Of course, * the exact format accepted by the parse operation is locale * dependant and determined by sub-classes of NumberFormat. * @return true if this format will parse numbers as integers * only. * @stable ICU 2.0 */ UBool isParseIntegerOnly(void) const; /** * Sets whether or not numbers should be parsed as integers only. * @param value set True, this format will parse numbers as integers * only. * @see isParseIntegerOnly * @stable ICU 2.0 */ virtual void setParseIntegerOnly(UBool value); /** * Sets whether lenient parsing should be enabled (it is off by default). * * @param enable <code>TRUE</code> if lenient parsing should be used, * <code>FALSE</code> otherwise. * @stable ICU 4.8 */ virtual void setLenient(UBool enable); /** * Returns whether lenient parsing is enabled (it is off by default). * * @return <code>TRUE</code> if lenient parsing is enabled, * <code>FALSE</code> otherwise. * @see #setLenient * @stable ICU 4.8 */ virtual UBool isLenient(void) const; /** * Returns the default number format for the current default * locale. The default format is one of the styles provided by * the other factory methods: getNumberInstance, * getCurrencyInstance or getPercentInstance. Exactly which one * is locale dependant. * @stable ICU 2.0 */ static NumberFormat* U_EXPORT2 createInstance(UErrorCode&); /** * Returns the default number format for the specified locale. * The default format is one of the styles provided by the other * factory methods: getNumberInstance, getCurrencyInstance or * getPercentInstance. Exactly which one is locale dependant. * @param inLocale the given locale. * @stable ICU 2.0 */ static NumberFormat* U_EXPORT2 createInstance(const Locale& inLocale, UErrorCode&); /** * Creates the specified decimal format style of the desired locale. * @param desiredLocale the given locale. * @param style the given style. * @param errorCode Output param filled with success/failure status. * @return A new NumberFormat instance. * @stable ICU 4.8 */ static NumberFormat* U_EXPORT2 createInstance(const Locale& desiredLocale, UNumberFormatStyle style, UErrorCode& errorCode); /** * Returns a currency format for the current default locale. * @stable ICU 2.0 */ static NumberFormat* U_EXPORT2 createCurrencyInstance(UErrorCode&); /** * Returns a currency format for the specified locale. * @param inLocale the given locale. * @stable ICU 2.0 */ static NumberFormat* U_EXPORT2 createCurrencyInstance(const Locale& inLocale, UErrorCode&); /** * Returns a percentage format for the current default locale. * @stable ICU 2.0 */ static NumberFormat* U_EXPORT2 createPercentInstance(UErrorCode&); /** * Returns a percentage format for the specified locale. * @param inLocale the given locale. * @stable ICU 2.0 */ static NumberFormat* U_EXPORT2 createPercentInstance(const Locale& inLocale, UErrorCode&); /** * Returns a scientific format for the current default locale. * @stable ICU 2.0 */ static NumberFormat* U_EXPORT2 createScientificInstance(UErrorCode&); /** * Returns a scientific format for the specified locale. * @param inLocale the given locale. * @stable ICU 2.0 */ static NumberFormat* U_EXPORT2 createScientificInstance(const Locale& inLocale, UErrorCode&); /** * Get the set of Locales for which NumberFormats are installed. * @param count Output param to receive the size of the locales * @stable ICU 2.0 */ static const Locale* U_EXPORT2 getAvailableLocales(int32_t& count); #if !UCONFIG_NO_SERVICE /** * Register a new NumberFormatFactory. The factory will be adopted. * @param toAdopt the NumberFormatFactory instance to be adopted * @param status the in/out status code, no special meanings are assigned * @return a registry key that can be used to unregister this factory * @stable ICU 2.6 */ static URegistryKey U_EXPORT2 registerFactory(NumberFormatFactory* toAdopt, UErrorCode& status); /** * Unregister a previously-registered NumberFormatFactory using the key returned from the * register call. Key becomes invalid after a successful call and should not be used again. * The NumberFormatFactory corresponding to the key will be deleted. * @param key the registry key returned by a previous call to registerFactory * @param status the in/out status code, no special meanings are assigned * @return TRUE if the factory for the key was successfully unregistered * @stable ICU 2.6 */ static UBool U_EXPORT2 unregister(URegistryKey key, UErrorCode& status); /** * Return a StringEnumeration over the locales available at the time of the call, * including registered locales. * @return a StringEnumeration over the locales available at the time of the call * @stable ICU 2.6 */ static StringEnumeration* U_EXPORT2 getAvailableLocales(void); #endif /* UCONFIG_NO_SERVICE */ /** * Returns true if grouping is used in this format. For example, * in the English locale, with grouping on, the number 1234567 * might be formatted as "1,234,567". The grouping separator as * well as the size of each group is locale dependant and is * determined by sub-classes of NumberFormat. * @see setGroupingUsed * @stable ICU 2.0 */ UBool isGroupingUsed(void) const; /** * Set whether or not grouping will be used in this format. * @param newValue True, grouping will be used in this format. * @see getGroupingUsed * @stable ICU 2.0 */ virtual void setGroupingUsed(UBool newValue); /** * Returns the maximum number of digits allowed in the integer portion of a * number. * @return the maximum number of digits allowed in the integer portion of a * number. * @see setMaximumIntegerDigits * @stable ICU 2.0 */ int32_t getMaximumIntegerDigits(void) const; /** * Sets the maximum number of digits allowed in the integer portion of a * number. maximumIntegerDigits must be >= minimumIntegerDigits. If the * new value for maximumIntegerDigits is less than the current value * of minimumIntegerDigits, then minimumIntegerDigits will also be set to * the new value. * * @param newValue the new value for the maximum number of digits * allowed in the integer portion of a number. * @see getMaximumIntegerDigits * @stable ICU 2.0 */ virtual void setMaximumIntegerDigits(int32_t newValue); /** * Returns the minimum number of digits allowed in the integer portion of a * number. * @return the minimum number of digits allowed in the integer portion of a * number. * @see setMinimumIntegerDigits * @stable ICU 2.0 */ int32_t getMinimumIntegerDigits(void) const; /** * Sets the minimum number of digits allowed in the integer portion of a * number. minimumIntegerDigits must be <= maximumIntegerDigits. If the * new value for minimumIntegerDigits exceeds the current value * of maximumIntegerDigits, then maximumIntegerDigits will also be set to * the new value. * @param newValue the new value to be set. * @see getMinimumIntegerDigits * @stable ICU 2.0 */ virtual void setMinimumIntegerDigits(int32_t newValue); /** * Returns the maximum number of digits allowed in the fraction portion of a * number. * @return the maximum number of digits allowed in the fraction portion of a * number. * @see setMaximumFractionDigits * @stable ICU 2.0 */ int32_t getMaximumFractionDigits(void) const; /** * Sets the maximum number of digits allowed in the fraction portion of a * number. maximumFractionDigits must be >= minimumFractionDigits. If the * new value for maximumFractionDigits is less than the current value * of minimumFractionDigits, then minimumFractionDigits will also be set to * the new value. * @param newValue the new value to be set. * @see getMaximumFractionDigits * @stable ICU 2.0 */ virtual void setMaximumFractionDigits(int32_t newValue); /** * Returns the minimum number of digits allowed in the fraction portion of a * number. * @return the minimum number of digits allowed in the fraction portion of a * number. * @see setMinimumFractionDigits * @stable ICU 2.0 */ int32_t getMinimumFractionDigits(void) const; /** * Sets the minimum number of digits allowed in the fraction portion of a * number. minimumFractionDigits must be <= maximumFractionDigits. If the * new value for minimumFractionDigits exceeds the current value * of maximumFractionDigits, then maximumIntegerDigits will also be set to * the new value * @param newValue the new value to be set. * @see getMinimumFractionDigits * @stable ICU 2.0 */ virtual void setMinimumFractionDigits(int32_t newValue); /** * Sets the currency used to display currency * amounts. This takes effect immediately, if this format is a * currency format. If this format is not a currency format, then * the currency is used if and when this object becomes a * currency format. * @param theCurrency a 3-letter ISO code indicating new currency * to use. It need not be null-terminated. May be the empty * string or NULL to indicate no currency. * @param ec input-output error code * @stable ICU 3.0 */ virtual void setCurrency(const UChar* theCurrency, UErrorCode& ec); /** * Gets the currency used to display currency * amounts. This may be an empty string for some subclasses. * @return a 3-letter null-terminated ISO code indicating * the currency in use, or a pointer to the empty string. * @stable ICU 2.6 */ const UChar* getCurrency() const; public: /** * Return the class ID for this class. This is useful for * comparing to a return value from getDynamicClassID(). Note that, * because NumberFormat is an abstract base class, no fully constructed object * will have the class ID returned by NumberFormat::getStaticClassID(). * @return The class ID for all objects of this class. * @stable ICU 2.0 */ static UClassID U_EXPORT2 getStaticClassID(void); /** * Returns a unique class ID POLYMORPHICALLY. Pure virtual override. * This method is to implement a simple version of RTTI, since not all * C++ compilers support genuine RTTI. Polymorphic operator==() and * clone() methods call this method. * <P> * @return The class ID for this object. All objects of a * given class have the same class ID. Objects of * other classes have different class IDs. * @stable ICU 2.0 */ virtual UClassID getDynamicClassID(void) const = 0; protected: /** * Default constructor for subclass use only. * @stable ICU 2.0 */ NumberFormat(); /** * Copy constructor. * @stable ICU 2.0 */ NumberFormat(const NumberFormat&); /** * Assignment operator. * @stable ICU 2.0 */ NumberFormat& operator=(const NumberFormat&); /** * Returns the currency in effect for this formatter. Subclasses * should override this method as needed. Unlike getCurrency(), * this method should never return "". * @result output parameter for null-terminated result, which must * have a capacity of at least 4 * @internal */ virtual void getEffectiveCurrency(UChar* result, UErrorCode& ec) const; private: static UBool isStyleSupported(UNumberFormatStyle style); /** * Creates the specified decimal format style of the desired locale. * @param desiredLocale the given locale. * @param style the given style. * @param errorCode Output param filled with success/failure status. * @return A new NumberFormat instance. */ static NumberFormat* makeInstance(const Locale& desiredLocale, UNumberFormatStyle style, UErrorCode& errorCode); UBool fGroupingUsed; int32_t fMaxIntegerDigits; int32_t fMinIntegerDigits; int32_t fMaxFractionDigits; int32_t fMinFractionDigits; UBool fParseIntegerOnly; UBool fLenient; // TRUE => lenient parse is enabled // ISO currency code UChar fCurrency[4]; friend class ICUNumberFormatFactory; // access to makeInstance friend class ICUNumberFormatService; friend class ::NumberFormatTest; // access to isStyleSupported() }; #if !UCONFIG_NO_SERVICE /** * A NumberFormatFactory is used to register new number formats. The factory * should be able to create any of the predefined formats for each locale it * supports. When registered, the locales it supports extend or override the * locale already supported by ICU. * * @stable ICU 2.6 */ class U_I18N_API NumberFormatFactory : public UObject { public: /** * Destructor * @stable ICU 3.0 */ virtual ~NumberFormatFactory(); /** * Return true if this factory will be visible. Default is true. * If not visible, the locales supported by this factory will not * be listed by getAvailableLocales. * @stable ICU 2.6 */ virtual UBool visible(void) const = 0; /** * Return the locale names directly supported by this factory. The number of names * is returned in count; * @stable ICU 2.6 */ virtual const UnicodeString * getSupportedIDs(int32_t &count, UErrorCode& status) const = 0; /** * Return a number format of the appropriate type. If the locale * is not supported, return null. If the locale is supported, but * the type is not provided by this service, return null. Otherwise * return an appropriate instance of NumberFormat. * @stable ICU 2.6 */ virtual NumberFormat* createFormat(const Locale& loc, UNumberFormatStyle formatType) = 0; }; /** * A NumberFormatFactory that supports a single locale. It can be visible or invisible. * @stable ICU 2.6 */ class U_I18N_API SimpleNumberFormatFactory : public NumberFormatFactory { protected: /** * True if the locale supported by this factory is visible. * @stable ICU 2.6 */ const UBool _visible; /** * The locale supported by this factory, as a UnicodeString. * @stable ICU 2.6 */ UnicodeString _id; public: /** * @stable ICU 2.6 */ SimpleNumberFormatFactory(const Locale& locale, UBool visible = TRUE); /** * @stable ICU 3.0 */ virtual ~SimpleNumberFormatFactory(); /** * @stable ICU 2.6 */ virtual UBool visible(void) const; /** * @stable ICU 2.6 */ virtual const UnicodeString * getSupportedIDs(int32_t &count, UErrorCode& status) const; }; #endif /* #if !UCONFIG_NO_SERVICE */ // ------------------------------------- inline UBool NumberFormat::isParseIntegerOnly() const { return fParseIntegerOnly; } inline UBool NumberFormat::isLenient() const { return fLenient; } inline UnicodeString& NumberFormat::format(const Formattable& obj, UnicodeString& appendTo, UErrorCode& status) const { return Format::format(obj, appendTo, status); } U_NAMESPACE_END #endif /* #if !UCONFIG_NO_FORMATTING */ #endif // _NUMFMT //eof
Close