pango 2.2.4-x64-mingw32
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/README +33 -0
- data/Rakefile +65 -0
- data/ext/pango/depend +12 -0
- data/ext/pango/extconf.rb +90 -0
- data/ext/pango/pango.def +18 -0
- data/ext/pango/rbpango.c +318 -0
- data/ext/pango/rbpango.h +96 -0
- data/ext/pango/rbpangoanalysis.c +218 -0
- data/ext/pango/rbpangoattribute.c +499 -0
- data/ext/pango/rbpangoattriterator.c +141 -0
- data/ext/pango/rbpangoattrlist.c +101 -0
- data/ext/pango/rbpangocairo.c +122 -0
- data/ext/pango/rbpangocairocontext.c +131 -0
- data/ext/pango/rbpangocolor.c +120 -0
- data/ext/pango/rbpangocontext.c +309 -0
- data/ext/pango/rbpangoconversions.h +111 -0
- data/ext/pango/rbpangocoverage.c +106 -0
- data/ext/pango/rbpangoengine.c +73 -0
- data/ext/pango/rbpangofont.c +110 -0
- data/ext/pango/rbpangofontdescription.c +282 -0
- data/ext/pango/rbpangofontface.c +73 -0
- data/ext/pango/rbpangofontfamily.c +79 -0
- data/ext/pango/rbpangofontmap.c +102 -0
- data/ext/pango/rbpangofontmetrics.c +85 -0
- data/ext/pango/rbpangofontset.c +69 -0
- data/ext/pango/rbpangofontsetsimple.c +60 -0
- data/ext/pango/rbpangoglyphinfo.c +123 -0
- data/ext/pango/rbpangoglyphitem.c +125 -0
- data/ext/pango/rbpangoglyphstring.c +151 -0
- data/ext/pango/rbpangogravity.c +54 -0
- data/ext/pango/rbpangoitem.c +95 -0
- data/ext/pango/rbpangolanguage.c +86 -0
- data/ext/pango/rbpangolayout.c +572 -0
- data/ext/pango/rbpangolayoutiter.c +189 -0
- data/ext/pango/rbpangolayoutline.c +239 -0
- data/ext/pango/rbpangologattr.c +109 -0
- data/ext/pango/rbpangomatrix.c +143 -0
- data/ext/pango/rbpangoprivate.h +49 -0
- data/ext/pango/rbpangorectangle.c +170 -0
- data/ext/pango/rbpangorenderer.c +193 -0
- data/ext/pango/rbpangoscript.c +84 -0
- data/ext/pango/rbpangoscriptiter.c +92 -0
- data/ext/pango/rbpangotabarray.c +128 -0
- data/extconf.rb +49 -0
- data/lib/2.0/pango.so +0 -0
- data/lib/2.1/pango.so +0 -0
- data/lib/2.2/pango.so +0 -0
- data/lib/pango.rb +79 -0
- data/sample/attribute.rb +82 -0
- data/sample/break.rb +28 -0
- data/sample/gdk_layout.rb +27 -0
- data/sample/glyphstring.rb +61 -0
- data/sample/item.rb +37 -0
- data/sample/label.rb +23 -0
- data/sample/layout.rb +102 -0
- data/sample/pango_cairo.rb +66 -0
- data/sample/parse.rb +33 -0
- data/sample/sample.txt +10 -0
- data/sample/script.rb +23 -0
- data/test/pango-test-utils.rb +9 -0
- data/test/run-test.rb +28 -0
- data/test/test-analysis.rb +26 -0
- data/test/test-attribute.rb +19 -0
- data/test/test-color.rb +47 -0
- data/test/test-language.rb +7 -0
- data/test/test-layout.rb +34 -0
- data/test/test-log-attr.rb +26 -0
- data/test/test-matrix.rb +26 -0
- data/test/test-rectangle.rb +26 -0
- data/vendor/local/bin/derb.exe +0 -0
- data/vendor/local/bin/genbrk.exe +0 -0
- data/vendor/local/bin/genccode.exe +0 -0
- data/vendor/local/bin/gencfu.exe +0 -0
- data/vendor/local/bin/gencmn.exe +0 -0
- data/vendor/local/bin/gencnval.exe +0 -0
- data/vendor/local/bin/gendict.exe +0 -0
- data/vendor/local/bin/gennorm2.exe +0 -0
- data/vendor/local/bin/genrb.exe +0 -0
- data/vendor/local/bin/gensprep.exe +0 -0
- data/vendor/local/bin/hb-ot-shape-closure.exe +0 -0
- data/vendor/local/bin/hb-shape.exe +0 -0
- data/vendor/local/bin/hb-view.exe +0 -0
- data/vendor/local/bin/icu-config +820 -0
- data/vendor/local/bin/icuinfo.exe +0 -0
- data/vendor/local/bin/icupkg.exe +0 -0
- data/vendor/local/bin/libharfbuzz-0.dll +0 -0
- data/vendor/local/bin/libpango-1.0-0.dll +0 -0
- data/vendor/local/bin/libpangocairo-1.0-0.dll +0 -0
- data/vendor/local/bin/libpangoft2-1.0-0.dll +0 -0
- data/vendor/local/bin/libpangowin32-1.0-0.dll +0 -0
- data/vendor/local/bin/makeconv.exe +0 -0
- data/vendor/local/bin/pango-querymodules.exe +0 -0
- data/vendor/local/bin/pango-view.exe +0 -0
- data/vendor/local/bin/pkgdata.exe +0 -0
- data/vendor/local/bin/uconv.exe +0 -0
- data/vendor/local/etc/pango/pango.modules +19 -0
- data/vendor/local/include/harfbuzz/hb-blob.h +126 -0
- data/vendor/local/include/harfbuzz/hb-buffer.h +344 -0
- data/vendor/local/include/harfbuzz/hb-common.h +344 -0
- data/vendor/local/include/harfbuzz/hb-deprecated.h +51 -0
- data/vendor/local/include/harfbuzz/hb-face.h +117 -0
- data/vendor/local/include/harfbuzz/hb-font.h +507 -0
- data/vendor/local/include/harfbuzz/hb-ft.h +62 -0
- data/vendor/local/include/harfbuzz/hb-glib.h +52 -0
- data/vendor/local/include/harfbuzz/hb-icu.h +52 -0
- data/vendor/local/include/harfbuzz/hb-ot-font.h +41 -0
- data/vendor/local/include/harfbuzz/hb-ot-layout.h +302 -0
- data/vendor/local/include/harfbuzz/hb-ot-shape.h +53 -0
- data/vendor/local/include/harfbuzz/hb-ot-tag.h +59 -0
- data/vendor/local/include/harfbuzz/hb-ot.h +43 -0
- data/vendor/local/include/harfbuzz/hb-set.h +154 -0
- data/vendor/local/include/harfbuzz/hb-shape-plan.h +89 -0
- data/vendor/local/include/harfbuzz/hb-shape.h +81 -0
- data/vendor/local/include/harfbuzz/hb-unicode.h +445 -0
- data/vendor/local/include/harfbuzz/hb-version.h +66 -0
- data/vendor/local/include/harfbuzz/hb.h +47 -0
- data/vendor/local/include/layout/LEFontInstance.h +550 -0
- data/vendor/local/include/layout/LEGlyphFilter.h +45 -0
- data/vendor/local/include/layout/LEGlyphStorage.h +546 -0
- data/vendor/local/include/layout/LEInsertionList.h +177 -0
- data/vendor/local/include/layout/LELanguages.h +112 -0
- data/vendor/local/include/layout/LEScripts.h +263 -0
- data/vendor/local/include/layout/LESwaps.h +100 -0
- data/vendor/local/include/layout/LETableReference.h +418 -0
- data/vendor/local/include/layout/LETypes.h +728 -0
- data/vendor/local/include/layout/LayoutEngine.h +518 -0
- data/vendor/local/include/layout/ParagraphLayout.h +747 -0
- data/vendor/local/include/layout/RunArrays.h +676 -0
- data/vendor/local/include/layout/loengine.h +225 -0
- data/vendor/local/include/layout/playout.h +466 -0
- data/vendor/local/include/layout/plruns.h +441 -0
- data/vendor/local/include/pango-1.0/pango/pango-attributes.h +514 -0
- data/vendor/local/include/pango-1.0/pango/pango-bidi-type.h +136 -0
- data/vendor/local/include/pango-1.0/pango/pango-break.h +173 -0
- data/vendor/local/include/pango-1.0/pango/pango-context.h +112 -0
- data/vendor/local/include/pango-1.0/pango/pango-coverage.h +79 -0
- data/vendor/local/include/pango-1.0/pango/pango-engine.h +429 -0
- data/vendor/local/include/pango-1.0/pango/pango-enum-types.h +69 -0
- data/vendor/local/include/pango-1.0/pango/pango-features.h +12 -0
- data/vendor/local/include/pango-1.0/pango/pango-font.h +622 -0
- data/vendor/local/include/pango-1.0/pango/pango-fontmap.h +167 -0
- data/vendor/local/include/pango-1.0/pango/pango-fontset.h +169 -0
- data/vendor/local/include/pango-1.0/pango/pango-glyph-item.h +158 -0
- data/vendor/local/include/pango-1.0/pango/pango-glyph.h +197 -0
- data/vendor/local/include/pango-1.0/pango/pango-gravity.h +128 -0
- data/vendor/local/include/pango-1.0/pango/pango-item.h +109 -0
- data/vendor/local/include/pango-1.0/pango/pango-language.h +61 -0
- data/vendor/local/include/pango-1.0/pango/pango-layout.h +340 -0
- data/vendor/local/include/pango-1.0/pango/pango-matrix.h +117 -0
- data/vendor/local/include/pango-1.0/pango/pango-modules.h +71 -0
- data/vendor/local/include/pango-1.0/pango/pango-ot.h +391 -0
- data/vendor/local/include/pango-1.0/pango/pango-renderer.h +260 -0
- data/vendor/local/include/pango-1.0/pango/pango-script.h +260 -0
- data/vendor/local/include/pango-1.0/pango/pango-tabs.h +87 -0
- data/vendor/local/include/pango-1.0/pango/pango-types.h +200 -0
- data/vendor/local/include/pango-1.0/pango/pango-utils.h +189 -0
- data/vendor/local/include/pango-1.0/pango/pango.h +48 -0
- data/vendor/local/include/pango-1.0/pango/pangocairo.h +169 -0
- data/vendor/local/include/pango-1.0/pango/pangofc-decoder.h +110 -0
- data/vendor/local/include/pango-1.0/pango/pangofc-font.h +153 -0
- data/vendor/local/include/pango-1.0/pango/pangofc-fontmap.h +289 -0
- data/vendor/local/include/pango-1.0/pango/pangoft2.h +133 -0
- data/vendor/local/include/pango-1.0/pango/pangowin32.h +128 -0
- data/vendor/local/include/unicode/alphaindex.h +752 -0
- data/vendor/local/include/unicode/appendable.h +232 -0
- data/vendor/local/include/unicode/basictz.h +214 -0
- data/vendor/local/include/unicode/brkiter.h +655 -0
- data/vendor/local/include/unicode/bytestream.h +257 -0
- data/vendor/local/include/unicode/bytestrie.h +519 -0
- data/vendor/local/include/unicode/bytestriebuilder.h +181 -0
- data/vendor/local/include/unicode/calendar.h +2519 -0
- data/vendor/local/include/unicode/caniter.h +208 -0
- data/vendor/local/include/unicode/chariter.h +722 -0
- data/vendor/local/include/unicode/choicfmt.h +594 -0
- data/vendor/local/include/unicode/coleitr.h +404 -0
- data/vendor/local/include/unicode/coll.h +1267 -0
- data/vendor/local/include/unicode/compactdecimalformat.h +330 -0
- data/vendor/local/include/unicode/curramt.h +130 -0
- data/vendor/local/include/unicode/currpinf.h +258 -0
- data/vendor/local/include/unicode/currunit.h +110 -0
- data/vendor/local/include/unicode/datefmt.h +883 -0
- data/vendor/local/include/unicode/dbbi.h +40 -0
- data/vendor/local/include/unicode/dcfmtsym.h +482 -0
- data/vendor/local/include/unicode/decimfmt.h +2479 -0
- data/vendor/local/include/unicode/docmain.h +215 -0
- data/vendor/local/include/unicode/dtfmtsym.h +912 -0
- data/vendor/local/include/unicode/dtintrv.h +158 -0
- data/vendor/local/include/unicode/dtitvfmt.h +985 -0
- data/vendor/local/include/unicode/dtitvinf.h +514 -0
- data/vendor/local/include/unicode/dtptngen.h +498 -0
- data/vendor/local/include/unicode/dtrule.h +250 -0
- data/vendor/local/include/unicode/enumset.h +64 -0
- data/vendor/local/include/unicode/errorcode.h +137 -0
- data/vendor/local/include/unicode/fieldpos.h +291 -0
- data/vendor/local/include/unicode/filteredbrk.h +131 -0
- data/vendor/local/include/unicode/fmtable.h +760 -0
- data/vendor/local/include/unicode/format.h +305 -0
- data/vendor/local/include/unicode/fpositer.h +117 -0
- data/vendor/local/include/unicode/gender.h +111 -0
- data/vendor/local/include/unicode/gregocal.h +777 -0
- data/vendor/local/include/unicode/icudataver.h +41 -0
- data/vendor/local/include/unicode/icuplug.h +371 -0
- data/vendor/local/include/unicode/idna.h +323 -0
- data/vendor/local/include/unicode/listformatter.h +167 -0
- data/vendor/local/include/unicode/localpointer.h +304 -0
- data/vendor/local/include/unicode/locdspnm.h +204 -0
- data/vendor/local/include/unicode/locid.h +815 -0
- data/vendor/local/include/unicode/measfmt.h +389 -0
- data/vendor/local/include/unicode/measunit.h +1443 -0
- data/vendor/local/include/unicode/measure.h +159 -0
- data/vendor/local/include/unicode/messagepattern.h +943 -0
- data/vendor/local/include/unicode/msgfmt.h +1093 -0
- data/vendor/local/include/unicode/normalizer2.h +658 -0
- data/vendor/local/include/unicode/normlzr.h +797 -0
- data/vendor/local/include/unicode/numfmt.h +1187 -0
- data/vendor/local/include/unicode/numsys.h +208 -0
- data/vendor/local/include/unicode/parseerr.h +92 -0
- data/vendor/local/include/unicode/parsepos.h +230 -0
- data/vendor/local/include/unicode/platform.h +751 -0
- data/vendor/local/include/unicode/plurfmt.h +615 -0
- data/vendor/local/include/unicode/plurrule.h +501 -0
- data/vendor/local/include/unicode/ptypes.h +126 -0
- data/vendor/local/include/unicode/putil.h +181 -0
- data/vendor/local/include/unicode/rbbi.h +782 -0
- data/vendor/local/include/unicode/rbnf.h +1032 -0
- data/vendor/local/include/unicode/rbtz.h +362 -0
- data/vendor/local/include/unicode/regex.h +1857 -0
- data/vendor/local/include/unicode/region.h +228 -0
- data/vendor/local/include/unicode/reldatefmt.h +498 -0
- data/vendor/local/include/unicode/rep.h +261 -0
- data/vendor/local/include/unicode/resbund.h +490 -0
- data/vendor/local/include/unicode/schriter.h +187 -0
- data/vendor/local/include/unicode/scientificformathelper.h +139 -0
- data/vendor/local/include/unicode/search.h +575 -0
- data/vendor/local/include/unicode/selfmt.h +367 -0
- data/vendor/local/include/unicode/simpletz.h +928 -0
- data/vendor/local/include/unicode/smpdtfmt.h +1592 -0
- data/vendor/local/include/unicode/sortkey.h +338 -0
- data/vendor/local/include/unicode/std_string.h +37 -0
- data/vendor/local/include/unicode/strenum.h +276 -0
- data/vendor/local/include/unicode/stringpiece.h +224 -0
- data/vendor/local/include/unicode/stringtriebuilder.h +402 -0
- data/vendor/local/include/unicode/stsearch.h +504 -0
- data/vendor/local/include/unicode/symtable.h +112 -0
- data/vendor/local/include/unicode/tblcoll.h +873 -0
- data/vendor/local/include/unicode/timezone.h +948 -0
- data/vendor/local/include/unicode/tmunit.h +129 -0
- data/vendor/local/include/unicode/tmutamt.h +168 -0
- data/vendor/local/include/unicode/tmutfmt.h +243 -0
- data/vendor/local/include/unicode/translit.h +1342 -0
- data/vendor/local/include/unicode/tzfmt.h +1098 -0
- data/vendor/local/include/unicode/tznames.h +404 -0
- data/vendor/local/include/unicode/tzrule.h +828 -0
- data/vendor/local/include/unicode/tztrans.h +195 -0
- data/vendor/local/include/unicode/ubidi.h +2186 -0
- data/vendor/local/include/unicode/ubrk.h +540 -0
- data/vendor/local/include/unicode/ucal.h +1560 -0
- data/vendor/local/include/unicode/ucasemap.h +423 -0
- data/vendor/local/include/unicode/ucat.h +158 -0
- data/vendor/local/include/unicode/uchar.h +3426 -0
- data/vendor/local/include/unicode/ucharstrie.h +576 -0
- data/vendor/local/include/unicode/ucharstriebuilder.h +185 -0
- data/vendor/local/include/unicode/uchriter.h +381 -0
- data/vendor/local/include/unicode/uclean.h +258 -0
- data/vendor/local/include/unicode/ucnv.h +2036 -0
- data/vendor/local/include/unicode/ucnv_cb.h +162 -0
- data/vendor/local/include/unicode/ucnv_err.h +463 -0
- data/vendor/local/include/unicode/ucnvsel.h +187 -0
- data/vendor/local/include/unicode/ucol.h +1474 -0
- data/vendor/local/include/unicode/ucoleitr.h +266 -0
- data/vendor/local/include/unicode/uconfig.h +430 -0
- data/vendor/local/include/unicode/ucsdet.h +413 -0
- data/vendor/local/include/unicode/ucurr.h +424 -0
- data/vendor/local/include/unicode/udat.h +1536 -0
- data/vendor/local/include/unicode/udata.h +430 -0
- data/vendor/local/include/unicode/udateintervalformat.h +181 -0
- data/vendor/local/include/unicode/udatpg.h +588 -0
- data/vendor/local/include/unicode/udisplaycontext.h +150 -0
- data/vendor/local/include/unicode/uenum.h +206 -0
- data/vendor/local/include/unicode/uformattable.h +280 -0
- data/vendor/local/include/unicode/ugender.h +82 -0
- data/vendor/local/include/unicode/uidna.h +762 -0
- data/vendor/local/include/unicode/uiter.h +707 -0
- data/vendor/local/include/unicode/uldnames.h +302 -0
- data/vendor/local/include/unicode/uloc.h +1256 -0
- data/vendor/local/include/unicode/ulocdata.h +277 -0
- data/vendor/local/include/unicode/umachine.h +356 -0
- data/vendor/local/include/unicode/umisc.h +60 -0
- data/vendor/local/include/unicode/umsg.h +623 -0
- data/vendor/local/include/unicode/unifilt.h +120 -0
- data/vendor/local/include/unicode/unifunct.h +125 -0
- data/vendor/local/include/unicode/unimatch.h +163 -0
- data/vendor/local/include/unicode/unirepl.h +97 -0
- data/vendor/local/include/unicode/uniset.h +1691 -0
- data/vendor/local/include/unicode/unistr.h +4470 -0
- data/vendor/local/include/unicode/unorm.h +561 -0
- data/vendor/local/include/unicode/unorm2.h +528 -0
- data/vendor/local/include/unicode/unum.h +1328 -0
- data/vendor/local/include/unicode/unumsys.h +170 -0
- data/vendor/local/include/unicode/uobject.h +320 -0
- data/vendor/local/include/unicode/upluralrules.h +145 -0
- data/vendor/local/include/unicode/uregex.h +1591 -0
- data/vendor/local/include/unicode/uregion.h +248 -0
- data/vendor/local/include/unicode/urename.h +1784 -0
- data/vendor/local/include/unicode/urep.h +155 -0
- data/vendor/local/include/unicode/ures.h +887 -0
- data/vendor/local/include/unicode/uscript.h +642 -0
- data/vendor/local/include/unicode/usearch.h +885 -0
- data/vendor/local/include/unicode/uset.h +1126 -0
- data/vendor/local/include/unicode/usetiter.h +318 -0
- data/vendor/local/include/unicode/ushape.h +474 -0
- data/vendor/local/include/unicode/uspoof.h +1064 -0
- data/vendor/local/include/unicode/usprep.h +269 -0
- data/vendor/local/include/unicode/ustdio.h +1018 -0
- data/vendor/local/include/unicode/ustream.h +68 -0
- data/vendor/local/include/unicode/ustring.h +1700 -0
- data/vendor/local/include/unicode/ustringtrie.h +95 -0
- data/vendor/local/include/unicode/utext.h +1600 -0
- data/vendor/local/include/unicode/utf.h +223 -0
- data/vendor/local/include/unicode/utf16.h +623 -0
- data/vendor/local/include/unicode/utf32.h +23 -0
- data/vendor/local/include/unicode/utf8.h +824 -0
- data/vendor/local/include/unicode/utf_old.h +1169 -0
- data/vendor/local/include/unicode/utmscale.h +481 -0
- data/vendor/local/include/unicode/utrace.h +359 -0
- data/vendor/local/include/unicode/utrans.h +658 -0
- data/vendor/local/include/unicode/utypes.h +723 -0
- data/vendor/local/include/unicode/uvernum.h +170 -0
- data/vendor/local/include/unicode/uversion.h +193 -0
- data/vendor/local/include/unicode/vtzone.h +455 -0
- data/vendor/local/lib/girepository-1.0/Pango-1.0.typelib +0 -0
- data/vendor/local/lib/girepository-1.0/PangoCairo-1.0.typelib +0 -0
- data/vendor/local/lib/girepository-1.0/PangoFT2-1.0.typelib +0 -0
- data/vendor/local/lib/icu/54.1/Makefile.inc +293 -0
- data/vendor/local/lib/icu/54.1/pkgdata.inc +17 -0
- data/vendor/local/lib/icu/Makefile.inc +293 -0
- data/vendor/local/lib/icu/pkgdata.inc +17 -0
- data/vendor/local/lib/icudt.dll +0 -0
- data/vendor/local/lib/icudt54.dll +0 -0
- data/vendor/local/lib/icuin.dll +0 -0
- data/vendor/local/lib/icuin54.dll +0 -0
- data/vendor/local/lib/icuio.dll +0 -0
- data/vendor/local/lib/icuio54.dll +0 -0
- data/vendor/local/lib/icule.dll +0 -0
- data/vendor/local/lib/icule54.dll +0 -0
- data/vendor/local/lib/iculx.dll +0 -0
- data/vendor/local/lib/iculx54.dll +0 -0
- data/vendor/local/lib/icutest.dll +0 -0
- data/vendor/local/lib/icutest54.dll +0 -0
- data/vendor/local/lib/icutu.dll +0 -0
- data/vendor/local/lib/icutu54.dll +0 -0
- data/vendor/local/lib/icuuc.dll +0 -0
- data/vendor/local/lib/icuuc54.dll +0 -0
- data/vendor/local/lib/libharfbuzz-icu.a +0 -0
- data/vendor/local/lib/libharfbuzz-icu.la +41 -0
- data/vendor/local/lib/libharfbuzz.dll.a +0 -0
- data/vendor/local/lib/libharfbuzz.la +41 -0
- data/vendor/local/lib/libicudt.dll.a +0 -0
- data/vendor/local/lib/libicuin.dll.a +0 -0
- data/vendor/local/lib/libicuio.dll.a +0 -0
- data/vendor/local/lib/libicule.dll.a +0 -0
- data/vendor/local/lib/libiculx.dll.a +0 -0
- data/vendor/local/lib/libicutest.dll.a +0 -0
- data/vendor/local/lib/libicutu.dll.a +0 -0
- data/vendor/local/lib/libicuuc.dll.a +0 -0
- data/vendor/local/lib/libpango-1.0.dll.a +0 -0
- data/vendor/local/lib/libpango-1.0.la +41 -0
- data/vendor/local/lib/libpangocairo-1.0.dll.a +0 -0
- data/vendor/local/lib/libpangocairo-1.0.la +41 -0
- data/vendor/local/lib/libpangoft2-1.0.dll.a +0 -0
- data/vendor/local/lib/libpangoft2-1.0.la +41 -0
- data/vendor/local/lib/libpangowin32-1.0.dll.a +0 -0
- data/vendor/local/lib/libpangowin32-1.0.la +41 -0
- data/vendor/local/lib/pango/1.8.0/modules/pango-arabic-lang.dll +0 -0
- data/vendor/local/lib/pango/1.8.0/modules/pango-arabic-lang.dll.a +0 -0
- data/vendor/local/lib/pango/1.8.0/modules/pango-arabic-lang.la +41 -0
- data/vendor/local/lib/pango/1.8.0/modules/pango-basic-fc.dll +0 -0
- data/vendor/local/lib/pango/1.8.0/modules/pango-basic-fc.dll.a +0 -0
- data/vendor/local/lib/pango/1.8.0/modules/pango-basic-fc.la +41 -0
- data/vendor/local/lib/pango/1.8.0/modules/pango-basic-win32.dll +0 -0
- data/vendor/local/lib/pango/1.8.0/modules/pango-basic-win32.dll.a +0 -0
- data/vendor/local/lib/pango/1.8.0/modules/pango-basic-win32.la +41 -0
- data/vendor/local/lib/pango/1.8.0/modules/pango-indic-lang.dll +0 -0
- data/vendor/local/lib/pango/1.8.0/modules/pango-indic-lang.dll.a +0 -0
- data/vendor/local/lib/pango/1.8.0/modules/pango-indic-lang.la +41 -0
- data/vendor/local/lib/pkgconfig/harfbuzz-icu.pc +13 -0
- data/vendor/local/lib/pkgconfig/harfbuzz.pc +11 -0
- data/vendor/local/lib/pkgconfig/icu-i18n.pc +38 -0
- data/vendor/local/lib/pkgconfig/icu-io.pc +38 -0
- data/vendor/local/lib/pkgconfig/icu-le.pc +38 -0
- data/vendor/local/lib/pkgconfig/icu-lx.pc +38 -0
- data/vendor/local/lib/pkgconfig/icu-uc.pc +38 -0
- data/vendor/local/lib/pkgconfig/pango.pc +14 -0
- data/vendor/local/lib/pkgconfig/pangocairo.pc +11 -0
- data/vendor/local/lib/pkgconfig/pangoft2.pc +12 -0
- data/vendor/local/lib/pkgconfig/pangowin32.pc +11 -0
- data/vendor/local/share/gir-1.0/Pango-1.0.gir +13329 -0
- data/vendor/local/share/gir-1.0/PangoCairo-1.0.gir +833 -0
- data/vendor/local/share/gir-1.0/PangoFT2-1.0.gir +354 -0
- data/vendor/local/share/gtk-doc/html/harfbuzz/annotation-glossary.html +75 -0
- data/vendor/local/share/gtk-doc/html/harfbuzz/api-index-full.html +1449 -0
- data/vendor/local/share/gtk-doc/html/harfbuzz/ch01.html +98 -0
- data/vendor/local/share/gtk-doc/html/harfbuzz/deprecated-api-index.html +46 -0
- data/vendor/local/share/gtk-doc/html/harfbuzz/harfbuzz-hb-blob.html +610 -0
- data/vendor/local/share/gtk-doc/html/harfbuzz/harfbuzz-hb-buffer.html +1780 -0
- data/vendor/local/share/gtk-doc/html/harfbuzz/harfbuzz-hb-common.html +1337 -0
- data/vendor/local/share/gtk-doc/html/harfbuzz/harfbuzz-hb-coretext.html +144 -0
- data/vendor/local/share/gtk-doc/html/harfbuzz/harfbuzz-hb-deprecated.html +99 -0
- data/vendor/local/share/gtk-doc/html/harfbuzz/harfbuzz-hb-face.html +630 -0
- data/vendor/local/share/gtk-doc/html/harfbuzz/harfbuzz-hb-font.html +2529 -0
- data/vendor/local/share/gtk-doc/html/harfbuzz/harfbuzz-hb-ft.html +188 -0
- data/vendor/local/share/gtk-doc/html/harfbuzz/harfbuzz-hb-glib.html +120 -0
- data/vendor/local/share/gtk-doc/html/harfbuzz/harfbuzz-hb-gobject.html +50 -0
- data/vendor/local/share/gtk-doc/html/harfbuzz/harfbuzz-hb-graphite2.html +120 -0
- data/vendor/local/share/gtk-doc/html/harfbuzz/harfbuzz-hb-icu.html +120 -0
- data/vendor/local/share/gtk-doc/html/harfbuzz/harfbuzz-hb-ot-layout.html +771 -0
- data/vendor/local/share/gtk-doc/html/harfbuzz/harfbuzz-hb-ot-tag.html +172 -0
- data/vendor/local/share/gtk-doc/html/harfbuzz/harfbuzz-hb-ot.html +50 -0
- data/vendor/local/share/gtk-doc/html/harfbuzz/harfbuzz-hb-set.html +966 -0
- data/vendor/local/share/gtk-doc/html/harfbuzz/harfbuzz-hb-shape-plan.html +405 -0
- data/vendor/local/share/gtk-doc/html/harfbuzz/harfbuzz-hb-shape.html +286 -0
- data/vendor/local/share/gtk-doc/html/harfbuzz/harfbuzz-hb-unicode.html +1523 -0
- data/vendor/local/share/gtk-doc/html/harfbuzz/harfbuzz-hb-uniscribe.html +100 -0
- data/vendor/local/share/gtk-doc/html/harfbuzz/harfbuzz-hb-version.html +182 -0
- data/vendor/local/share/gtk-doc/html/harfbuzz/harfbuzz-hb.html +50 -0
- data/vendor/local/share/gtk-doc/html/harfbuzz/harfbuzz.devhelp2 +378 -0
- data/vendor/local/share/gtk-doc/html/harfbuzz/home.png +0 -0
- data/vendor/local/share/gtk-doc/html/harfbuzz/index.html +105 -0
- data/vendor/local/share/gtk-doc/html/harfbuzz/index.sgml +496 -0
- data/vendor/local/share/gtk-doc/html/harfbuzz/left-insensitive.png +0 -0
- data/vendor/local/share/gtk-doc/html/harfbuzz/left.png +0 -0
- data/vendor/local/share/gtk-doc/html/harfbuzz/object-tree.html +59 -0
- data/vendor/local/share/gtk-doc/html/harfbuzz/right-insensitive.png +0 -0
- data/vendor/local/share/gtk-doc/html/harfbuzz/right.png +0 -0
- data/vendor/local/share/gtk-doc/html/harfbuzz/style.css +476 -0
- data/vendor/local/share/gtk-doc/html/harfbuzz/up-insensitive.png +0 -0
- data/vendor/local/share/gtk-doc/html/harfbuzz/up.png +0 -0
- data/vendor/local/share/gtk-doc/html/pango/PangoEngineLang.html +224 -0
- data/vendor/local/share/gtk-doc/html/pango/PangoEngineShape.html +255 -0
- data/vendor/local/share/gtk-doc/html/pango/PangoFcDecoder.html +246 -0
- data/vendor/local/share/gtk-doc/html/pango/PangoFcFont.html +500 -0
- data/vendor/local/share/gtk-doc/html/pango/PangoFcFontMap.html +1001 -0
- data/vendor/local/share/gtk-doc/html/pango/PangoMarkupFormat.html +301 -0
- data/vendor/local/share/gtk-doc/html/pango/PangoRenderer.html +1219 -0
- data/vendor/local/share/gtk-doc/html/pango/annotation-glossary.html +89 -0
- data/vendor/local/share/gtk-doc/html/pango/api-index-1-10.html +135 -0
- data/vendor/local/share/gtk-doc/html/pango/api-index-1-12.html +49 -0
- data/vendor/local/share/gtk-doc/html/pango/api-index-1-14.html +64 -0
- data/vendor/local/share/gtk-doc/html/pango/api-index-1-16.html +228 -0
- data/vendor/local/share/gtk-doc/html/pango/api-index-1-18.html +152 -0
- data/vendor/local/share/gtk-doc/html/pango/api-index-1-2.html +122 -0
- data/vendor/local/share/gtk-doc/html/pango/api-index-1-20.html +87 -0
- data/vendor/local/share/gtk-doc/html/pango/api-index-1-22.html +124 -0
- data/vendor/local/share/gtk-doc/html/pango/api-index-1-24.html +97 -0
- data/vendor/local/share/gtk-doc/html/pango/api-index-1-26.html +46 -0
- data/vendor/local/share/gtk-doc/html/pango/api-index-1-30.html +39 -0
- data/vendor/local/share/gtk-doc/html/pango/api-index-1-31-0.html +39 -0
- data/vendor/local/share/gtk-doc/html/pango/api-index-1-32-4.html +53 -0
- data/vendor/local/share/gtk-doc/html/pango/api-index-1-32.html +42 -0
- data/vendor/local/share/gtk-doc/html/pango/api-index-1-34.html +38 -0
- data/vendor/local/share/gtk-doc/html/pango/api-index-1-4.html +201 -0
- data/vendor/local/share/gtk-doc/html/pango/api-index-1-6.html +165 -0
- data/vendor/local/share/gtk-doc/html/pango/api-index-1-8.html +171 -0
- data/vendor/local/share/gtk-doc/html/pango/api-index-deprecated.html +284 -0
- data/vendor/local/share/gtk-doc/html/pango/api-index-full.html +2968 -0
- data/vendor/local/share/gtk-doc/html/pango/home.png +0 -0
- data/vendor/local/share/gtk-doc/html/pango/index.html +146 -0
- data/vendor/local/share/gtk-doc/html/pango/index.sgml +957 -0
- data/vendor/local/share/gtk-doc/html/pango/layout.gif +0 -0
- data/vendor/local/share/gtk-doc/html/pango/left-insensitive.png +0 -0
- data/vendor/local/share/gtk-doc/html/pango/left.png +0 -0
- data/vendor/local/share/gtk-doc/html/pango/lowlevel.html +68 -0
- data/vendor/local/share/gtk-doc/html/pango/pango-Bidirectional-Text.html +514 -0
- data/vendor/local/share/gtk-doc/html/pango/pango-Cairo-Rendering.html +1632 -0
- data/vendor/local/share/gtk-doc/html/pango/pango-CoreText-Fonts.html +115 -0
- data/vendor/local/share/gtk-doc/html/pango/pango-Coverage-Maps.html +508 -0
- data/vendor/local/share/gtk-doc/html/pango/pango-Engines.html +358 -0
- data/vendor/local/share/gtk-doc/html/pango/pango-Fonts.html +4154 -0
- data/vendor/local/share/gtk-doc/html/pango/pango-FreeType-Fonts-and-Rendering.html +956 -0
- data/vendor/local/share/gtk-doc/html/pango/pango-Glyph-Storage.html +2627 -0
- data/vendor/local/share/gtk-doc/html/pango/pango-Layout-Objects.html +4153 -0
- data/vendor/local/share/gtk-doc/html/pango/pango-Miscellaneous-Utilities.html +965 -0
- data/vendor/local/share/gtk-doc/html/pango/pango-Modules.html +331 -0
- data/vendor/local/share/gtk-doc/html/pango/pango-OpenType-Font-Handling.html +2202 -0
- data/vendor/local/share/gtk-doc/html/pango/pango-Scripts-and-Languages.html +1430 -0
- data/vendor/local/share/gtk-doc/html/pango/pango-Tab-Stops.html +582 -0
- data/vendor/local/share/gtk-doc/html/pango/pango-Text-Attributes.html +3356 -0
- data/vendor/local/share/gtk-doc/html/pango/pango-Text-Processing.html +2079 -0
- data/vendor/local/share/gtk-doc/html/pango/pango-Version-Checking.html +325 -0
- data/vendor/local/share/gtk-doc/html/pango/pango-Vertical-Text.html +523 -0
- data/vendor/local/share/gtk-doc/html/pango/pango-Win32-Fonts-and-Rendering.html +1028 -0
- data/vendor/local/share/gtk-doc/html/pango/pango-Xft-Fonts-and-Rendering.html +1275 -0
- data/vendor/local/share/gtk-doc/html/pango/pango-hierarchy.html +91 -0
- data/vendor/local/share/gtk-doc/html/pango/pango-querymodules.html +131 -0
- data/vendor/local/share/gtk-doc/html/pango/pango.devhelp2 +786 -0
- data/vendor/local/share/gtk-doc/html/pango/pango.html +63 -0
- data/vendor/local/share/gtk-doc/html/pango/rendering.html +47 -0
- data/vendor/local/share/gtk-doc/html/pango/right-insensitive.png +0 -0
- data/vendor/local/share/gtk-doc/html/pango/right.png +0 -0
- data/vendor/local/share/gtk-doc/html/pango/rotated-text.png +0 -0
- data/vendor/local/share/gtk-doc/html/pango/style.css +476 -0
- data/vendor/local/share/gtk-doc/html/pango/tools.html +33 -0
- data/vendor/local/share/gtk-doc/html/pango/up-insensitive.png +0 -0
- data/vendor/local/share/gtk-doc/html/pango/up.png +0 -0
- data/vendor/local/share/icu/54.1/config/mh-mingw64 +158 -0
- data/vendor/local/share/icu/54.1/install-sh +251 -0
- data/vendor/local/share/icu/54.1/license.html +385 -0
- data/vendor/local/share/icu/54.1/mkinstalldirs +43 -0
- data/vendor/local/share/license/harfbuzz/AUTHORS +9 -0
- data/vendor/local/share/license/harfbuzz/COPYING +36 -0
- data/vendor/local/share/license/pango/AUTHORS +2 -0
- data/vendor/local/share/license/pango/COPYING +482 -0
- data/vendor/local/share/man/man1/derb.1 +196 -0
- data/vendor/local/share/man/man1/genbrk.1 +112 -0
- data/vendor/local/share/man/man1/gencfu.1 +91 -0
- data/vendor/local/share/man/man1/gencnval.1 +91 -0
- data/vendor/local/share/man/man1/gendict.1 +131 -0
- data/vendor/local/share/man/man1/genrb.1 +146 -0
- data/vendor/local/share/man/man1/icu-config.1 +288 -0
- data/vendor/local/share/man/man1/makeconv.1 +112 -0
- data/vendor/local/share/man/man1/pango-querymodules.1 +106 -0
- data/vendor/local/share/man/man1/pango-view.1 +1 -0
- data/vendor/local/share/man/man1/pkgdata.1 +258 -0
- data/vendor/local/share/man/man1/uconv.1 +443 -0
- data/vendor/local/share/man/man8/genccode.8 +106 -0
- data/vendor/local/share/man/man8/gencmn.8 +129 -0
- data/vendor/local/share/man/man8/gensprep.8 +102 -0
- data/vendor/local/share/man/man8/icupkg.8 +204 -0
- metadata +599 -0
@@ -0,0 +1,2479 @@
|
|
1
|
+
/*
|
2
|
+
********************************************************************************
|
3
|
+
* Copyright (C) 1997-2014, International Business Machines
|
4
|
+
* Corporation and others. All Rights Reserved.
|
5
|
+
********************************************************************************
|
6
|
+
*
|
7
|
+
* File DECIMFMT.H
|
8
|
+
*
|
9
|
+
* Modification History:
|
10
|
+
*
|
11
|
+
* Date Name Description
|
12
|
+
* 02/19/97 aliu Converted from java.
|
13
|
+
* 03/20/97 clhuang Updated per C++ implementation.
|
14
|
+
* 04/03/97 aliu Rewrote parsing and formatting completely, and
|
15
|
+
* cleaned up and debugged. Actually works now.
|
16
|
+
* 04/17/97 aliu Changed DigitCount to int per code review.
|
17
|
+
* 07/10/97 helena Made ParsePosition a class and get rid of the function
|
18
|
+
* hiding problems.
|
19
|
+
* 09/09/97 aliu Ported over support for exponential formats.
|
20
|
+
* 07/20/98 stephen Changed documentation
|
21
|
+
* 01/30/13 emmons Added Scaling methods
|
22
|
+
********************************************************************************
|
23
|
+
*/
|
24
|
+
|
25
|
+
#ifndef DECIMFMT_H
|
26
|
+
#define DECIMFMT_H
|
27
|
+
|
28
|
+
#include "unicode/utypes.h"
|
29
|
+
/**
|
30
|
+
* \file
|
31
|
+
* \brief C++ API: Formats decimal numbers.
|
32
|
+
*/
|
33
|
+
|
34
|
+
#if !UCONFIG_NO_FORMATTING
|
35
|
+
|
36
|
+
#include "unicode/dcfmtsym.h"
|
37
|
+
#include "unicode/numfmt.h"
|
38
|
+
#include "unicode/locid.h"
|
39
|
+
#include "unicode/fpositer.h"
|
40
|
+
#include "unicode/stringpiece.h"
|
41
|
+
#include "unicode/curramt.h"
|
42
|
+
#include "unicode/enumset.h"
|
43
|
+
|
44
|
+
/**
|
45
|
+
* \def UNUM_DECIMALFORMAT_INTERNAL_SIZE
|
46
|
+
* @internal
|
47
|
+
*/
|
48
|
+
#if UCONFIG_FORMAT_FASTPATHS_49
|
49
|
+
#define UNUM_DECIMALFORMAT_INTERNAL_SIZE 16
|
50
|
+
#endif
|
51
|
+
|
52
|
+
U_NAMESPACE_BEGIN
|
53
|
+
|
54
|
+
class DigitList;
|
55
|
+
class ChoiceFormat;
|
56
|
+
class CurrencyPluralInfo;
|
57
|
+
class Hashtable;
|
58
|
+
class UnicodeSet;
|
59
|
+
class FieldPositionHandler;
|
60
|
+
class DecimalFormatStaticSets;
|
61
|
+
class FixedDecimal;
|
62
|
+
|
63
|
+
// explicit template instantiation. see digitlst.h
|
64
|
+
#if defined (_MSC_VER)
|
65
|
+
template class U_I18N_API EnumSet<UNumberFormatAttribute,
|
66
|
+
UNUM_MAX_NONBOOLEAN_ATTRIBUTE+1,
|
67
|
+
UNUM_LIMIT_BOOLEAN_ATTRIBUTE>;
|
68
|
+
#endif
|
69
|
+
|
70
|
+
/**
|
71
|
+
* DecimalFormat is a concrete subclass of NumberFormat that formats decimal
|
72
|
+
* numbers. It has a variety of features designed to make it possible to parse
|
73
|
+
* and format numbers in any locale, including support for Western, Arabic, or
|
74
|
+
* Indic digits. It also supports different flavors of numbers, including
|
75
|
+
* integers ("123"), fixed-point numbers ("123.4"), scientific notation
|
76
|
+
* ("1.23E4"), percentages ("12%"), and currency amounts ("$123", "USD123",
|
77
|
+
* "123 US dollars"). All of these flavors can be easily localized.
|
78
|
+
*
|
79
|
+
* <p>To obtain a NumberFormat for a specific locale (including the default
|
80
|
+
* locale) call one of NumberFormat's factory methods such as
|
81
|
+
* createInstance(). Do not call the DecimalFormat constructors directly, unless
|
82
|
+
* you know what you are doing, since the NumberFormat factory methods may
|
83
|
+
* return subclasses other than DecimalFormat.
|
84
|
+
*
|
85
|
+
* <p><strong>Example Usage</strong>
|
86
|
+
*
|
87
|
+
* \code
|
88
|
+
* // Normally we would have a GUI with a menu for this
|
89
|
+
* int32_t locCount;
|
90
|
+
* const Locale* locales = NumberFormat::getAvailableLocales(locCount);
|
91
|
+
*
|
92
|
+
* double myNumber = -1234.56;
|
93
|
+
* UErrorCode success = U_ZERO_ERROR;
|
94
|
+
* NumberFormat* form;
|
95
|
+
*
|
96
|
+
* // Print out a number with the localized number, currency and percent
|
97
|
+
* // format for each locale.
|
98
|
+
* UnicodeString countryName;
|
99
|
+
* UnicodeString displayName;
|
100
|
+
* UnicodeString str;
|
101
|
+
* UnicodeString pattern;
|
102
|
+
* Formattable fmtable;
|
103
|
+
* for (int32_t j = 0; j < 3; ++j) {
|
104
|
+
* cout << endl << "FORMAT " << j << endl;
|
105
|
+
* for (int32_t i = 0; i < locCount; ++i) {
|
106
|
+
* if (locales[i].getCountry(countryName).size() == 0) {
|
107
|
+
* // skip language-only
|
108
|
+
* continue;
|
109
|
+
* }
|
110
|
+
* switch (j) {
|
111
|
+
* case 0:
|
112
|
+
* form = NumberFormat::createInstance(locales[i], success ); break;
|
113
|
+
* case 1:
|
114
|
+
* form = NumberFormat::createCurrencyInstance(locales[i], success ); break;
|
115
|
+
* default:
|
116
|
+
* form = NumberFormat::createPercentInstance(locales[i], success ); break;
|
117
|
+
* }
|
118
|
+
* if (form) {
|
119
|
+
* str.remove();
|
120
|
+
* pattern = ((DecimalFormat*)form)->toPattern(pattern);
|
121
|
+
* cout << locales[i].getDisplayName(displayName) << ": " << pattern;
|
122
|
+
* cout << " -> " << form->format(myNumber,str) << endl;
|
123
|
+
* form->parse(form->format(myNumber,str), fmtable, success);
|
124
|
+
* delete form;
|
125
|
+
* }
|
126
|
+
* }
|
127
|
+
* }
|
128
|
+
* \endcode
|
129
|
+
* <P>
|
130
|
+
* Another example use createInstance(style)
|
131
|
+
* <P>
|
132
|
+
* <pre>
|
133
|
+
* <strong>// Print out a number using the localized number, currency,
|
134
|
+
* // percent, scientific, integer, iso currency, and plural currency
|
135
|
+
* // format for each locale</strong>
|
136
|
+
* Locale* locale = new Locale("en", "US");
|
137
|
+
* double myNumber = 1234.56;
|
138
|
+
* UErrorCode success = U_ZERO_ERROR;
|
139
|
+
* UnicodeString str;
|
140
|
+
* Formattable fmtable;
|
141
|
+
* for (int j=NumberFormat::kNumberStyle;
|
142
|
+
* j<=NumberFormat::kPluralCurrencyStyle;
|
143
|
+
* ++j) {
|
144
|
+
* NumberFormat* format = NumberFormat::createInstance(locale, j, success);
|
145
|
+
* str.remove();
|
146
|
+
* cout << "format result " << form->format(myNumber, str) << endl;
|
147
|
+
* format->parse(form->format(myNumber, str), fmtable, success);
|
148
|
+
* }</pre>
|
149
|
+
*
|
150
|
+
*
|
151
|
+
* <p><strong>Patterns</strong>
|
152
|
+
*
|
153
|
+
* <p>A DecimalFormat consists of a <em>pattern</em> and a set of
|
154
|
+
* <em>symbols</em>. The pattern may be set directly using
|
155
|
+
* applyPattern(), or indirectly using other API methods which
|
156
|
+
* manipulate aspects of the pattern, such as the minimum number of integer
|
157
|
+
* digits. The symbols are stored in a DecimalFormatSymbols
|
158
|
+
* object. When using the NumberFormat factory methods, the
|
159
|
+
* pattern and symbols are read from ICU's locale data.
|
160
|
+
*
|
161
|
+
* <p><strong>Special Pattern Characters</strong>
|
162
|
+
*
|
163
|
+
* <p>Many characters in a pattern are taken literally; they are matched during
|
164
|
+
* parsing and output unchanged during formatting. Special characters, on the
|
165
|
+
* other hand, stand for other characters, strings, or classes of characters.
|
166
|
+
* For example, the '#' character is replaced by a localized digit. Often the
|
167
|
+
* replacement character is the same as the pattern character; in the U.S. locale,
|
168
|
+
* the ',' grouping character is replaced by ','. However, the replacement is
|
169
|
+
* still happening, and if the symbols are modified, the grouping character
|
170
|
+
* changes. Some special characters affect the behavior of the formatter by
|
171
|
+
* their presence; for example, if the percent character is seen, then the
|
172
|
+
* value is multiplied by 100 before being displayed.
|
173
|
+
*
|
174
|
+
* <p>To insert a special character in a pattern as a literal, that is, without
|
175
|
+
* any special meaning, the character must be quoted. There are some exceptions to
|
176
|
+
* this which are noted below.
|
177
|
+
*
|
178
|
+
* <p>The characters listed here are used in non-localized patterns. Localized
|
179
|
+
* patterns use the corresponding characters taken from this formatter's
|
180
|
+
* DecimalFormatSymbols object instead, and these characters lose
|
181
|
+
* their special status. Two exceptions are the currency sign and quote, which
|
182
|
+
* are not localized.
|
183
|
+
*
|
184
|
+
* <table border=0 cellspacing=3 cellpadding=0>
|
185
|
+
* <tr bgcolor="#ccccff">
|
186
|
+
* <td align=left><strong>Symbol</strong>
|
187
|
+
* <td align=left><strong>Location</strong>
|
188
|
+
* <td align=left><strong>Localized?</strong>
|
189
|
+
* <td align=left><strong>Meaning</strong>
|
190
|
+
* <tr valign=top>
|
191
|
+
* <td><code>0</code>
|
192
|
+
* <td>Number
|
193
|
+
* <td>Yes
|
194
|
+
* <td>Digit
|
195
|
+
* <tr valign=top bgcolor="#eeeeff">
|
196
|
+
* <td><code>1-9</code>
|
197
|
+
* <td>Number
|
198
|
+
* <td>Yes
|
199
|
+
* <td>'1' through '9' indicate rounding.
|
200
|
+
* <tr valign=top>
|
201
|
+
* <td><code>\htmlonly@\endhtmlonly</code> <!--doxygen doesn't like @-->
|
202
|
+
* <td>Number
|
203
|
+
* <td>No
|
204
|
+
* <td>Significant digit
|
205
|
+
* <tr valign=top bgcolor="#eeeeff">
|
206
|
+
* <td><code>#</code>
|
207
|
+
* <td>Number
|
208
|
+
* <td>Yes
|
209
|
+
* <td>Digit, zero shows as absent
|
210
|
+
* <tr valign=top>
|
211
|
+
* <td><code>.</code>
|
212
|
+
* <td>Number
|
213
|
+
* <td>Yes
|
214
|
+
* <td>Decimal separator or monetary decimal separator
|
215
|
+
* <tr valign=top bgcolor="#eeeeff">
|
216
|
+
* <td><code>-</code>
|
217
|
+
* <td>Number
|
218
|
+
* <td>Yes
|
219
|
+
* <td>Minus sign
|
220
|
+
* <tr valign=top>
|
221
|
+
* <td><code>,</code>
|
222
|
+
* <td>Number
|
223
|
+
* <td>Yes
|
224
|
+
* <td>Grouping separator
|
225
|
+
* <tr valign=top bgcolor="#eeeeff">
|
226
|
+
* <td><code>E</code>
|
227
|
+
* <td>Number
|
228
|
+
* <td>Yes
|
229
|
+
* <td>Separates mantissa and exponent in scientific notation.
|
230
|
+
* <em>Need not be quoted in prefix or suffix.</em>
|
231
|
+
* <tr valign=top>
|
232
|
+
* <td><code>+</code>
|
233
|
+
* <td>Exponent
|
234
|
+
* <td>Yes
|
235
|
+
* <td>Prefix positive exponents with localized plus sign.
|
236
|
+
* <em>Need not be quoted in prefix or suffix.</em>
|
237
|
+
* <tr valign=top bgcolor="#eeeeff">
|
238
|
+
* <td><code>;</code>
|
239
|
+
* <td>Subpattern boundary
|
240
|
+
* <td>Yes
|
241
|
+
* <td>Separates positive and negative subpatterns
|
242
|
+
* <tr valign=top>
|
243
|
+
* <td><code>\%</code>
|
244
|
+
* <td>Prefix or suffix
|
245
|
+
* <td>Yes
|
246
|
+
* <td>Multiply by 100 and show as percentage
|
247
|
+
* <tr valign=top bgcolor="#eeeeff">
|
248
|
+
* <td><code>\\u2030</code>
|
249
|
+
* <td>Prefix or suffix
|
250
|
+
* <td>Yes
|
251
|
+
* <td>Multiply by 1000 and show as per mille
|
252
|
+
* <tr valign=top>
|
253
|
+
* <td><code>\htmlonly¤\endhtmlonly</code> (<code>\\u00A4</code>)
|
254
|
+
* <td>Prefix or suffix
|
255
|
+
* <td>No
|
256
|
+
* <td>Currency sign, replaced by currency symbol. If
|
257
|
+
* doubled, replaced by international currency symbol.
|
258
|
+
* If tripled, replaced by currency plural names, for example,
|
259
|
+
* "US dollar" or "US dollars" for America.
|
260
|
+
* If present in a pattern, the monetary decimal separator
|
261
|
+
* is used instead of the decimal separator.
|
262
|
+
* <tr valign=top bgcolor="#eeeeff">
|
263
|
+
* <td><code>'</code>
|
264
|
+
* <td>Prefix or suffix
|
265
|
+
* <td>No
|
266
|
+
* <td>Used to quote special characters in a prefix or suffix,
|
267
|
+
* for example, <code>"'#'#"</code> formats 123 to
|
268
|
+
* <code>"#123"</code>. To create a single quote
|
269
|
+
* itself, use two in a row: <code>"# o''clock"</code>.
|
270
|
+
* <tr valign=top>
|
271
|
+
* <td><code>*</code>
|
272
|
+
* <td>Prefix or suffix boundary
|
273
|
+
* <td>Yes
|
274
|
+
* <td>Pad escape, precedes pad character
|
275
|
+
* </table>
|
276
|
+
*
|
277
|
+
* <p>A DecimalFormat pattern contains a postive and negative
|
278
|
+
* subpattern, for example, "#,##0.00;(#,##0.00)". Each subpattern has a
|
279
|
+
* prefix, a numeric part, and a suffix. If there is no explicit negative
|
280
|
+
* subpattern, the negative subpattern is the localized minus sign prefixed to the
|
281
|
+
* positive subpattern. That is, "0.00" alone is equivalent to "0.00;-0.00". If there
|
282
|
+
* is an explicit negative subpattern, it serves only to specify the negative
|
283
|
+
* prefix and suffix; the number of digits, minimal digits, and other
|
284
|
+
* characteristics are ignored in the negative subpattern. That means that
|
285
|
+
* "#,##0.0#;(#)" has precisely the same result as "#,##0.0#;(#,##0.0#)".
|
286
|
+
*
|
287
|
+
* <p>The prefixes, suffixes, and various symbols used for infinity, digits,
|
288
|
+
* thousands separators, decimal separators, etc. may be set to arbitrary
|
289
|
+
* values, and they will appear properly during formatting. However, care must
|
290
|
+
* be taken that the symbols and strings do not conflict, or parsing will be
|
291
|
+
* unreliable. For example, either the positive and negative prefixes or the
|
292
|
+
* suffixes must be distinct for parse() to be able
|
293
|
+
* to distinguish positive from negative values. Another example is that the
|
294
|
+
* decimal separator and thousands separator should be distinct characters, or
|
295
|
+
* parsing will be impossible.
|
296
|
+
*
|
297
|
+
* <p>The <em>grouping separator</em> is a character that separates clusters of
|
298
|
+
* integer digits to make large numbers more legible. It commonly used for
|
299
|
+
* thousands, but in some locales it separates ten-thousands. The <em>grouping
|
300
|
+
* size</em> is the number of digits between the grouping separators, such as 3
|
301
|
+
* for "100,000,000" or 4 for "1 0000 0000". There are actually two different
|
302
|
+
* grouping sizes: One used for the least significant integer digits, the
|
303
|
+
* <em>primary grouping size</em>, and one used for all others, the
|
304
|
+
* <em>secondary grouping size</em>. In most locales these are the same, but
|
305
|
+
* sometimes they are different. For example, if the primary grouping interval
|
306
|
+
* is 3, and the secondary is 2, then this corresponds to the pattern
|
307
|
+
* "#,##,##0", and the number 123456789 is formatted as "12,34,56,789". If a
|
308
|
+
* pattern contains multiple grouping separators, the interval between the last
|
309
|
+
* one and the end of the integer defines the primary grouping size, and the
|
310
|
+
* interval between the last two defines the secondary grouping size. All others
|
311
|
+
* are ignored, so "#,##,###,####" == "###,###,####" == "##,#,###,####".
|
312
|
+
*
|
313
|
+
* <p>Illegal patterns, such as "#.#.#" or "#.###,###", will cause
|
314
|
+
* DecimalFormat to set a failing UErrorCode.
|
315
|
+
*
|
316
|
+
* <p><strong>Pattern BNF</strong>
|
317
|
+
*
|
318
|
+
* <pre>
|
319
|
+
* pattern := subpattern (';' subpattern)?
|
320
|
+
* subpattern := prefix? number exponent? suffix?
|
321
|
+
* number := (integer ('.' fraction)?) | sigDigits
|
322
|
+
* prefix := '\\u0000'..'\\uFFFD' - specialCharacters
|
323
|
+
* suffix := '\\u0000'..'\\uFFFD' - specialCharacters
|
324
|
+
* integer := '#'* '0'* '0'
|
325
|
+
* fraction := '0'* '#'*
|
326
|
+
* sigDigits := '#'* '@' '@'* '#'*
|
327
|
+
* exponent := 'E' '+'? '0'* '0'
|
328
|
+
* padSpec := '*' padChar
|
329
|
+
* padChar := '\\u0000'..'\\uFFFD' - quote
|
330
|
+
*
|
331
|
+
* Notation:
|
332
|
+
* X* 0 or more instances of X
|
333
|
+
* X? 0 or 1 instances of X
|
334
|
+
* X|Y either X or Y
|
335
|
+
* C..D any character from C up to D, inclusive
|
336
|
+
* S-T characters in S, except those in T
|
337
|
+
* </pre>
|
338
|
+
* The first subpattern is for positive numbers. The second (optional)
|
339
|
+
* subpattern is for negative numbers.
|
340
|
+
*
|
341
|
+
* <p>Not indicated in the BNF syntax above:
|
342
|
+
*
|
343
|
+
* <ul><li>The grouping separator ',' can occur inside the integer and
|
344
|
+
* sigDigits elements, between any two pattern characters of that
|
345
|
+
* element, as long as the integer or sigDigits element is not
|
346
|
+
* followed by the exponent element.
|
347
|
+
*
|
348
|
+
* <li>Two grouping intervals are recognized: That between the
|
349
|
+
* decimal point and the first grouping symbol, and that
|
350
|
+
* between the first and second grouping symbols. These
|
351
|
+
* intervals are identical in most locales, but in some
|
352
|
+
* locales they differ. For example, the pattern
|
353
|
+
* "#,##,###" formats the number 123456789 as
|
354
|
+
* "12,34,56,789".</li>
|
355
|
+
*
|
356
|
+
* <li>The pad specifier <code>padSpec</code> may appear before the prefix,
|
357
|
+
* after the prefix, before the suffix, after the suffix, or not at all.
|
358
|
+
*
|
359
|
+
* <li>In place of '0', the digits '1' through '9' may be used to
|
360
|
+
* indicate a rounding increment.
|
361
|
+
* </ul>
|
362
|
+
*
|
363
|
+
* <p><strong>Parsing</strong>
|
364
|
+
*
|
365
|
+
* <p>DecimalFormat parses all Unicode characters that represent
|
366
|
+
* decimal digits, as defined by u_charDigitValue(). In addition,
|
367
|
+
* DecimalFormat also recognizes as digits the ten consecutive
|
368
|
+
* characters starting with the localized zero digit defined in the
|
369
|
+
* DecimalFormatSymbols object. During formatting, the
|
370
|
+
* DecimalFormatSymbols-based digits are output.
|
371
|
+
*
|
372
|
+
* <p>During parsing, grouping separators are ignored if in lenient mode;
|
373
|
+
* otherwise, if present, they must be in appropriate positions.
|
374
|
+
*
|
375
|
+
* <p>For currency parsing, the formatter is able to parse every currency
|
376
|
+
* style formats no matter which style the formatter is constructed with.
|
377
|
+
* For example, a formatter instance gotten from
|
378
|
+
* NumberFormat.getInstance(ULocale, NumberFormat.CURRENCYSTYLE) can parse
|
379
|
+
* formats such as "USD1.00" and "3.00 US dollars".
|
380
|
+
*
|
381
|
+
* <p>If parse(UnicodeString&,Formattable&,ParsePosition&)
|
382
|
+
* fails to parse a string, it leaves the parse position unchanged.
|
383
|
+
* The convenience method parse(UnicodeString&,Formattable&,UErrorCode&)
|
384
|
+
* indicates parse failure by setting a failing
|
385
|
+
* UErrorCode.
|
386
|
+
*
|
387
|
+
* <p><strong>Formatting</strong>
|
388
|
+
*
|
389
|
+
* <p>Formatting is guided by several parameters, all of which can be
|
390
|
+
* specified either using a pattern or using the API. The following
|
391
|
+
* description applies to formats that do not use <a href="#sci">scientific
|
392
|
+
* notation</a> or <a href="#sigdig">significant digits</a>.
|
393
|
+
*
|
394
|
+
* <ul><li>If the number of actual integer digits exceeds the
|
395
|
+
* <em>maximum integer digits</em>, then only the least significant
|
396
|
+
* digits are shown. For example, 1997 is formatted as "97" if the
|
397
|
+
* maximum integer digits is set to 2.
|
398
|
+
*
|
399
|
+
* <li>If the number of actual integer digits is less than the
|
400
|
+
* <em>minimum integer digits</em>, then leading zeros are added. For
|
401
|
+
* example, 1997 is formatted as "01997" if the minimum integer digits
|
402
|
+
* is set to 5.
|
403
|
+
*
|
404
|
+
* <li>If the number of actual fraction digits exceeds the <em>maximum
|
405
|
+
* fraction digits</em>, then rounding is performed to the
|
406
|
+
* maximum fraction digits. For example, 0.125 is formatted as "0.12"
|
407
|
+
* if the maximum fraction digits is 2. This behavior can be changed
|
408
|
+
* by specifying a rounding increment and/or a rounding mode.
|
409
|
+
*
|
410
|
+
* <li>If the number of actual fraction digits is less than the
|
411
|
+
* <em>minimum fraction digits</em>, then trailing zeros are added.
|
412
|
+
* For example, 0.125 is formatted as "0.1250" if the mimimum fraction
|
413
|
+
* digits is set to 4.
|
414
|
+
*
|
415
|
+
* <li>Trailing fractional zeros are not displayed if they occur
|
416
|
+
* <em>j</em> positions after the decimal, where <em>j</em> is less
|
417
|
+
* than the maximum fraction digits. For example, 0.10004 is
|
418
|
+
* formatted as "0.1" if the maximum fraction digits is four or less.
|
419
|
+
* </ul>
|
420
|
+
*
|
421
|
+
* <p><strong>Special Values</strong>
|
422
|
+
*
|
423
|
+
* <p><code>NaN</code> is represented as a single character, typically
|
424
|
+
* <code>\\uFFFD</code>. This character is determined by the
|
425
|
+
* DecimalFormatSymbols object. This is the only value for which
|
426
|
+
* the prefixes and suffixes are not used.
|
427
|
+
*
|
428
|
+
* <p>Infinity is represented as a single character, typically
|
429
|
+
* <code>\\u221E</code>, with the positive or negative prefixes and suffixes
|
430
|
+
* applied. The infinity character is determined by the
|
431
|
+
* DecimalFormatSymbols object.
|
432
|
+
*
|
433
|
+
* <a name="sci"><strong>Scientific Notation</strong></a>
|
434
|
+
*
|
435
|
+
* <p>Numbers in scientific notation are expressed as the product of a mantissa
|
436
|
+
* and a power of ten, for example, 1234 can be expressed as 1.234 x 10<sup>3</sup>. The
|
437
|
+
* mantissa is typically in the half-open interval [1.0, 10.0) or sometimes [0.0, 1.0),
|
438
|
+
* but it need not be. DecimalFormat supports arbitrary mantissas.
|
439
|
+
* DecimalFormat can be instructed to use scientific
|
440
|
+
* notation through the API or through the pattern. In a pattern, the exponent
|
441
|
+
* character immediately followed by one or more digit characters indicates
|
442
|
+
* scientific notation. Example: "0.###E0" formats the number 1234 as
|
443
|
+
* "1.234E3".
|
444
|
+
*
|
445
|
+
* <ul>
|
446
|
+
* <li>The number of digit characters after the exponent character gives the
|
447
|
+
* minimum exponent digit count. There is no maximum. Negative exponents are
|
448
|
+
* formatted using the localized minus sign, <em>not</em> the prefix and suffix
|
449
|
+
* from the pattern. This allows patterns such as "0.###E0 m/s". To prefix
|
450
|
+
* positive exponents with a localized plus sign, specify '+' between the
|
451
|
+
* exponent and the digits: "0.###E+0" will produce formats "1E+1", "1E+0",
|
452
|
+
* "1E-1", etc. (In localized patterns, use the localized plus sign rather than
|
453
|
+
* '+'.)
|
454
|
+
*
|
455
|
+
* <li>The minimum number of integer digits is achieved by adjusting the
|
456
|
+
* exponent. Example: 0.00123 formatted with "00.###E0" yields "12.3E-4". This
|
457
|
+
* only happens if there is no maximum number of integer digits. If there is a
|
458
|
+
* maximum, then the minimum number of integer digits is fixed at one.
|
459
|
+
*
|
460
|
+
* <li>The maximum number of integer digits, if present, specifies the exponent
|
461
|
+
* grouping. The most common use of this is to generate <em>engineering
|
462
|
+
* notation</em>, in which the exponent is a multiple of three, e.g.,
|
463
|
+
* "##0.###E0". The number 12345 is formatted using "##0.####E0" as "12.345E3".
|
464
|
+
*
|
465
|
+
* <li>When using scientific notation, the formatter controls the
|
466
|
+
* digit counts using significant digits logic. The maximum number of
|
467
|
+
* significant digits limits the total number of integer and fraction
|
468
|
+
* digits that will be shown in the mantissa; it does not affect
|
469
|
+
* parsing. For example, 12345 formatted with "##0.##E0" is "12.3E3".
|
470
|
+
* See the section on significant digits for more details.
|
471
|
+
*
|
472
|
+
* <li>The number of significant digits shown is determined as
|
473
|
+
* follows: If areSignificantDigitsUsed() returns false, then the
|
474
|
+
* minimum number of significant digits shown is one, and the maximum
|
475
|
+
* number of significant digits shown is the sum of the <em>minimum
|
476
|
+
* integer</em> and <em>maximum fraction</em> digits, and is
|
477
|
+
* unaffected by the maximum integer digits. If this sum is zero,
|
478
|
+
* then all significant digits are shown. If
|
479
|
+
* areSignificantDigitsUsed() returns true, then the significant digit
|
480
|
+
* counts are specified by getMinimumSignificantDigits() and
|
481
|
+
* getMaximumSignificantDigits(). In this case, the number of
|
482
|
+
* integer digits is fixed at one, and there is no exponent grouping.
|
483
|
+
*
|
484
|
+
* <li>Exponential patterns may not contain grouping separators.
|
485
|
+
* </ul>
|
486
|
+
*
|
487
|
+
* <a name="sigdig"><strong>Significant Digits</strong></a>
|
488
|
+
*
|
489
|
+
* <code>DecimalFormat</code> has two ways of controlling how many
|
490
|
+
* digits are shows: (a) significant digits counts, or (b) integer and
|
491
|
+
* fraction digit counts. Integer and fraction digit counts are
|
492
|
+
* described above. When a formatter is using significant digits
|
493
|
+
* counts, the number of integer and fraction digits is not specified
|
494
|
+
* directly, and the formatter settings for these counts are ignored.
|
495
|
+
* Instead, the formatter uses however many integer and fraction
|
496
|
+
* digits are required to display the specified number of significant
|
497
|
+
* digits. Examples:
|
498
|
+
*
|
499
|
+
* <table border=0 cellspacing=3 cellpadding=0>
|
500
|
+
* <tr bgcolor="#ccccff">
|
501
|
+
* <td align=left>Pattern
|
502
|
+
* <td align=left>Minimum significant digits
|
503
|
+
* <td align=left>Maximum significant digits
|
504
|
+
* <td align=left>Number
|
505
|
+
* <td align=left>Output of format()
|
506
|
+
* <tr valign=top>
|
507
|
+
* <td><code>\@\@\@</code>
|
508
|
+
* <td>3
|
509
|
+
* <td>3
|
510
|
+
* <td>12345
|
511
|
+
* <td><code>12300</code>
|
512
|
+
* <tr valign=top bgcolor="#eeeeff">
|
513
|
+
* <td><code>\@\@\@</code>
|
514
|
+
* <td>3
|
515
|
+
* <td>3
|
516
|
+
* <td>0.12345
|
517
|
+
* <td><code>0.123</code>
|
518
|
+
* <tr valign=top>
|
519
|
+
* <td><code>\@\@##</code>
|
520
|
+
* <td>2
|
521
|
+
* <td>4
|
522
|
+
* <td>3.14159
|
523
|
+
* <td><code>3.142</code>
|
524
|
+
* <tr valign=top bgcolor="#eeeeff">
|
525
|
+
* <td><code>\@\@##</code>
|
526
|
+
* <td>2
|
527
|
+
* <td>4
|
528
|
+
* <td>1.23004
|
529
|
+
* <td><code>1.23</code>
|
530
|
+
* </table>
|
531
|
+
*
|
532
|
+
* <ul>
|
533
|
+
* <li>Significant digit counts may be expressed using patterns that
|
534
|
+
* specify a minimum and maximum number of significant digits. These
|
535
|
+
* are indicated by the <code>'@'</code> and <code>'#'</code>
|
536
|
+
* characters. The minimum number of significant digits is the number
|
537
|
+
* of <code>'@'</code> characters. The maximum number of significant
|
538
|
+
* digits is the number of <code>'@'</code> characters plus the number
|
539
|
+
* of <code>'#'</code> characters following on the right. For
|
540
|
+
* example, the pattern <code>"@@@"</code> indicates exactly 3
|
541
|
+
* significant digits. The pattern <code>"@##"</code> indicates from
|
542
|
+
* 1 to 3 significant digits. Trailing zero digits to the right of
|
543
|
+
* the decimal separator are suppressed after the minimum number of
|
544
|
+
* significant digits have been shown. For example, the pattern
|
545
|
+
* <code>"@##"</code> formats the number 0.1203 as
|
546
|
+
* <code>"0.12"</code>.
|
547
|
+
*
|
548
|
+
* <li>If a pattern uses significant digits, it may not contain a
|
549
|
+
* decimal separator, nor the <code>'0'</code> pattern character.
|
550
|
+
* Patterns such as <code>"@00"</code> or <code>"@.###"</code> are
|
551
|
+
* disallowed.
|
552
|
+
*
|
553
|
+
* <li>Any number of <code>'#'</code> characters may be prepended to
|
554
|
+
* the left of the leftmost <code>'@'</code> character. These have no
|
555
|
+
* effect on the minimum and maximum significant digits counts, but
|
556
|
+
* may be used to position grouping separators. For example,
|
557
|
+
* <code>"#,#@#"</code> indicates a minimum of one significant digits,
|
558
|
+
* a maximum of two significant digits, and a grouping size of three.
|
559
|
+
*
|
560
|
+
* <li>In order to enable significant digits formatting, use a pattern
|
561
|
+
* containing the <code>'@'</code> pattern character. Alternatively,
|
562
|
+
* call setSignificantDigitsUsed(TRUE).
|
563
|
+
*
|
564
|
+
* <li>In order to disable significant digits formatting, use a
|
565
|
+
* pattern that does not contain the <code>'@'</code> pattern
|
566
|
+
* character. Alternatively, call setSignificantDigitsUsed(FALSE).
|
567
|
+
*
|
568
|
+
* <li>The number of significant digits has no effect on parsing.
|
569
|
+
*
|
570
|
+
* <li>Significant digits may be used together with exponential notation. Such
|
571
|
+
* patterns are equivalent to a normal exponential pattern with a minimum and
|
572
|
+
* maximum integer digit count of one, a minimum fraction digit count of
|
573
|
+
* <code>getMinimumSignificantDigits() - 1</code>, and a maximum fraction digit
|
574
|
+
* count of <code>getMaximumSignificantDigits() - 1</code>. For example, the
|
575
|
+
* pattern <code>"@@###E0"</code> is equivalent to <code>"0.0###E0"</code>.
|
576
|
+
*
|
577
|
+
* <li>If signficant digits are in use, then the integer and fraction
|
578
|
+
* digit counts, as set via the API, are ignored. If significant
|
579
|
+
* digits are not in use, then the signficant digit counts, as set via
|
580
|
+
* the API, are ignored.
|
581
|
+
*
|
582
|
+
* </ul>
|
583
|
+
*
|
584
|
+
* <p><strong>Padding</strong>
|
585
|
+
*
|
586
|
+
* <p>DecimalFormat supports padding the result of
|
587
|
+
* format() to a specific width. Padding may be specified either
|
588
|
+
* through the API or through the pattern syntax. In a pattern the pad escape
|
589
|
+
* character, followed by a single pad character, causes padding to be parsed
|
590
|
+
* and formatted. The pad escape character is '*' in unlocalized patterns, and
|
591
|
+
* can be localized using DecimalFormatSymbols::setSymbol() with a
|
592
|
+
* DecimalFormatSymbols::kPadEscapeSymbol
|
593
|
+
* selector. For example, <code>"$*x#,##0.00"</code> formats 123 to
|
594
|
+
* <code>"$xx123.00"</code>, and 1234 to <code>"$1,234.00"</code>.
|
595
|
+
*
|
596
|
+
* <ul>
|
597
|
+
* <li>When padding is in effect, the width of the positive subpattern,
|
598
|
+
* including prefix and suffix, determines the format width. For example, in
|
599
|
+
* the pattern <code>"* #0 o''clock"</code>, the format width is 10.
|
600
|
+
*
|
601
|
+
* <li>The width is counted in 16-bit code units (UChars).
|
602
|
+
*
|
603
|
+
* <li>Some parameters which usually do not matter have meaning when padding is
|
604
|
+
* used, because the pattern width is significant with padding. In the pattern
|
605
|
+
* "* ##,##,#,##0.##", the format width is 14. The initial characters "##,##,"
|
606
|
+
* do not affect the grouping size or maximum integer digits, but they do affect
|
607
|
+
* the format width.
|
608
|
+
*
|
609
|
+
* <li>Padding may be inserted at one of four locations: before the prefix,
|
610
|
+
* after the prefix, before the suffix, or after the suffix. If padding is
|
611
|
+
* specified in any other location, applyPattern()
|
612
|
+
* sets a failing UErrorCode. If there is no prefix,
|
613
|
+
* before the prefix and after the prefix are equivalent, likewise for the
|
614
|
+
* suffix.
|
615
|
+
*
|
616
|
+
* <li>When specified in a pattern, the 32-bit code point immediately
|
617
|
+
* following the pad escape is the pad character. This may be any character,
|
618
|
+
* including a special pattern character. That is, the pad escape
|
619
|
+
* <em>escapes</em> the following character. If there is no character after
|
620
|
+
* the pad escape, then the pattern is illegal.
|
621
|
+
*
|
622
|
+
* </ul>
|
623
|
+
*
|
624
|
+
* <p><strong>Rounding</strong>
|
625
|
+
*
|
626
|
+
* <p>DecimalFormat supports rounding to a specific increment. For
|
627
|
+
* example, 1230 rounded to the nearest 50 is 1250. 1.234 rounded to the
|
628
|
+
* nearest 0.65 is 1.3. The rounding increment may be specified through the API
|
629
|
+
* or in a pattern. To specify a rounding increment in a pattern, include the
|
630
|
+
* increment in the pattern itself. "#,#50" specifies a rounding increment of
|
631
|
+
* 50. "#,##0.05" specifies a rounding increment of 0.05.
|
632
|
+
*
|
633
|
+
* <p>In the absense of an explicit rounding increment numbers are
|
634
|
+
* rounded to their formatted width.
|
635
|
+
*
|
636
|
+
* <ul>
|
637
|
+
* <li>Rounding only affects the string produced by formatting. It does
|
638
|
+
* not affect parsing or change any numerical values.
|
639
|
+
*
|
640
|
+
* <li>A <em>rounding mode</em> determines how values are rounded; see
|
641
|
+
* DecimalFormat::ERoundingMode. The default rounding mode is
|
642
|
+
* DecimalFormat::kRoundHalfEven. The rounding mode can only be set
|
643
|
+
* through the API; it can not be set with a pattern.
|
644
|
+
*
|
645
|
+
* <li>Some locales use rounding in their currency formats to reflect the
|
646
|
+
* smallest currency denomination.
|
647
|
+
*
|
648
|
+
* <li>In a pattern, digits '1' through '9' specify rounding, but otherwise
|
649
|
+
* behave identically to digit '0'.
|
650
|
+
* </ul>
|
651
|
+
*
|
652
|
+
* <p><strong>Synchronization</strong>
|
653
|
+
*
|
654
|
+
* <p>DecimalFormat objects are not synchronized. Multiple
|
655
|
+
* threads should not access one formatter concurrently.
|
656
|
+
*
|
657
|
+
* <p><strong>Subclassing</strong>
|
658
|
+
*
|
659
|
+
* <p><em>User subclasses are not supported.</em> While clients may write
|
660
|
+
* subclasses, such code will not necessarily work and will not be
|
661
|
+
* guaranteed to work stably from release to release.
|
662
|
+
*/
|
663
|
+
class U_I18N_API DecimalFormat: public NumberFormat {
|
664
|
+
public:
|
665
|
+
/**
|
666
|
+
* Rounding mode.
|
667
|
+
* @stable ICU 2.4
|
668
|
+
*/
|
669
|
+
enum ERoundingMode {
|
670
|
+
kRoundCeiling, /**< Round towards positive infinity */
|
671
|
+
kRoundFloor, /**< Round towards negative infinity */
|
672
|
+
kRoundDown, /**< Round towards zero */
|
673
|
+
kRoundUp, /**< Round away from zero */
|
674
|
+
kRoundHalfEven, /**< Round towards the nearest integer, or
|
675
|
+
towards the nearest even integer if equidistant */
|
676
|
+
kRoundHalfDown, /**< Round towards the nearest integer, or
|
677
|
+
towards zero if equidistant */
|
678
|
+
kRoundHalfUp, /**< Round towards the nearest integer, or
|
679
|
+
away from zero if equidistant */
|
680
|
+
/**
|
681
|
+
* Return U_FORMAT_INEXACT_ERROR if number does not format exactly.
|
682
|
+
* @stable ICU 4.8
|
683
|
+
*/
|
684
|
+
kRoundUnnecessary
|
685
|
+
};
|
686
|
+
|
687
|
+
/**
|
688
|
+
* Pad position.
|
689
|
+
* @stable ICU 2.4
|
690
|
+
*/
|
691
|
+
enum EPadPosition {
|
692
|
+
kPadBeforePrefix,
|
693
|
+
kPadAfterPrefix,
|
694
|
+
kPadBeforeSuffix,
|
695
|
+
kPadAfterSuffix
|
696
|
+
};
|
697
|
+
|
698
|
+
/**
|
699
|
+
* Create a DecimalFormat using the default pattern and symbols
|
700
|
+
* for the default locale. This is a convenient way to obtain a
|
701
|
+
* DecimalFormat when internationalization is not the main concern.
|
702
|
+
* <P>
|
703
|
+
* To obtain standard formats for a given locale, use the factory methods
|
704
|
+
* on NumberFormat such as createInstance. These factories will
|
705
|
+
* return the most appropriate sub-class of NumberFormat for a given
|
706
|
+
* locale.
|
707
|
+
* @param status Output param set to success/failure code. If the
|
708
|
+
* pattern is invalid this will be set to a failure code.
|
709
|
+
* @stable ICU 2.0
|
710
|
+
*/
|
711
|
+
DecimalFormat(UErrorCode& status);
|
712
|
+
|
713
|
+
/**
|
714
|
+
* Create a DecimalFormat from the given pattern and the symbols
|
715
|
+
* for the default locale. This is a convenient way to obtain a
|
716
|
+
* DecimalFormat when internationalization is not the main concern.
|
717
|
+
* <P>
|
718
|
+
* To obtain standard formats for a given locale, use the factory methods
|
719
|
+
* on NumberFormat such as createInstance. These factories will
|
720
|
+
* return the most appropriate sub-class of NumberFormat for a given
|
721
|
+
* locale.
|
722
|
+
* @param pattern A non-localized pattern string.
|
723
|
+
* @param status Output param set to success/failure code. If the
|
724
|
+
* pattern is invalid this will be set to a failure code.
|
725
|
+
* @stable ICU 2.0
|
726
|
+
*/
|
727
|
+
DecimalFormat(const UnicodeString& pattern,
|
728
|
+
UErrorCode& status);
|
729
|
+
|
730
|
+
/**
|
731
|
+
* Create a DecimalFormat from the given pattern and symbols.
|
732
|
+
* Use this constructor when you need to completely customize the
|
733
|
+
* behavior of the format.
|
734
|
+
* <P>
|
735
|
+
* To obtain standard formats for a given
|
736
|
+
* locale, use the factory methods on NumberFormat such as
|
737
|
+
* createInstance or createCurrencyInstance. If you need only minor adjustments
|
738
|
+
* to a standard format, you can modify the format returned by
|
739
|
+
* a NumberFormat factory method.
|
740
|
+
*
|
741
|
+
* @param pattern a non-localized pattern string
|
742
|
+
* @param symbolsToAdopt the set of symbols to be used. The caller should not
|
743
|
+
* delete this object after making this call.
|
744
|
+
* @param status Output param set to success/failure code. If the
|
745
|
+
* pattern is invalid this will be set to a failure code.
|
746
|
+
* @stable ICU 2.0
|
747
|
+
*/
|
748
|
+
DecimalFormat( const UnicodeString& pattern,
|
749
|
+
DecimalFormatSymbols* symbolsToAdopt,
|
750
|
+
UErrorCode& status);
|
751
|
+
|
752
|
+
#ifndef U_HIDE_INTERNAL_API
|
753
|
+
/**
|
754
|
+
* This API is for ICU use only.
|
755
|
+
* Create a DecimalFormat from the given pattern, symbols, and style.
|
756
|
+
*
|
757
|
+
* @param pattern a non-localized pattern string
|
758
|
+
* @param symbolsToAdopt the set of symbols to be used. The caller should not
|
759
|
+
* delete this object after making this call.
|
760
|
+
* @param style style of decimal format
|
761
|
+
* @param status Output param set to success/failure code. If the
|
762
|
+
* pattern is invalid this will be set to a failure code.
|
763
|
+
* @internal
|
764
|
+
*/
|
765
|
+
DecimalFormat( const UnicodeString& pattern,
|
766
|
+
DecimalFormatSymbols* symbolsToAdopt,
|
767
|
+
UNumberFormatStyle style,
|
768
|
+
UErrorCode& status);
|
769
|
+
|
770
|
+
#if UCONFIG_HAVE_PARSEALLINPUT
|
771
|
+
/**
|
772
|
+
* @internal
|
773
|
+
*/
|
774
|
+
void setParseAllInput(UNumberFormatAttributeValue value);
|
775
|
+
#endif
|
776
|
+
|
777
|
+
#endif /* U_HIDE_INTERNAL_API */
|
778
|
+
|
779
|
+
|
780
|
+
/**
|
781
|
+
* Set an integer attribute on this DecimalFormat.
|
782
|
+
* May return U_UNSUPPORTED_ERROR if this instance does not support
|
783
|
+
* the specified attribute.
|
784
|
+
* @param attr the attribute to set
|
785
|
+
* @param newvalue new value
|
786
|
+
* @param status the error type
|
787
|
+
* @return *this - for chaining (example: format.setAttribute(...).setAttribute(...) )
|
788
|
+
* @stable ICU 51
|
789
|
+
*/
|
790
|
+
virtual DecimalFormat& setAttribute( UNumberFormatAttribute attr,
|
791
|
+
int32_t newvalue,
|
792
|
+
UErrorCode &status);
|
793
|
+
|
794
|
+
/**
|
795
|
+
* Get an integer
|
796
|
+
* May return U_UNSUPPORTED_ERROR if this instance does not support
|
797
|
+
* the specified attribute.
|
798
|
+
* @param attr the attribute to set
|
799
|
+
* @param status the error type
|
800
|
+
* @return the attribute value. Undefined if there is an error.
|
801
|
+
* @stable ICU 51
|
802
|
+
*/
|
803
|
+
virtual int32_t getAttribute( UNumberFormatAttribute attr,
|
804
|
+
UErrorCode &status) const;
|
805
|
+
|
806
|
+
|
807
|
+
/**
|
808
|
+
* Set whether or not grouping will be used in this format.
|
809
|
+
* @param newValue True, grouping will be used in this format.
|
810
|
+
* @see getGroupingUsed
|
811
|
+
* @draft ICU 53
|
812
|
+
*/
|
813
|
+
virtual void setGroupingUsed(UBool newValue);
|
814
|
+
|
815
|
+
/**
|
816
|
+
* Sets whether or not numbers should be parsed as integers only.
|
817
|
+
* @param value set True, this format will parse numbers as integers
|
818
|
+
* only.
|
819
|
+
* @see isParseIntegerOnly
|
820
|
+
* @draft ICU 53
|
821
|
+
*/
|
822
|
+
virtual void setParseIntegerOnly(UBool value);
|
823
|
+
|
824
|
+
/* Cannot use #ifndef U_HIDE_DRAFT_API for the following draft method since it is virtual */
|
825
|
+
/**
|
826
|
+
* Set a particular UDisplayContext value in the formatter, such as
|
827
|
+
* UDISPCTX_CAPITALIZATION_FOR_STANDALONE.
|
828
|
+
* @param value The UDisplayContext value to set.
|
829
|
+
* @param status Input/output status. If at entry this indicates a failure
|
830
|
+
* status, the function will do nothing; otherwise this will be
|
831
|
+
* updated with any new status from the function.
|
832
|
+
* @draft ICU 53
|
833
|
+
*/
|
834
|
+
virtual void setContext(UDisplayContext value, UErrorCode& status);
|
835
|
+
|
836
|
+
/**
|
837
|
+
* Create a DecimalFormat from the given pattern and symbols.
|
838
|
+
* Use this constructor when you need to completely customize the
|
839
|
+
* behavior of the format.
|
840
|
+
* <P>
|
841
|
+
* To obtain standard formats for a given
|
842
|
+
* locale, use the factory methods on NumberFormat such as
|
843
|
+
* createInstance or createCurrencyInstance. If you need only minor adjustments
|
844
|
+
* to a standard format, you can modify the format returned by
|
845
|
+
* a NumberFormat factory method.
|
846
|
+
*
|
847
|
+
* @param pattern a non-localized pattern string
|
848
|
+
* @param symbolsToAdopt the set of symbols to be used. The caller should not
|
849
|
+
* delete this object after making this call.
|
850
|
+
* @param parseError Output param to receive errors occured during parsing
|
851
|
+
* @param status Output param set to success/failure code. If the
|
852
|
+
* pattern is invalid this will be set to a failure code.
|
853
|
+
* @stable ICU 2.0
|
854
|
+
*/
|
855
|
+
DecimalFormat( const UnicodeString& pattern,
|
856
|
+
DecimalFormatSymbols* symbolsToAdopt,
|
857
|
+
UParseError& parseError,
|
858
|
+
UErrorCode& status);
|
859
|
+
/**
|
860
|
+
* Create a DecimalFormat from the given pattern and symbols.
|
861
|
+
* Use this constructor when you need to completely customize the
|
862
|
+
* behavior of the format.
|
863
|
+
* <P>
|
864
|
+
* To obtain standard formats for a given
|
865
|
+
* locale, use the factory methods on NumberFormat such as
|
866
|
+
* createInstance or createCurrencyInstance. If you need only minor adjustments
|
867
|
+
* to a standard format, you can modify the format returned by
|
868
|
+
* a NumberFormat factory method.
|
869
|
+
*
|
870
|
+
* @param pattern a non-localized pattern string
|
871
|
+
* @param symbols the set of symbols to be used
|
872
|
+
* @param status Output param set to success/failure code. If the
|
873
|
+
* pattern is invalid this will be set to a failure code.
|
874
|
+
* @stable ICU 2.0
|
875
|
+
*/
|
876
|
+
DecimalFormat( const UnicodeString& pattern,
|
877
|
+
const DecimalFormatSymbols& symbols,
|
878
|
+
UErrorCode& status);
|
879
|
+
|
880
|
+
/**
|
881
|
+
* Copy constructor.
|
882
|
+
*
|
883
|
+
* @param source the DecimalFormat object to be copied from.
|
884
|
+
* @stable ICU 2.0
|
885
|
+
*/
|
886
|
+
DecimalFormat(const DecimalFormat& source);
|
887
|
+
|
888
|
+
/**
|
889
|
+
* Assignment operator.
|
890
|
+
*
|
891
|
+
* @param rhs the DecimalFormat object to be copied.
|
892
|
+
* @stable ICU 2.0
|
893
|
+
*/
|
894
|
+
DecimalFormat& operator=(const DecimalFormat& rhs);
|
895
|
+
|
896
|
+
/**
|
897
|
+
* Destructor.
|
898
|
+
* @stable ICU 2.0
|
899
|
+
*/
|
900
|
+
virtual ~DecimalFormat();
|
901
|
+
|
902
|
+
/**
|
903
|
+
* Clone this Format object polymorphically. The caller owns the
|
904
|
+
* result and should delete it when done.
|
905
|
+
*
|
906
|
+
* @return a polymorphic copy of this DecimalFormat.
|
907
|
+
* @stable ICU 2.0
|
908
|
+
*/
|
909
|
+
virtual Format* clone(void) const;
|
910
|
+
|
911
|
+
/**
|
912
|
+
* Return true if the given Format objects are semantically equal.
|
913
|
+
* Objects of different subclasses are considered unequal.
|
914
|
+
*
|
915
|
+
* @param other the object to be compared with.
|
916
|
+
* @return true if the given Format objects are semantically equal.
|
917
|
+
* @stable ICU 2.0
|
918
|
+
*/
|
919
|
+
virtual UBool operator==(const Format& other) const;
|
920
|
+
|
921
|
+
|
922
|
+
using NumberFormat::format;
|
923
|
+
|
924
|
+
/**
|
925
|
+
* Format a double or long number using base-10 representation.
|
926
|
+
*
|
927
|
+
* @param number The value to be formatted.
|
928
|
+
* @param appendTo Output parameter to receive result.
|
929
|
+
* Result is appended to existing contents.
|
930
|
+
* @param pos On input: an alignment field, if desired.
|
931
|
+
* On output: the offsets of the alignment field.
|
932
|
+
* @return Reference to 'appendTo' parameter.
|
933
|
+
* @stable ICU 2.0
|
934
|
+
*/
|
935
|
+
virtual UnicodeString& format(double number,
|
936
|
+
UnicodeString& appendTo,
|
937
|
+
FieldPosition& pos) const;
|
938
|
+
|
939
|
+
|
940
|
+
/**
|
941
|
+
* Format a double or long number using base-10 representation.
|
942
|
+
*
|
943
|
+
* @param number The value to be formatted.
|
944
|
+
* @param appendTo Output parameter to receive result.
|
945
|
+
* Result is appended to existing contents.
|
946
|
+
* @param pos On input: an alignment field, if desired.
|
947
|
+
* On output: the offsets of the alignment field.
|
948
|
+
* @param status
|
949
|
+
* @return Reference to 'appendTo' parameter.
|
950
|
+
* @internal
|
951
|
+
*/
|
952
|
+
virtual UnicodeString& format(double number,
|
953
|
+
UnicodeString& appendTo,
|
954
|
+
FieldPosition& pos,
|
955
|
+
UErrorCode &status) const;
|
956
|
+
|
957
|
+
/**
|
958
|
+
* Format a double or long number using base-10 representation.
|
959
|
+
*
|
960
|
+
* @param number The value to be formatted.
|
961
|
+
* @param appendTo Output parameter to receive result.
|
962
|
+
* Result is appended to existing contents.
|
963
|
+
* @param posIter On return, can be used to iterate over positions
|
964
|
+
* of fields generated by this format call.
|
965
|
+
* Can be NULL.
|
966
|
+
* @param status Output param filled with success/failure status.
|
967
|
+
* @return Reference to 'appendTo' parameter.
|
968
|
+
* @stable 4.4
|
969
|
+
*/
|
970
|
+
virtual UnicodeString& format(double number,
|
971
|
+
UnicodeString& appendTo,
|
972
|
+
FieldPositionIterator* posIter,
|
973
|
+
UErrorCode& status) const;
|
974
|
+
|
975
|
+
/**
|
976
|
+
* Format a long number using base-10 representation.
|
977
|
+
*
|
978
|
+
* @param number The value to be formatted.
|
979
|
+
* @param appendTo Output parameter to receive result.
|
980
|
+
* Result is appended to existing contents.
|
981
|
+
* @param pos On input: an alignment field, if desired.
|
982
|
+
* On output: the offsets of the alignment field.
|
983
|
+
* @return Reference to 'appendTo' parameter.
|
984
|
+
* @stable ICU 2.0
|
985
|
+
*/
|
986
|
+
virtual UnicodeString& format(int32_t number,
|
987
|
+
UnicodeString& appendTo,
|
988
|
+
FieldPosition& pos) const;
|
989
|
+
|
990
|
+
/**
|
991
|
+
* Format a long number using base-10 representation.
|
992
|
+
*
|
993
|
+
* @param number The value to be formatted.
|
994
|
+
* @param appendTo Output parameter to receive result.
|
995
|
+
* Result is appended to existing contents.
|
996
|
+
* @param pos On input: an alignment field, if desired.
|
997
|
+
* On output: the offsets of the alignment field.
|
998
|
+
* @return Reference to 'appendTo' parameter.
|
999
|
+
* @internal
|
1000
|
+
*/
|
1001
|
+
virtual UnicodeString& format(int32_t number,
|
1002
|
+
UnicodeString& appendTo,
|
1003
|
+
FieldPosition& pos,
|
1004
|
+
UErrorCode &status) const;
|
1005
|
+
|
1006
|
+
/**
|
1007
|
+
* Format a long number using base-10 representation.
|
1008
|
+
*
|
1009
|
+
* @param number The value to be formatted.
|
1010
|
+
* @param appendTo Output parameter to receive result.
|
1011
|
+
* Result is appended to existing contents.
|
1012
|
+
* @param posIter On return, can be used to iterate over positions
|
1013
|
+
* of fields generated by this format call.
|
1014
|
+
* Can be NULL.
|
1015
|
+
* @param status Output param filled with success/failure status.
|
1016
|
+
* @return Reference to 'appendTo' parameter.
|
1017
|
+
* @stable 4.4
|
1018
|
+
*/
|
1019
|
+
virtual UnicodeString& format(int32_t number,
|
1020
|
+
UnicodeString& appendTo,
|
1021
|
+
FieldPositionIterator* posIter,
|
1022
|
+
UErrorCode& status) const;
|
1023
|
+
|
1024
|
+
/**
|
1025
|
+
* Format an int64 number using base-10 representation.
|
1026
|
+
*
|
1027
|
+
* @param number The value to be formatted.
|
1028
|
+
* @param appendTo Output parameter to receive result.
|
1029
|
+
* Result is appended to existing contents.
|
1030
|
+
* @param pos On input: an alignment field, if desired.
|
1031
|
+
* On output: the offsets of the alignment field.
|
1032
|
+
* @return Reference to 'appendTo' parameter.
|
1033
|
+
* @stable ICU 2.8
|
1034
|
+
*/
|
1035
|
+
virtual UnicodeString& format(int64_t number,
|
1036
|
+
UnicodeString& appendTo,
|
1037
|
+
FieldPosition& pos) const;
|
1038
|
+
|
1039
|
+
/**
|
1040
|
+
* Format an int64 number using base-10 representation.
|
1041
|
+
*
|
1042
|
+
* @param number The value to be formatted.
|
1043
|
+
* @param appendTo Output parameter to receive result.
|
1044
|
+
* Result is appended to existing contents.
|
1045
|
+
* @param pos On input: an alignment field, if desired.
|
1046
|
+
* On output: the offsets of the alignment field.
|
1047
|
+
* @return Reference to 'appendTo' parameter.
|
1048
|
+
* @internal
|
1049
|
+
*/
|
1050
|
+
virtual UnicodeString& format(int64_t number,
|
1051
|
+
UnicodeString& appendTo,
|
1052
|
+
FieldPosition& pos,
|
1053
|
+
UErrorCode &status) const;
|
1054
|
+
|
1055
|
+
/**
|
1056
|
+
* Format an int64 number using base-10 representation.
|
1057
|
+
*
|
1058
|
+
* @param number The value to be formatted.
|
1059
|
+
* @param appendTo Output parameter to receive result.
|
1060
|
+
* Result is appended to existing contents.
|
1061
|
+
* @param posIter On return, can be used to iterate over positions
|
1062
|
+
* of fields generated by this format call.
|
1063
|
+
* Can be NULL.
|
1064
|
+
* @param status Output param filled with success/failure status.
|
1065
|
+
* @return Reference to 'appendTo' parameter.
|
1066
|
+
* @stable 4.4
|
1067
|
+
*/
|
1068
|
+
virtual UnicodeString& format(int64_t number,
|
1069
|
+
UnicodeString& appendTo,
|
1070
|
+
FieldPositionIterator* posIter,
|
1071
|
+
UErrorCode& status) const;
|
1072
|
+
|
1073
|
+
/**
|
1074
|
+
* Format a decimal number.
|
1075
|
+
* The syntax of the unformatted number is a "numeric string"
|
1076
|
+
* as defined in the Decimal Arithmetic Specification, available at
|
1077
|
+
* http://speleotrove.com/decimal
|
1078
|
+
*
|
1079
|
+
* @param number The unformatted number, as a string.
|
1080
|
+
* @param appendTo Output parameter to receive result.
|
1081
|
+
* Result is appended to existing contents.
|
1082
|
+
* @param posIter On return, can be used to iterate over positions
|
1083
|
+
* of fields generated by this format call.
|
1084
|
+
* Can be NULL.
|
1085
|
+
* @param status Output param filled with success/failure status.
|
1086
|
+
* @return Reference to 'appendTo' parameter.
|
1087
|
+
* @stable 4.4
|
1088
|
+
*/
|
1089
|
+
virtual UnicodeString& format(const StringPiece &number,
|
1090
|
+
UnicodeString& appendTo,
|
1091
|
+
FieldPositionIterator* posIter,
|
1092
|
+
UErrorCode& status) const;
|
1093
|
+
|
1094
|
+
|
1095
|
+
/**
|
1096
|
+
* Format a decimal number.
|
1097
|
+
* The number is a DigitList wrapper onto a floating point decimal number.
|
1098
|
+
* The default implementation in NumberFormat converts the decimal number
|
1099
|
+
* to a double and formats that.
|
1100
|
+
*
|
1101
|
+
* @param number The number, a DigitList format Decimal Floating Point.
|
1102
|
+
* @param appendTo Output parameter to receive result.
|
1103
|
+
* Result is appended to existing contents.
|
1104
|
+
* @param posIter On return, can be used to iterate over positions
|
1105
|
+
* of fields generated by this format call.
|
1106
|
+
* @param status Output param filled with success/failure status.
|
1107
|
+
* @return Reference to 'appendTo' parameter.
|
1108
|
+
* @internal
|
1109
|
+
*/
|
1110
|
+
virtual UnicodeString& format(const DigitList &number,
|
1111
|
+
UnicodeString& appendTo,
|
1112
|
+
FieldPositionIterator* posIter,
|
1113
|
+
UErrorCode& status) const;
|
1114
|
+
|
1115
|
+
/**
|
1116
|
+
* Format a decimal number.
|
1117
|
+
* The number is a DigitList wrapper onto a floating point decimal number.
|
1118
|
+
* The default implementation in NumberFormat converts the decimal number
|
1119
|
+
* to a double and formats that.
|
1120
|
+
*
|
1121
|
+
* @param number The number, a DigitList format Decimal Floating Point.
|
1122
|
+
* @param appendTo Output parameter to receive result.
|
1123
|
+
* Result is appended to existing contents.
|
1124
|
+
* @param pos On input: an alignment field, if desired.
|
1125
|
+
* On output: the offsets of the alignment field.
|
1126
|
+
* @param status Output param filled with success/failure status.
|
1127
|
+
* @return Reference to 'appendTo' parameter.
|
1128
|
+
* @internal
|
1129
|
+
*/
|
1130
|
+
virtual UnicodeString& format(const DigitList &number,
|
1131
|
+
UnicodeString& appendTo,
|
1132
|
+
FieldPosition& pos,
|
1133
|
+
UErrorCode& status) const;
|
1134
|
+
|
1135
|
+
using NumberFormat::parse;
|
1136
|
+
|
1137
|
+
/**
|
1138
|
+
* Parse the given string using this object's choices. The method
|
1139
|
+
* does string comparisons to try to find an optimal match.
|
1140
|
+
* If no object can be parsed, index is unchanged, and NULL is
|
1141
|
+
* returned. The result is returned as the most parsimonious
|
1142
|
+
* type of Formattable that will accomodate all of the
|
1143
|
+
* necessary precision. For example, if the result is exactly 12,
|
1144
|
+
* it will be returned as a long. However, if it is 1.5, it will
|
1145
|
+
* be returned as a double.
|
1146
|
+
*
|
1147
|
+
* @param text The text to be parsed.
|
1148
|
+
* @param result Formattable to be set to the parse result.
|
1149
|
+
* If parse fails, return contents are undefined.
|
1150
|
+
* @param parsePosition The position to start parsing at on input.
|
1151
|
+
* On output, moved to after the last successfully
|
1152
|
+
* parse character. On parse failure, does not change.
|
1153
|
+
* @see Formattable
|
1154
|
+
* @stable ICU 2.0
|
1155
|
+
*/
|
1156
|
+
virtual void parse(const UnicodeString& text,
|
1157
|
+
Formattable& result,
|
1158
|
+
ParsePosition& parsePosition) const;
|
1159
|
+
|
1160
|
+
/**
|
1161
|
+
* Parses text from the given string as a currency amount. Unlike
|
1162
|
+
* the parse() method, this method will attempt to parse a generic
|
1163
|
+
* currency name, searching for a match of this object's locale's
|
1164
|
+
* currency display names, or for a 3-letter ISO currency code.
|
1165
|
+
* This method will fail if this format is not a currency format,
|
1166
|
+
* that is, if it does not contain the currency pattern symbol
|
1167
|
+
* (U+00A4) in its prefix or suffix.
|
1168
|
+
*
|
1169
|
+
* @param text the string to parse
|
1170
|
+
* @param pos input-output position; on input, the position within text
|
1171
|
+
* to match; must have 0 <= pos.getIndex() < text.length();
|
1172
|
+
* on output, the position after the last matched character.
|
1173
|
+
* If the parse fails, the position in unchanged upon output.
|
1174
|
+
* @return if parse succeeds, a pointer to a newly-created CurrencyAmount
|
1175
|
+
* object (owned by the caller) containing information about
|
1176
|
+
* the parsed currency; if parse fails, this is NULL.
|
1177
|
+
* @stable ICU 49
|
1178
|
+
*/
|
1179
|
+
virtual CurrencyAmount* parseCurrency(const UnicodeString& text,
|
1180
|
+
ParsePosition& pos) const;
|
1181
|
+
|
1182
|
+
/**
|
1183
|
+
* Returns the decimal format symbols, which is generally not changed
|
1184
|
+
* by the programmer or user.
|
1185
|
+
* @return desired DecimalFormatSymbols
|
1186
|
+
* @see DecimalFormatSymbols
|
1187
|
+
* @stable ICU 2.0
|
1188
|
+
*/
|
1189
|
+
virtual const DecimalFormatSymbols* getDecimalFormatSymbols(void) const;
|
1190
|
+
|
1191
|
+
/**
|
1192
|
+
* Sets the decimal format symbols, which is generally not changed
|
1193
|
+
* by the programmer or user.
|
1194
|
+
* @param symbolsToAdopt DecimalFormatSymbols to be adopted.
|
1195
|
+
* @stable ICU 2.0
|
1196
|
+
*/
|
1197
|
+
virtual void adoptDecimalFormatSymbols(DecimalFormatSymbols* symbolsToAdopt);
|
1198
|
+
|
1199
|
+
/**
|
1200
|
+
* Sets the decimal format symbols, which is generally not changed
|
1201
|
+
* by the programmer or user.
|
1202
|
+
* @param symbols DecimalFormatSymbols.
|
1203
|
+
* @stable ICU 2.0
|
1204
|
+
*/
|
1205
|
+
virtual void setDecimalFormatSymbols(const DecimalFormatSymbols& symbols);
|
1206
|
+
|
1207
|
+
|
1208
|
+
/**
|
1209
|
+
* Returns the currency plural format information,
|
1210
|
+
* which is generally not changed by the programmer or user.
|
1211
|
+
* @return desired CurrencyPluralInfo
|
1212
|
+
* @stable ICU 4.2
|
1213
|
+
*/
|
1214
|
+
virtual const CurrencyPluralInfo* getCurrencyPluralInfo(void) const;
|
1215
|
+
|
1216
|
+
/**
|
1217
|
+
* Sets the currency plural format information,
|
1218
|
+
* which is generally not changed by the programmer or user.
|
1219
|
+
* @param toAdopt CurrencyPluralInfo to be adopted.
|
1220
|
+
* @stable ICU 4.2
|
1221
|
+
*/
|
1222
|
+
virtual void adoptCurrencyPluralInfo(CurrencyPluralInfo* toAdopt);
|
1223
|
+
|
1224
|
+
/**
|
1225
|
+
* Sets the currency plural format information,
|
1226
|
+
* which is generally not changed by the programmer or user.
|
1227
|
+
* @param info Currency Plural Info.
|
1228
|
+
* @stable ICU 4.2
|
1229
|
+
*/
|
1230
|
+
virtual void setCurrencyPluralInfo(const CurrencyPluralInfo& info);
|
1231
|
+
|
1232
|
+
|
1233
|
+
/**
|
1234
|
+
* Get the positive prefix.
|
1235
|
+
*
|
1236
|
+
* @param result Output param which will receive the positive prefix.
|
1237
|
+
* @return A reference to 'result'.
|
1238
|
+
* Examples: +123, $123, sFr123
|
1239
|
+
* @stable ICU 2.0
|
1240
|
+
*/
|
1241
|
+
UnicodeString& getPositivePrefix(UnicodeString& result) const;
|
1242
|
+
|
1243
|
+
/**
|
1244
|
+
* Set the positive prefix.
|
1245
|
+
*
|
1246
|
+
* @param newValue the new value of the the positive prefix to be set.
|
1247
|
+
* Examples: +123, $123, sFr123
|
1248
|
+
* @stable ICU 2.0
|
1249
|
+
*/
|
1250
|
+
virtual void setPositivePrefix(const UnicodeString& newValue);
|
1251
|
+
|
1252
|
+
/**
|
1253
|
+
* Get the negative prefix.
|
1254
|
+
*
|
1255
|
+
* @param result Output param which will receive the negative prefix.
|
1256
|
+
* @return A reference to 'result'.
|
1257
|
+
* Examples: -123, ($123) (with negative suffix), sFr-123
|
1258
|
+
* @stable ICU 2.0
|
1259
|
+
*/
|
1260
|
+
UnicodeString& getNegativePrefix(UnicodeString& result) const;
|
1261
|
+
|
1262
|
+
/**
|
1263
|
+
* Set the negative prefix.
|
1264
|
+
*
|
1265
|
+
* @param newValue the new value of the the negative prefix to be set.
|
1266
|
+
* Examples: -123, ($123) (with negative suffix), sFr-123
|
1267
|
+
* @stable ICU 2.0
|
1268
|
+
*/
|
1269
|
+
virtual void setNegativePrefix(const UnicodeString& newValue);
|
1270
|
+
|
1271
|
+
/**
|
1272
|
+
* Get the positive suffix.
|
1273
|
+
*
|
1274
|
+
* @param result Output param which will receive the positive suffix.
|
1275
|
+
* @return A reference to 'result'.
|
1276
|
+
* Example: 123%
|
1277
|
+
* @stable ICU 2.0
|
1278
|
+
*/
|
1279
|
+
UnicodeString& getPositiveSuffix(UnicodeString& result) const;
|
1280
|
+
|
1281
|
+
/**
|
1282
|
+
* Set the positive suffix.
|
1283
|
+
*
|
1284
|
+
* @param newValue the new value of the positive suffix to be set.
|
1285
|
+
* Example: 123%
|
1286
|
+
* @stable ICU 2.0
|
1287
|
+
*/
|
1288
|
+
virtual void setPositiveSuffix(const UnicodeString& newValue);
|
1289
|
+
|
1290
|
+
/**
|
1291
|
+
* Get the negative suffix.
|
1292
|
+
*
|
1293
|
+
* @param result Output param which will receive the negative suffix.
|
1294
|
+
* @return A reference to 'result'.
|
1295
|
+
* Examples: -123%, ($123) (with positive suffixes)
|
1296
|
+
* @stable ICU 2.0
|
1297
|
+
*/
|
1298
|
+
UnicodeString& getNegativeSuffix(UnicodeString& result) const;
|
1299
|
+
|
1300
|
+
/**
|
1301
|
+
* Set the negative suffix.
|
1302
|
+
*
|
1303
|
+
* @param newValue the new value of the negative suffix to be set.
|
1304
|
+
* Examples: 123%
|
1305
|
+
* @stable ICU 2.0
|
1306
|
+
*/
|
1307
|
+
virtual void setNegativeSuffix(const UnicodeString& newValue);
|
1308
|
+
|
1309
|
+
/**
|
1310
|
+
* Get the multiplier for use in percent, permill, etc.
|
1311
|
+
* For a percentage, set the suffixes to have "%" and the multiplier to be 100.
|
1312
|
+
* (For Arabic, use arabic percent symbol).
|
1313
|
+
* For a permill, set the suffixes to have "\\u2031" and the multiplier to be 1000.
|
1314
|
+
*
|
1315
|
+
* @return the multiplier for use in percent, permill, etc.
|
1316
|
+
* Examples: with 100, 1.23 -> "123", and "123" -> 1.23
|
1317
|
+
* @stable ICU 2.0
|
1318
|
+
*/
|
1319
|
+
int32_t getMultiplier(void) const;
|
1320
|
+
|
1321
|
+
/**
|
1322
|
+
* Set the multiplier for use in percent, permill, etc.
|
1323
|
+
* For a percentage, set the suffixes to have "%" and the multiplier to be 100.
|
1324
|
+
* (For Arabic, use arabic percent symbol).
|
1325
|
+
* For a permill, set the suffixes to have "\\u2031" and the multiplier to be 1000.
|
1326
|
+
*
|
1327
|
+
* @param newValue the new value of the multiplier for use in percent, permill, etc.
|
1328
|
+
* Examples: with 100, 1.23 -> "123", and "123" -> 1.23
|
1329
|
+
* @stable ICU 2.0
|
1330
|
+
*/
|
1331
|
+
virtual void setMultiplier(int32_t newValue);
|
1332
|
+
|
1333
|
+
/**
|
1334
|
+
* Get the rounding increment.
|
1335
|
+
* @return A positive rounding increment, or 0.0 if a custom rounding
|
1336
|
+
* increment is not in effect.
|
1337
|
+
* @see #setRoundingIncrement
|
1338
|
+
* @see #getRoundingMode
|
1339
|
+
* @see #setRoundingMode
|
1340
|
+
* @stable ICU 2.0
|
1341
|
+
*/
|
1342
|
+
virtual double getRoundingIncrement(void) const;
|
1343
|
+
|
1344
|
+
/**
|
1345
|
+
* Set the rounding increment. In the absence of a rounding increment,
|
1346
|
+
* numbers will be rounded to the number of digits displayed.
|
1347
|
+
* @param newValue A positive rounding increment, or 0.0 to
|
1348
|
+
* use the default rounding increment.
|
1349
|
+
* Negative increments are equivalent to 0.0.
|
1350
|
+
* @see #getRoundingIncrement
|
1351
|
+
* @see #getRoundingMode
|
1352
|
+
* @see #setRoundingMode
|
1353
|
+
* @stable ICU 2.0
|
1354
|
+
*/
|
1355
|
+
virtual void setRoundingIncrement(double newValue);
|
1356
|
+
|
1357
|
+
/**
|
1358
|
+
* Get the rounding mode.
|
1359
|
+
* @return A rounding mode
|
1360
|
+
* @see #setRoundingIncrement
|
1361
|
+
* @see #getRoundingIncrement
|
1362
|
+
* @see #setRoundingMode
|
1363
|
+
* @stable ICU 2.0
|
1364
|
+
*/
|
1365
|
+
virtual ERoundingMode getRoundingMode(void) const;
|
1366
|
+
|
1367
|
+
/**
|
1368
|
+
* Set the rounding mode.
|
1369
|
+
* @param roundingMode A rounding mode
|
1370
|
+
* @see #setRoundingIncrement
|
1371
|
+
* @see #getRoundingIncrement
|
1372
|
+
* @see #getRoundingMode
|
1373
|
+
* @stable ICU 2.0
|
1374
|
+
*/
|
1375
|
+
virtual void setRoundingMode(ERoundingMode roundingMode);
|
1376
|
+
|
1377
|
+
/**
|
1378
|
+
* Get the width to which the output of format() is padded.
|
1379
|
+
* The width is counted in 16-bit code units.
|
1380
|
+
* @return the format width, or zero if no padding is in effect
|
1381
|
+
* @see #setFormatWidth
|
1382
|
+
* @see #getPadCharacterString
|
1383
|
+
* @see #setPadCharacter
|
1384
|
+
* @see #getPadPosition
|
1385
|
+
* @see #setPadPosition
|
1386
|
+
* @stable ICU 2.0
|
1387
|
+
*/
|
1388
|
+
virtual int32_t getFormatWidth(void) const;
|
1389
|
+
|
1390
|
+
/**
|
1391
|
+
* Set the width to which the output of format() is padded.
|
1392
|
+
* The width is counted in 16-bit code units.
|
1393
|
+
* This method also controls whether padding is enabled.
|
1394
|
+
* @param width the width to which to pad the result of
|
1395
|
+
* format(), or zero to disable padding. A negative
|
1396
|
+
* width is equivalent to 0.
|
1397
|
+
* @see #getFormatWidth
|
1398
|
+
* @see #getPadCharacterString
|
1399
|
+
* @see #setPadCharacter
|
1400
|
+
* @see #getPadPosition
|
1401
|
+
* @see #setPadPosition
|
1402
|
+
* @stable ICU 2.0
|
1403
|
+
*/
|
1404
|
+
virtual void setFormatWidth(int32_t width);
|
1405
|
+
|
1406
|
+
/**
|
1407
|
+
* Get the pad character used to pad to the format width. The
|
1408
|
+
* default is ' '.
|
1409
|
+
* @return a string containing the pad character. This will always
|
1410
|
+
* have a length of one 32-bit code point.
|
1411
|
+
* @see #setFormatWidth
|
1412
|
+
* @see #getFormatWidth
|
1413
|
+
* @see #setPadCharacter
|
1414
|
+
* @see #getPadPosition
|
1415
|
+
* @see #setPadPosition
|
1416
|
+
* @stable ICU 2.0
|
1417
|
+
*/
|
1418
|
+
virtual UnicodeString getPadCharacterString() const;
|
1419
|
+
|
1420
|
+
/**
|
1421
|
+
* Set the character used to pad to the format width. If padding
|
1422
|
+
* is not enabled, then this will take effect if padding is later
|
1423
|
+
* enabled.
|
1424
|
+
* @param padChar a string containing the pad charcter. If the string
|
1425
|
+
* has length 0, then the pad characer is set to ' '. Otherwise
|
1426
|
+
* padChar.char32At(0) will be used as the pad character.
|
1427
|
+
* @see #setFormatWidth
|
1428
|
+
* @see #getFormatWidth
|
1429
|
+
* @see #getPadCharacterString
|
1430
|
+
* @see #getPadPosition
|
1431
|
+
* @see #setPadPosition
|
1432
|
+
* @stable ICU 2.0
|
1433
|
+
*/
|
1434
|
+
virtual void setPadCharacter(const UnicodeString &padChar);
|
1435
|
+
|
1436
|
+
/**
|
1437
|
+
* Get the position at which padding will take place. This is the location
|
1438
|
+
* at which padding will be inserted if the result of format()
|
1439
|
+
* is shorter than the format width.
|
1440
|
+
* @return the pad position, one of kPadBeforePrefix,
|
1441
|
+
* kPadAfterPrefix, kPadBeforeSuffix, or
|
1442
|
+
* kPadAfterSuffix.
|
1443
|
+
* @see #setFormatWidth
|
1444
|
+
* @see #getFormatWidth
|
1445
|
+
* @see #setPadCharacter
|
1446
|
+
* @see #getPadCharacterString
|
1447
|
+
* @see #setPadPosition
|
1448
|
+
* @see #EPadPosition
|
1449
|
+
* @stable ICU 2.0
|
1450
|
+
*/
|
1451
|
+
virtual EPadPosition getPadPosition(void) const;
|
1452
|
+
|
1453
|
+
/**
|
1454
|
+
* Set the position at which padding will take place. This is the location
|
1455
|
+
* at which padding will be inserted if the result of format()
|
1456
|
+
* is shorter than the format width. This has no effect unless padding is
|
1457
|
+
* enabled.
|
1458
|
+
* @param padPos the pad position, one of kPadBeforePrefix,
|
1459
|
+
* kPadAfterPrefix, kPadBeforeSuffix, or
|
1460
|
+
* kPadAfterSuffix.
|
1461
|
+
* @see #setFormatWidth
|
1462
|
+
* @see #getFormatWidth
|
1463
|
+
* @see #setPadCharacter
|
1464
|
+
* @see #getPadCharacterString
|
1465
|
+
* @see #getPadPosition
|
1466
|
+
* @see #EPadPosition
|
1467
|
+
* @stable ICU 2.0
|
1468
|
+
*/
|
1469
|
+
virtual void setPadPosition(EPadPosition padPos);
|
1470
|
+
|
1471
|
+
/**
|
1472
|
+
* Return whether or not scientific notation is used.
|
1473
|
+
* @return TRUE if this object formats and parses scientific notation
|
1474
|
+
* @see #setScientificNotation
|
1475
|
+
* @see #getMinimumExponentDigits
|
1476
|
+
* @see #setMinimumExponentDigits
|
1477
|
+
* @see #isExponentSignAlwaysShown
|
1478
|
+
* @see #setExponentSignAlwaysShown
|
1479
|
+
* @stable ICU 2.0
|
1480
|
+
*/
|
1481
|
+
virtual UBool isScientificNotation(void) const;
|
1482
|
+
|
1483
|
+
/**
|
1484
|
+
* Set whether or not scientific notation is used. When scientific notation
|
1485
|
+
* is used, the effective maximum number of integer digits is <= 8. If the
|
1486
|
+
* maximum number of integer digits is set to more than 8, the effective
|
1487
|
+
* maximum will be 1. This allows this call to generate a 'default' scientific
|
1488
|
+
* number format without additional changes.
|
1489
|
+
* @param useScientific TRUE if this object formats and parses scientific
|
1490
|
+
* notation
|
1491
|
+
* @see #isScientificNotation
|
1492
|
+
* @see #getMinimumExponentDigits
|
1493
|
+
* @see #setMinimumExponentDigits
|
1494
|
+
* @see #isExponentSignAlwaysShown
|
1495
|
+
* @see #setExponentSignAlwaysShown
|
1496
|
+
* @stable ICU 2.0
|
1497
|
+
*/
|
1498
|
+
virtual void setScientificNotation(UBool useScientific);
|
1499
|
+
|
1500
|
+
/**
|
1501
|
+
* Return the minimum exponent digits that will be shown.
|
1502
|
+
* @return the minimum exponent digits that will be shown
|
1503
|
+
* @see #setScientificNotation
|
1504
|
+
* @see #isScientificNotation
|
1505
|
+
* @see #setMinimumExponentDigits
|
1506
|
+
* @see #isExponentSignAlwaysShown
|
1507
|
+
* @see #setExponentSignAlwaysShown
|
1508
|
+
* @stable ICU 2.0
|
1509
|
+
*/
|
1510
|
+
virtual int8_t getMinimumExponentDigits(void) const;
|
1511
|
+
|
1512
|
+
/**
|
1513
|
+
* Set the minimum exponent digits that will be shown. This has no
|
1514
|
+
* effect unless scientific notation is in use.
|
1515
|
+
* @param minExpDig a value >= 1 indicating the fewest exponent digits
|
1516
|
+
* that will be shown. Values less than 1 will be treated as 1.
|
1517
|
+
* @see #setScientificNotation
|
1518
|
+
* @see #isScientificNotation
|
1519
|
+
* @see #getMinimumExponentDigits
|
1520
|
+
* @see #isExponentSignAlwaysShown
|
1521
|
+
* @see #setExponentSignAlwaysShown
|
1522
|
+
* @stable ICU 2.0
|
1523
|
+
*/
|
1524
|
+
virtual void setMinimumExponentDigits(int8_t minExpDig);
|
1525
|
+
|
1526
|
+
/**
|
1527
|
+
* Return whether the exponent sign is always shown.
|
1528
|
+
* @return TRUE if the exponent is always prefixed with either the
|
1529
|
+
* localized minus sign or the localized plus sign, false if only negative
|
1530
|
+
* exponents are prefixed with the localized minus sign.
|
1531
|
+
* @see #setScientificNotation
|
1532
|
+
* @see #isScientificNotation
|
1533
|
+
* @see #setMinimumExponentDigits
|
1534
|
+
* @see #getMinimumExponentDigits
|
1535
|
+
* @see #setExponentSignAlwaysShown
|
1536
|
+
* @stable ICU 2.0
|
1537
|
+
*/
|
1538
|
+
virtual UBool isExponentSignAlwaysShown(void) const;
|
1539
|
+
|
1540
|
+
/**
|
1541
|
+
* Set whether the exponent sign is always shown. This has no effect
|
1542
|
+
* unless scientific notation is in use.
|
1543
|
+
* @param expSignAlways TRUE if the exponent is always prefixed with either
|
1544
|
+
* the localized minus sign or the localized plus sign, false if only
|
1545
|
+
* negative exponents are prefixed with the localized minus sign.
|
1546
|
+
* @see #setScientificNotation
|
1547
|
+
* @see #isScientificNotation
|
1548
|
+
* @see #setMinimumExponentDigits
|
1549
|
+
* @see #getMinimumExponentDigits
|
1550
|
+
* @see #isExponentSignAlwaysShown
|
1551
|
+
* @stable ICU 2.0
|
1552
|
+
*/
|
1553
|
+
virtual void setExponentSignAlwaysShown(UBool expSignAlways);
|
1554
|
+
|
1555
|
+
/**
|
1556
|
+
* Return the grouping size. Grouping size is the number of digits between
|
1557
|
+
* grouping separators in the integer portion of a number. For example,
|
1558
|
+
* in the number "123,456.78", the grouping size is 3.
|
1559
|
+
*
|
1560
|
+
* @return the grouping size.
|
1561
|
+
* @see setGroupingSize
|
1562
|
+
* @see NumberFormat::isGroupingUsed
|
1563
|
+
* @see DecimalFormatSymbols::getGroupingSeparator
|
1564
|
+
* @stable ICU 2.0
|
1565
|
+
*/
|
1566
|
+
int32_t getGroupingSize(void) const;
|
1567
|
+
|
1568
|
+
/**
|
1569
|
+
* Set the grouping size. Grouping size is the number of digits between
|
1570
|
+
* grouping separators in the integer portion of a number. For example,
|
1571
|
+
* in the number "123,456.78", the grouping size is 3.
|
1572
|
+
*
|
1573
|
+
* @param newValue the new value of the grouping size.
|
1574
|
+
* @see getGroupingSize
|
1575
|
+
* @see NumberFormat::setGroupingUsed
|
1576
|
+
* @see DecimalFormatSymbols::setGroupingSeparator
|
1577
|
+
* @stable ICU 2.0
|
1578
|
+
*/
|
1579
|
+
virtual void setGroupingSize(int32_t newValue);
|
1580
|
+
|
1581
|
+
/**
|
1582
|
+
* Return the secondary grouping size. In some locales one
|
1583
|
+
* grouping interval is used for the least significant integer
|
1584
|
+
* digits (the primary grouping size), and another is used for all
|
1585
|
+
* others (the secondary grouping size). A formatter supporting a
|
1586
|
+
* secondary grouping size will return a positive integer unequal
|
1587
|
+
* to the primary grouping size returned by
|
1588
|
+
* getGroupingSize(). For example, if the primary
|
1589
|
+
* grouping size is 4, and the secondary grouping size is 2, then
|
1590
|
+
* the number 123456789 formats as "1,23,45,6789", and the pattern
|
1591
|
+
* appears as "#,##,###0".
|
1592
|
+
* @return the secondary grouping size, or a value less than
|
1593
|
+
* one if there is none
|
1594
|
+
* @see setSecondaryGroupingSize
|
1595
|
+
* @see NumberFormat::isGroupingUsed
|
1596
|
+
* @see DecimalFormatSymbols::getGroupingSeparator
|
1597
|
+
* @stable ICU 2.4
|
1598
|
+
*/
|
1599
|
+
int32_t getSecondaryGroupingSize(void) const;
|
1600
|
+
|
1601
|
+
/**
|
1602
|
+
* Set the secondary grouping size. If set to a value less than 1,
|
1603
|
+
* then secondary grouping is turned off, and the primary grouping
|
1604
|
+
* size is used for all intervals, not just the least significant.
|
1605
|
+
*
|
1606
|
+
* @param newValue the new value of the secondary grouping size.
|
1607
|
+
* @see getSecondaryGroupingSize
|
1608
|
+
* @see NumberFormat#setGroupingUsed
|
1609
|
+
* @see DecimalFormatSymbols::setGroupingSeparator
|
1610
|
+
* @stable ICU 2.4
|
1611
|
+
*/
|
1612
|
+
virtual void setSecondaryGroupingSize(int32_t newValue);
|
1613
|
+
|
1614
|
+
/**
|
1615
|
+
* Allows you to get the behavior of the decimal separator with integers.
|
1616
|
+
* (The decimal separator will always appear with decimals.)
|
1617
|
+
*
|
1618
|
+
* @return TRUE if the decimal separator always appear with decimals.
|
1619
|
+
* Example: Decimal ON: 12345 -> 12345.; OFF: 12345 -> 12345
|
1620
|
+
* @stable ICU 2.0
|
1621
|
+
*/
|
1622
|
+
UBool isDecimalSeparatorAlwaysShown(void) const;
|
1623
|
+
|
1624
|
+
/**
|
1625
|
+
* Allows you to set the behavior of the decimal separator with integers.
|
1626
|
+
* (The decimal separator will always appear with decimals.)
|
1627
|
+
*
|
1628
|
+
* @param newValue set TRUE if the decimal separator will always appear with decimals.
|
1629
|
+
* Example: Decimal ON: 12345 -> 12345.; OFF: 12345 -> 12345
|
1630
|
+
* @stable ICU 2.0
|
1631
|
+
*/
|
1632
|
+
virtual void setDecimalSeparatorAlwaysShown(UBool newValue);
|
1633
|
+
|
1634
|
+
#ifndef U_HIDE_DRAFT_API
|
1635
|
+
/**
|
1636
|
+
* Allows you to get the parse behavior of the pattern decimal mark.
|
1637
|
+
*
|
1638
|
+
* @return TRUE if input must contain a match to decimal mark in pattern
|
1639
|
+
* @draft ICU 54
|
1640
|
+
*/
|
1641
|
+
UBool isDecimalPatternMatchRequired(void) const;
|
1642
|
+
#endif /* U_HIDE_DRAFT_API */
|
1643
|
+
|
1644
|
+
/**
|
1645
|
+
* Allows you to set the behavior of the pattern decimal mark.
|
1646
|
+
*
|
1647
|
+
* if TRUE, the input must have a decimal mark if one was specified in the pattern. When
|
1648
|
+
* FALSE the decimal mark may be omitted from the input.
|
1649
|
+
*
|
1650
|
+
* @param newValue set TRUE if input must contain a match to decimal mark in pattern
|
1651
|
+
* @draft ICU 54
|
1652
|
+
*/
|
1653
|
+
virtual void setDecimalPatternMatchRequired(UBool newValue);
|
1654
|
+
|
1655
|
+
|
1656
|
+
/**
|
1657
|
+
* Synthesizes a pattern string that represents the current state
|
1658
|
+
* of this Format object.
|
1659
|
+
*
|
1660
|
+
* @param result Output param which will receive the pattern.
|
1661
|
+
* Previous contents are deleted.
|
1662
|
+
* @return A reference to 'result'.
|
1663
|
+
* @see applyPattern
|
1664
|
+
* @stable ICU 2.0
|
1665
|
+
*/
|
1666
|
+
virtual UnicodeString& toPattern(UnicodeString& result) const;
|
1667
|
+
|
1668
|
+
/**
|
1669
|
+
* Synthesizes a localized pattern string that represents the current
|
1670
|
+
* state of this Format object.
|
1671
|
+
*
|
1672
|
+
* @param result Output param which will receive the localized pattern.
|
1673
|
+
* Previous contents are deleted.
|
1674
|
+
* @return A reference to 'result'.
|
1675
|
+
* @see applyPattern
|
1676
|
+
* @stable ICU 2.0
|
1677
|
+
*/
|
1678
|
+
virtual UnicodeString& toLocalizedPattern(UnicodeString& result) const;
|
1679
|
+
|
1680
|
+
/**
|
1681
|
+
* Apply the given pattern to this Format object. A pattern is a
|
1682
|
+
* short-hand specification for the various formatting properties.
|
1683
|
+
* These properties can also be changed individually through the
|
1684
|
+
* various setter methods.
|
1685
|
+
* <P>
|
1686
|
+
* There is no limit to integer digits are set
|
1687
|
+
* by this routine, since that is the typical end-user desire;
|
1688
|
+
* use setMaximumInteger if you want to set a real value.
|
1689
|
+
* For negative numbers, use a second pattern, separated by a semicolon
|
1690
|
+
* <pre>
|
1691
|
+
* . Example "#,#00.0#" -> 1,234.56
|
1692
|
+
* </pre>
|
1693
|
+
* This means a minimum of 2 integer digits, 1 fraction digit, and
|
1694
|
+
* a maximum of 2 fraction digits.
|
1695
|
+
* <pre>
|
1696
|
+
* . Example: "#,#00.0#;(#,#00.0#)" for negatives in parantheses.
|
1697
|
+
* </pre>
|
1698
|
+
* In negative patterns, the minimum and maximum counts are ignored;
|
1699
|
+
* these are presumed to be set in the positive pattern.
|
1700
|
+
*
|
1701
|
+
* @param pattern The pattern to be applied.
|
1702
|
+
* @param parseError Struct to recieve information on position
|
1703
|
+
* of error if an error is encountered
|
1704
|
+
* @param status Output param set to success/failure code on
|
1705
|
+
* exit. If the pattern is invalid, this will be
|
1706
|
+
* set to a failure result.
|
1707
|
+
* @stable ICU 2.0
|
1708
|
+
*/
|
1709
|
+
virtual void applyPattern(const UnicodeString& pattern,
|
1710
|
+
UParseError& parseError,
|
1711
|
+
UErrorCode& status);
|
1712
|
+
/**
|
1713
|
+
* Sets the pattern.
|
1714
|
+
* @param pattern The pattern to be applied.
|
1715
|
+
* @param status Output param set to success/failure code on
|
1716
|
+
* exit. If the pattern is invalid, this will be
|
1717
|
+
* set to a failure result.
|
1718
|
+
* @stable ICU 2.0
|
1719
|
+
*/
|
1720
|
+
virtual void applyPattern(const UnicodeString& pattern,
|
1721
|
+
UErrorCode& status);
|
1722
|
+
|
1723
|
+
/**
|
1724
|
+
* Apply the given pattern to this Format object. The pattern
|
1725
|
+
* is assumed to be in a localized notation. A pattern is a
|
1726
|
+
* short-hand specification for the various formatting properties.
|
1727
|
+
* These properties can also be changed individually through the
|
1728
|
+
* various setter methods.
|
1729
|
+
* <P>
|
1730
|
+
* There is no limit to integer digits are set
|
1731
|
+
* by this routine, since that is the typical end-user desire;
|
1732
|
+
* use setMaximumInteger if you want to set a real value.
|
1733
|
+
* For negative numbers, use a second pattern, separated by a semicolon
|
1734
|
+
* <pre>
|
1735
|
+
* . Example "#,#00.0#" -> 1,234.56
|
1736
|
+
* </pre>
|
1737
|
+
* This means a minimum of 2 integer digits, 1 fraction digit, and
|
1738
|
+
* a maximum of 2 fraction digits.
|
1739
|
+
*
|
1740
|
+
* Example: "#,#00.0#;(#,#00.0#)" for negatives in parantheses.
|
1741
|
+
*
|
1742
|
+
* In negative patterns, the minimum and maximum counts are ignored;
|
1743
|
+
* these are presumed to be set in the positive pattern.
|
1744
|
+
*
|
1745
|
+
* @param pattern The localized pattern to be applied.
|
1746
|
+
* @param parseError Struct to recieve information on position
|
1747
|
+
* of error if an error is encountered
|
1748
|
+
* @param status Output param set to success/failure code on
|
1749
|
+
* exit. If the pattern is invalid, this will be
|
1750
|
+
* set to a failure result.
|
1751
|
+
* @stable ICU 2.0
|
1752
|
+
*/
|
1753
|
+
virtual void applyLocalizedPattern(const UnicodeString& pattern,
|
1754
|
+
UParseError& parseError,
|
1755
|
+
UErrorCode& status);
|
1756
|
+
|
1757
|
+
/**
|
1758
|
+
* Apply the given pattern to this Format object.
|
1759
|
+
*
|
1760
|
+
* @param pattern The localized pattern to be applied.
|
1761
|
+
* @param status Output param set to success/failure code on
|
1762
|
+
* exit. If the pattern is invalid, this will be
|
1763
|
+
* set to a failure result.
|
1764
|
+
* @stable ICU 2.0
|
1765
|
+
*/
|
1766
|
+
virtual void applyLocalizedPattern(const UnicodeString& pattern,
|
1767
|
+
UErrorCode& status);
|
1768
|
+
|
1769
|
+
|
1770
|
+
/**
|
1771
|
+
* Sets the maximum number of digits allowed in the integer portion of a
|
1772
|
+
* number. This override limits the integer digit count to 309.
|
1773
|
+
*
|
1774
|
+
* @param newValue the new value of the maximum number of digits
|
1775
|
+
* allowed in the integer portion of a number.
|
1776
|
+
* @see NumberFormat#setMaximumIntegerDigits
|
1777
|
+
* @stable ICU 2.0
|
1778
|
+
*/
|
1779
|
+
virtual void setMaximumIntegerDigits(int32_t newValue);
|
1780
|
+
|
1781
|
+
/**
|
1782
|
+
* Sets the minimum number of digits allowed in the integer portion of a
|
1783
|
+
* number. This override limits the integer digit count to 309.
|
1784
|
+
*
|
1785
|
+
* @param newValue the new value of the minimum number of digits
|
1786
|
+
* allowed in the integer portion of a number.
|
1787
|
+
* @see NumberFormat#setMinimumIntegerDigits
|
1788
|
+
* @stable ICU 2.0
|
1789
|
+
*/
|
1790
|
+
virtual void setMinimumIntegerDigits(int32_t newValue);
|
1791
|
+
|
1792
|
+
/**
|
1793
|
+
* Sets the maximum number of digits allowed in the fraction portion of a
|
1794
|
+
* number. This override limits the fraction digit count to 340.
|
1795
|
+
*
|
1796
|
+
* @param newValue the new value of the maximum number of digits
|
1797
|
+
* allowed in the fraction portion of a number.
|
1798
|
+
* @see NumberFormat#setMaximumFractionDigits
|
1799
|
+
* @stable ICU 2.0
|
1800
|
+
*/
|
1801
|
+
virtual void setMaximumFractionDigits(int32_t newValue);
|
1802
|
+
|
1803
|
+
/**
|
1804
|
+
* Sets the minimum number of digits allowed in the fraction portion of a
|
1805
|
+
* number. This override limits the fraction digit count to 340.
|
1806
|
+
*
|
1807
|
+
* @param newValue the new value of the minimum number of digits
|
1808
|
+
* allowed in the fraction portion of a number.
|
1809
|
+
* @see NumberFormat#setMinimumFractionDigits
|
1810
|
+
* @stable ICU 2.0
|
1811
|
+
*/
|
1812
|
+
virtual void setMinimumFractionDigits(int32_t newValue);
|
1813
|
+
|
1814
|
+
/**
|
1815
|
+
* Returns the minimum number of significant digits that will be
|
1816
|
+
* displayed. This value has no effect unless areSignificantDigitsUsed()
|
1817
|
+
* returns true.
|
1818
|
+
* @return the fewest significant digits that will be shown
|
1819
|
+
* @stable ICU 3.0
|
1820
|
+
*/
|
1821
|
+
int32_t getMinimumSignificantDigits() const;
|
1822
|
+
|
1823
|
+
/**
|
1824
|
+
* Returns the maximum number of significant digits that will be
|
1825
|
+
* displayed. This value has no effect unless areSignificantDigitsUsed()
|
1826
|
+
* returns true.
|
1827
|
+
* @return the most significant digits that will be shown
|
1828
|
+
* @stable ICU 3.0
|
1829
|
+
*/
|
1830
|
+
int32_t getMaximumSignificantDigits() const;
|
1831
|
+
|
1832
|
+
/**
|
1833
|
+
* Sets the minimum number of significant digits that will be
|
1834
|
+
* displayed. If <code>min</code> is less than one then it is set
|
1835
|
+
* to one. If the maximum significant digits count is less than
|
1836
|
+
* <code>min</code>, then it is set to <code>min</code>.
|
1837
|
+
* This function also enables the use of significant digits
|
1838
|
+
* by this formatter - areSignificantDigitsUsed() will return TRUE.
|
1839
|
+
* @see #areSignificantDigitsUsed
|
1840
|
+
* @param min the fewest significant digits to be shown
|
1841
|
+
* @stable ICU 3.0
|
1842
|
+
*/
|
1843
|
+
void setMinimumSignificantDigits(int32_t min);
|
1844
|
+
|
1845
|
+
/**
|
1846
|
+
* Sets the maximum number of significant digits that will be
|
1847
|
+
* displayed. If <code>max</code> is less than one then it is set
|
1848
|
+
* to one. If the minimum significant digits count is greater
|
1849
|
+
* than <code>max</code>, then it is set to <code>max</code>.
|
1850
|
+
* This function also enables the use of significant digits
|
1851
|
+
* by this formatter - areSignificantDigitsUsed() will return TRUE.
|
1852
|
+
* @see #areSignificantDigitsUsed
|
1853
|
+
* @param max the most significant digits to be shown
|
1854
|
+
* @stable ICU 3.0
|
1855
|
+
*/
|
1856
|
+
void setMaximumSignificantDigits(int32_t max);
|
1857
|
+
|
1858
|
+
/**
|
1859
|
+
* Returns true if significant digits are in use, or false if
|
1860
|
+
* integer and fraction digit counts are in use.
|
1861
|
+
* @return true if significant digits are in use
|
1862
|
+
* @stable ICU 3.0
|
1863
|
+
*/
|
1864
|
+
UBool areSignificantDigitsUsed() const;
|
1865
|
+
|
1866
|
+
/**
|
1867
|
+
* Sets whether significant digits are in use, or integer and
|
1868
|
+
* fraction digit counts are in use.
|
1869
|
+
* @param useSignificantDigits true to use significant digits, or
|
1870
|
+
* false to use integer and fraction digit counts
|
1871
|
+
* @stable ICU 3.0
|
1872
|
+
*/
|
1873
|
+
void setSignificantDigitsUsed(UBool useSignificantDigits);
|
1874
|
+
|
1875
|
+
public:
|
1876
|
+
/**
|
1877
|
+
* Sets the currency used to display currency
|
1878
|
+
* amounts. This takes effect immediately, if this format is a
|
1879
|
+
* currency format. If this format is not a currency format, then
|
1880
|
+
* the currency is used if and when this object becomes a
|
1881
|
+
* currency format through the application of a new pattern.
|
1882
|
+
* @param theCurrency a 3-letter ISO code indicating new currency
|
1883
|
+
* to use. It need not be null-terminated. May be the empty
|
1884
|
+
* string or NULL to indicate no currency.
|
1885
|
+
* @param ec input-output error code
|
1886
|
+
* @stable ICU 3.0
|
1887
|
+
*/
|
1888
|
+
virtual void setCurrency(const UChar* theCurrency, UErrorCode& ec);
|
1889
|
+
|
1890
|
+
/**
|
1891
|
+
* Sets the currency used to display currency amounts. See
|
1892
|
+
* setCurrency(const UChar*, UErrorCode&).
|
1893
|
+
* @deprecated ICU 3.0. Use setCurrency(const UChar*, UErrorCode&).
|
1894
|
+
*/
|
1895
|
+
virtual void setCurrency(const UChar* theCurrency);
|
1896
|
+
|
1897
|
+
#ifndef U_HIDE_DRAFT_API
|
1898
|
+
/**
|
1899
|
+
* Sets the <tt>Currency Context</tt> object used to display currency.
|
1900
|
+
* This takes effect immediately, if this format is a
|
1901
|
+
* currency format.
|
1902
|
+
* @param currencyContext new currency context object to use.
|
1903
|
+
* @draft ICU 54
|
1904
|
+
*/
|
1905
|
+
void setCurrencyUsage(UCurrencyUsage newUsage, UErrorCode* ec);
|
1906
|
+
|
1907
|
+
/**
|
1908
|
+
* Returns the <tt>Currency Context</tt> object used to display currency
|
1909
|
+
* @draft ICU 54
|
1910
|
+
*/
|
1911
|
+
UCurrencyUsage getCurrencyUsage() const;
|
1912
|
+
#endif /* U_HIDE_DRAFT_API */
|
1913
|
+
|
1914
|
+
|
1915
|
+
#ifndef U_HIDE_DEPRECATED_API
|
1916
|
+
/**
|
1917
|
+
* The resource tags we use to retrieve decimal format data from
|
1918
|
+
* locale resource bundles.
|
1919
|
+
* @deprecated ICU 3.4. This string has no public purpose. Please don't use it.
|
1920
|
+
*/
|
1921
|
+
static const char fgNumberPatterns[];
|
1922
|
+
#endif /* U_HIDE_DEPRECATED_API */
|
1923
|
+
|
1924
|
+
#ifndef U_HIDE_INTERNAL_API
|
1925
|
+
/**
|
1926
|
+
* Get a FixedDecimal corresponding to a double as it would be
|
1927
|
+
* formatted by this DecimalFormat.
|
1928
|
+
* Internal, not intended for public use.
|
1929
|
+
* @internal
|
1930
|
+
*/
|
1931
|
+
FixedDecimal getFixedDecimal(double number, UErrorCode &status) const;
|
1932
|
+
|
1933
|
+
/**
|
1934
|
+
* Get a FixedDecimal corresponding to a formattable as it would be
|
1935
|
+
* formatted by this DecimalFormat.
|
1936
|
+
* Internal, not intended for public use.
|
1937
|
+
* @internal
|
1938
|
+
*/
|
1939
|
+
FixedDecimal getFixedDecimal(const Formattable &number, UErrorCode &status) const;
|
1940
|
+
|
1941
|
+
/**
|
1942
|
+
* Get a FixedDecimal corresponding to a DigitList as it would be
|
1943
|
+
* formatted by this DecimalFormat. Note: the DigitList may be modified.
|
1944
|
+
* Internal, not intended for public use.
|
1945
|
+
* @internal
|
1946
|
+
*/
|
1947
|
+
FixedDecimal getFixedDecimal(DigitList &number, UErrorCode &status) const;
|
1948
|
+
#endif /* U_HIDE_INTERNAL_API */
|
1949
|
+
|
1950
|
+
public:
|
1951
|
+
|
1952
|
+
/**
|
1953
|
+
* Return the class ID for this class. This is useful only for
|
1954
|
+
* comparing to a return value from getDynamicClassID(). For example:
|
1955
|
+
* <pre>
|
1956
|
+
* . Base* polymorphic_pointer = createPolymorphicObject();
|
1957
|
+
* . if (polymorphic_pointer->getDynamicClassID() ==
|
1958
|
+
* . Derived::getStaticClassID()) ...
|
1959
|
+
* </pre>
|
1960
|
+
* @return The class ID for all objects of this class.
|
1961
|
+
* @stable ICU 2.0
|
1962
|
+
*/
|
1963
|
+
static UClassID U_EXPORT2 getStaticClassID(void);
|
1964
|
+
|
1965
|
+
/**
|
1966
|
+
* Returns a unique class ID POLYMORPHICALLY. Pure virtual override.
|
1967
|
+
* This method is to implement a simple version of RTTI, since not all
|
1968
|
+
* C++ compilers support genuine RTTI. Polymorphic operator==() and
|
1969
|
+
* clone() methods call this method.
|
1970
|
+
*
|
1971
|
+
* @return The class ID for this object. All objects of a
|
1972
|
+
* given class have the same class ID. Objects of
|
1973
|
+
* other classes have different class IDs.
|
1974
|
+
* @stable ICU 2.0
|
1975
|
+
*/
|
1976
|
+
virtual UClassID getDynamicClassID(void) const;
|
1977
|
+
|
1978
|
+
private:
|
1979
|
+
|
1980
|
+
DecimalFormat(); // default constructor not implemented
|
1981
|
+
|
1982
|
+
int32_t precision() const;
|
1983
|
+
|
1984
|
+
/**
|
1985
|
+
* Initialize all fields of a new DecimalFormatter to a safe default value.
|
1986
|
+
* Common code for use by constructors.
|
1987
|
+
*/
|
1988
|
+
void init();
|
1989
|
+
|
1990
|
+
/**
|
1991
|
+
* Do real work of constructing a new DecimalFormat.
|
1992
|
+
*/
|
1993
|
+
void construct(UErrorCode& status,
|
1994
|
+
UParseError& parseErr,
|
1995
|
+
const UnicodeString* pattern = 0,
|
1996
|
+
DecimalFormatSymbols* symbolsToAdopt = 0
|
1997
|
+
);
|
1998
|
+
|
1999
|
+
/**
|
2000
|
+
* Does the real work of generating a pattern.
|
2001
|
+
*
|
2002
|
+
* @param result Output param which will receive the pattern.
|
2003
|
+
* Previous contents are deleted.
|
2004
|
+
* @param localized TRUE return localized pattern.
|
2005
|
+
* @return A reference to 'result'.
|
2006
|
+
*/
|
2007
|
+
UnicodeString& toPattern(UnicodeString& result, UBool localized) const;
|
2008
|
+
|
2009
|
+
/**
|
2010
|
+
* Does the real work of applying a pattern.
|
2011
|
+
* @param pattern The pattern to be applied.
|
2012
|
+
* @param localized If true, the pattern is localized; else false.
|
2013
|
+
* @param parseError Struct to recieve information on position
|
2014
|
+
* of error if an error is encountered
|
2015
|
+
* @param status Output param set to success/failure code on
|
2016
|
+
* exit. If the pattern is invalid, this will be
|
2017
|
+
* set to a failure result.
|
2018
|
+
*/
|
2019
|
+
void applyPattern(const UnicodeString& pattern,
|
2020
|
+
UBool localized,
|
2021
|
+
UParseError& parseError,
|
2022
|
+
UErrorCode& status);
|
2023
|
+
|
2024
|
+
/*
|
2025
|
+
* similar to applyPattern, but without re-gen affix for currency
|
2026
|
+
*/
|
2027
|
+
void applyPatternInternally(const UnicodeString& pluralCount,
|
2028
|
+
const UnicodeString& pattern,
|
2029
|
+
UBool localized,
|
2030
|
+
UParseError& parseError,
|
2031
|
+
UErrorCode& status);
|
2032
|
+
|
2033
|
+
/*
|
2034
|
+
* only apply pattern without expand affixes
|
2035
|
+
*/
|
2036
|
+
void applyPatternWithoutExpandAffix(const UnicodeString& pattern,
|
2037
|
+
UBool localized,
|
2038
|
+
UParseError& parseError,
|
2039
|
+
UErrorCode& status);
|
2040
|
+
|
2041
|
+
|
2042
|
+
/*
|
2043
|
+
* expand affixes (after apply patter) and re-compute fFormatWidth
|
2044
|
+
*/
|
2045
|
+
void expandAffixAdjustWidth(const UnicodeString* pluralCount);
|
2046
|
+
|
2047
|
+
|
2048
|
+
/**
|
2049
|
+
* Do the work of formatting a number, either a double or a long.
|
2050
|
+
*
|
2051
|
+
* @param appendTo Output parameter to receive result.
|
2052
|
+
* Result is appended to existing contents.
|
2053
|
+
* @param handler Records information about field positions.
|
2054
|
+
* @param digits the digits to be formatted.
|
2055
|
+
* @param isInteger if TRUE format the digits as Integer.
|
2056
|
+
* @return Reference to 'appendTo' parameter.
|
2057
|
+
*/
|
2058
|
+
UnicodeString& subformat(UnicodeString& appendTo,
|
2059
|
+
FieldPositionHandler& handler,
|
2060
|
+
DigitList& digits,
|
2061
|
+
UBool isInteger,
|
2062
|
+
UErrorCode &status) const;
|
2063
|
+
|
2064
|
+
|
2065
|
+
void parse(const UnicodeString& text,
|
2066
|
+
Formattable& result,
|
2067
|
+
ParsePosition& pos,
|
2068
|
+
UChar* currency) const;
|
2069
|
+
|
2070
|
+
enum {
|
2071
|
+
fgStatusInfinite,
|
2072
|
+
fgStatusLength // Leave last in list.
|
2073
|
+
} StatusFlags;
|
2074
|
+
|
2075
|
+
UBool subparse(const UnicodeString& text,
|
2076
|
+
const UnicodeString* negPrefix,
|
2077
|
+
const UnicodeString* negSuffix,
|
2078
|
+
const UnicodeString* posPrefix,
|
2079
|
+
const UnicodeString* posSuffix,
|
2080
|
+
UBool complexCurrencyParsing,
|
2081
|
+
int8_t type,
|
2082
|
+
ParsePosition& parsePosition,
|
2083
|
+
DigitList& digits, UBool* status,
|
2084
|
+
UChar* currency) const;
|
2085
|
+
|
2086
|
+
// Mixed style parsing for currency.
|
2087
|
+
// It parses against the current currency pattern
|
2088
|
+
// using complex affix comparison
|
2089
|
+
// parses against the currency plural patterns using complex affix comparison,
|
2090
|
+
// and parses against the current pattern using simple affix comparison.
|
2091
|
+
UBool parseForCurrency(const UnicodeString& text,
|
2092
|
+
ParsePosition& parsePosition,
|
2093
|
+
DigitList& digits,
|
2094
|
+
UBool* status,
|
2095
|
+
UChar* currency) const;
|
2096
|
+
|
2097
|
+
int32_t skipPadding(const UnicodeString& text, int32_t position) const;
|
2098
|
+
|
2099
|
+
int32_t compareAffix(const UnicodeString& input,
|
2100
|
+
int32_t pos,
|
2101
|
+
UBool isNegative,
|
2102
|
+
UBool isPrefix,
|
2103
|
+
const UnicodeString* affixPat,
|
2104
|
+
UBool complexCurrencyParsing,
|
2105
|
+
int8_t type,
|
2106
|
+
UChar* currency) const;
|
2107
|
+
|
2108
|
+
static UnicodeString& trimMarksFromAffix(const UnicodeString& affix, UnicodeString& trimmedAffix);
|
2109
|
+
|
2110
|
+
UBool equalWithSignCompatibility(UChar32 lhs, UChar32 rhs) const;
|
2111
|
+
|
2112
|
+
int32_t compareSimpleAffix(const UnicodeString& affix,
|
2113
|
+
const UnicodeString& input,
|
2114
|
+
int32_t pos,
|
2115
|
+
UBool lenient) const;
|
2116
|
+
|
2117
|
+
static int32_t skipPatternWhiteSpace(const UnicodeString& text, int32_t pos);
|
2118
|
+
|
2119
|
+
static int32_t skipUWhiteSpace(const UnicodeString& text, int32_t pos);
|
2120
|
+
|
2121
|
+
static int32_t skipUWhiteSpaceAndMarks(const UnicodeString& text, int32_t pos);
|
2122
|
+
|
2123
|
+
static int32_t skipBidiMarks(const UnicodeString& text, int32_t pos);
|
2124
|
+
|
2125
|
+
int32_t compareComplexAffix(const UnicodeString& affixPat,
|
2126
|
+
const UnicodeString& input,
|
2127
|
+
int32_t pos,
|
2128
|
+
int8_t type,
|
2129
|
+
UChar* currency) const;
|
2130
|
+
|
2131
|
+
static int32_t match(const UnicodeString& text, int32_t pos, UChar32 ch);
|
2132
|
+
|
2133
|
+
static int32_t match(const UnicodeString& text, int32_t pos, const UnicodeString& str);
|
2134
|
+
|
2135
|
+
static UBool matchSymbol(const UnicodeString &text, int32_t position, int32_t length, const UnicodeString &symbol,
|
2136
|
+
UnicodeSet *sset, UChar32 schar);
|
2137
|
+
|
2138
|
+
static UBool matchDecimal(UChar32 symbolChar,
|
2139
|
+
UBool sawDecimal, UChar32 sawDecimalChar,
|
2140
|
+
const UnicodeSet *sset, UChar32 schar);
|
2141
|
+
|
2142
|
+
static UBool matchGrouping(UChar32 groupingChar,
|
2143
|
+
UBool sawGrouping, UChar32 sawGroupingChar,
|
2144
|
+
const UnicodeSet *sset,
|
2145
|
+
UChar32 decimalChar, const UnicodeSet *decimalSet,
|
2146
|
+
UChar32 schar);
|
2147
|
+
|
2148
|
+
/**
|
2149
|
+
* Get a decimal format symbol.
|
2150
|
+
* Returns a const reference to the symbol string.
|
2151
|
+
* @internal
|
2152
|
+
*/
|
2153
|
+
inline const UnicodeString &getConstSymbol(DecimalFormatSymbols::ENumberFormatSymbol symbol) const;
|
2154
|
+
|
2155
|
+
int32_t appendAffix(UnicodeString& buf,
|
2156
|
+
double number,
|
2157
|
+
FieldPositionHandler& handler,
|
2158
|
+
UBool isNegative,
|
2159
|
+
UBool isPrefix) const;
|
2160
|
+
|
2161
|
+
/**
|
2162
|
+
* Append an affix to the given UnicodeString, using quotes if
|
2163
|
+
* there are special characters. Single quotes themselves must be
|
2164
|
+
* escaped in either case.
|
2165
|
+
*/
|
2166
|
+
void appendAffixPattern(UnicodeString& appendTo, const UnicodeString& affix,
|
2167
|
+
UBool localized) const;
|
2168
|
+
|
2169
|
+
void appendAffixPattern(UnicodeString& appendTo,
|
2170
|
+
const UnicodeString* affixPattern,
|
2171
|
+
const UnicodeString& expAffix, UBool localized) const;
|
2172
|
+
|
2173
|
+
void expandAffix(const UnicodeString& pattern,
|
2174
|
+
UnicodeString& affix,
|
2175
|
+
double number,
|
2176
|
+
FieldPositionHandler& handler,
|
2177
|
+
UBool doFormat,
|
2178
|
+
const UnicodeString* pluralCount) const;
|
2179
|
+
|
2180
|
+
void expandAffixes(const UnicodeString* pluralCount);
|
2181
|
+
|
2182
|
+
void addPadding(UnicodeString& appendTo,
|
2183
|
+
FieldPositionHandler& handler,
|
2184
|
+
int32_t prefixLen, int32_t suffixLen) const;
|
2185
|
+
|
2186
|
+
UBool isGroupingPosition(int32_t pos) const;
|
2187
|
+
|
2188
|
+
void setCurrencyForSymbols();
|
2189
|
+
|
2190
|
+
// similar to setCurrency without re-compute the affixes for currency.
|
2191
|
+
// If currency changes, the affix pattern for currency is not changed,
|
2192
|
+
// but the affix will be changed. So, affixes need to be
|
2193
|
+
// re-computed in setCurrency(), but not in setCurrencyInternally().
|
2194
|
+
virtual void setCurrencyInternally(const UChar* theCurrency, UErrorCode& ec);
|
2195
|
+
|
2196
|
+
// set up currency affix patterns for mix parsing.
|
2197
|
+
// The patterns saved here are the affix patterns of default currency
|
2198
|
+
// pattern and the unique affix patterns of the plural currency patterns.
|
2199
|
+
// Those patterns are used by parseForCurrency().
|
2200
|
+
void setupCurrencyAffixPatterns(UErrorCode& status);
|
2201
|
+
|
2202
|
+
// set up the currency affixes used in currency plural formatting.
|
2203
|
+
// It sets up both fAffixesForCurrency for currency pattern if the current
|
2204
|
+
// pattern contains 3 currency signs,
|
2205
|
+
// and it sets up fPluralAffixesForCurrency for currency plural patterns.
|
2206
|
+
void setupCurrencyAffixes(const UnicodeString& pattern,
|
2207
|
+
UBool setupForCurrentPattern,
|
2208
|
+
UBool setupForPluralPattern,
|
2209
|
+
UErrorCode& status);
|
2210
|
+
|
2211
|
+
// get the currency rounding with respect to currency usage
|
2212
|
+
double getCurrencyRounding(const UChar* currency,
|
2213
|
+
UErrorCode* ec) const;
|
2214
|
+
|
2215
|
+
// get the currency fraction with respect to currency usage
|
2216
|
+
int getCurrencyFractionDigits(const UChar* currency,
|
2217
|
+
UErrorCode* ec) const;
|
2218
|
+
|
2219
|
+
// hashtable operations
|
2220
|
+
Hashtable* initHashForAffixPattern(UErrorCode& status);
|
2221
|
+
Hashtable* initHashForAffix(UErrorCode& status);
|
2222
|
+
|
2223
|
+
void deleteHashForAffixPattern();
|
2224
|
+
void deleteHashForAffix(Hashtable*& table);
|
2225
|
+
|
2226
|
+
void copyHashForAffixPattern(const Hashtable* source,
|
2227
|
+
Hashtable* target, UErrorCode& status);
|
2228
|
+
void copyHashForAffix(const Hashtable* source,
|
2229
|
+
Hashtable* target, UErrorCode& status);
|
2230
|
+
|
2231
|
+
UnicodeString& _format(int64_t number,
|
2232
|
+
UnicodeString& appendTo,
|
2233
|
+
FieldPositionHandler& handler,
|
2234
|
+
UErrorCode &status) const;
|
2235
|
+
UnicodeString& _format(double number,
|
2236
|
+
UnicodeString& appendTo,
|
2237
|
+
FieldPositionHandler& handler,
|
2238
|
+
UErrorCode &status) const;
|
2239
|
+
UnicodeString& _format(const DigitList &number,
|
2240
|
+
UnicodeString& appendTo,
|
2241
|
+
FieldPositionHandler& handler,
|
2242
|
+
UErrorCode &status) const;
|
2243
|
+
|
2244
|
+
/**
|
2245
|
+
* Constants.
|
2246
|
+
*/
|
2247
|
+
|
2248
|
+
UnicodeString fPositivePrefix;
|
2249
|
+
UnicodeString fPositiveSuffix;
|
2250
|
+
UnicodeString fNegativePrefix;
|
2251
|
+
UnicodeString fNegativeSuffix;
|
2252
|
+
UnicodeString* fPosPrefixPattern;
|
2253
|
+
UnicodeString* fPosSuffixPattern;
|
2254
|
+
UnicodeString* fNegPrefixPattern;
|
2255
|
+
UnicodeString* fNegSuffixPattern;
|
2256
|
+
|
2257
|
+
/**
|
2258
|
+
* Formatter for ChoiceFormat-based currency names. If this field
|
2259
|
+
* is not null, then delegate to it to format currency symbols.
|
2260
|
+
* @since ICU 2.6
|
2261
|
+
*/
|
2262
|
+
ChoiceFormat* fCurrencyChoice;
|
2263
|
+
|
2264
|
+
DigitList * fMultiplier; // NULL for multiplier of one
|
2265
|
+
int32_t fScale;
|
2266
|
+
int32_t fGroupingSize;
|
2267
|
+
int32_t fGroupingSize2;
|
2268
|
+
UBool fDecimalSeparatorAlwaysShown;
|
2269
|
+
DecimalFormatSymbols* fSymbols;
|
2270
|
+
|
2271
|
+
UBool fUseSignificantDigits;
|
2272
|
+
int32_t fMinSignificantDigits;
|
2273
|
+
int32_t fMaxSignificantDigits;
|
2274
|
+
|
2275
|
+
UBool fUseExponentialNotation;
|
2276
|
+
int8_t fMinExponentDigits;
|
2277
|
+
UBool fExponentSignAlwaysShown;
|
2278
|
+
|
2279
|
+
EnumSet<UNumberFormatAttribute,
|
2280
|
+
UNUM_MAX_NONBOOLEAN_ATTRIBUTE+1,
|
2281
|
+
UNUM_LIMIT_BOOLEAN_ATTRIBUTE>
|
2282
|
+
fBoolFlags;
|
2283
|
+
|
2284
|
+
DigitList* fRoundingIncrement; // NULL if no rounding increment specified.
|
2285
|
+
ERoundingMode fRoundingMode;
|
2286
|
+
|
2287
|
+
UChar32 fPad;
|
2288
|
+
int32_t fFormatWidth;
|
2289
|
+
EPadPosition fPadPosition;
|
2290
|
+
|
2291
|
+
/*
|
2292
|
+
* Following are used for currency format
|
2293
|
+
*/
|
2294
|
+
// pattern used in this formatter
|
2295
|
+
UnicodeString fFormatPattern;
|
2296
|
+
// style is only valid when decimal formatter is constructed by
|
2297
|
+
// DecimalFormat(pattern, decimalFormatSymbol, style)
|
2298
|
+
int fStyle;
|
2299
|
+
/*
|
2300
|
+
* Represents whether this is a currency format, and which
|
2301
|
+
* currency format style.
|
2302
|
+
* 0: not currency format type;
|
2303
|
+
* 1: currency style -- symbol name, such as "$" for US dollar.
|
2304
|
+
* 2: currency style -- ISO name, such as USD for US dollar.
|
2305
|
+
* 3: currency style -- plural long name, such as "US Dollar" for
|
2306
|
+
* "1.00 US Dollar", or "US Dollars" for
|
2307
|
+
* "3.00 US Dollars".
|
2308
|
+
*/
|
2309
|
+
int fCurrencySignCount;
|
2310
|
+
|
2311
|
+
|
2312
|
+
/* For currency parsing purose,
|
2313
|
+
* Need to remember all prefix patterns and suffix patterns of
|
2314
|
+
* every currency format pattern,
|
2315
|
+
* including the pattern of default currecny style
|
2316
|
+
* and plural currency style. And the patterns are set through applyPattern.
|
2317
|
+
*/
|
2318
|
+
// TODO: innerclass?
|
2319
|
+
/* This is not needed in the class declaration, so it is moved into decimfmp.cpp
|
2320
|
+
struct AffixPatternsForCurrency : public UMemory {
|
2321
|
+
// negative prefix pattern
|
2322
|
+
UnicodeString negPrefixPatternForCurrency;
|
2323
|
+
// negative suffix pattern
|
2324
|
+
UnicodeString negSuffixPatternForCurrency;
|
2325
|
+
// positive prefix pattern
|
2326
|
+
UnicodeString posPrefixPatternForCurrency;
|
2327
|
+
// positive suffix pattern
|
2328
|
+
UnicodeString posSuffixPatternForCurrency;
|
2329
|
+
int8_t patternType;
|
2330
|
+
|
2331
|
+
AffixPatternsForCurrency(const UnicodeString& negPrefix,
|
2332
|
+
const UnicodeString& negSuffix,
|
2333
|
+
const UnicodeString& posPrefix,
|
2334
|
+
const UnicodeString& posSuffix,
|
2335
|
+
int8_t type) {
|
2336
|
+
negPrefixPatternForCurrency = negPrefix;
|
2337
|
+
negSuffixPatternForCurrency = negSuffix;
|
2338
|
+
posPrefixPatternForCurrency = posPrefix;
|
2339
|
+
posSuffixPatternForCurrency = posSuffix;
|
2340
|
+
patternType = type;
|
2341
|
+
}
|
2342
|
+
};
|
2343
|
+
*/
|
2344
|
+
|
2345
|
+
/* affix for currency formatting when the currency sign in the pattern
|
2346
|
+
* equals to 3, such as the pattern contains 3 currency sign or
|
2347
|
+
* the formatter style is currency plural format style.
|
2348
|
+
*/
|
2349
|
+
/* This is not needed in the class declaration, so it is moved into decimfmp.cpp
|
2350
|
+
struct AffixesForCurrency : public UMemory {
|
2351
|
+
// negative prefix
|
2352
|
+
UnicodeString negPrefixForCurrency;
|
2353
|
+
// negative suffix
|
2354
|
+
UnicodeString negSuffixForCurrency;
|
2355
|
+
// positive prefix
|
2356
|
+
UnicodeString posPrefixForCurrency;
|
2357
|
+
// positive suffix
|
2358
|
+
UnicodeString posSuffixForCurrency;
|
2359
|
+
|
2360
|
+
int32_t formatWidth;
|
2361
|
+
|
2362
|
+
AffixesForCurrency(const UnicodeString& negPrefix,
|
2363
|
+
const UnicodeString& negSuffix,
|
2364
|
+
const UnicodeString& posPrefix,
|
2365
|
+
const UnicodeString& posSuffix) {
|
2366
|
+
negPrefixForCurrency = negPrefix;
|
2367
|
+
negSuffixForCurrency = negSuffix;
|
2368
|
+
posPrefixForCurrency = posPrefix;
|
2369
|
+
posSuffixForCurrency = posSuffix;
|
2370
|
+
}
|
2371
|
+
};
|
2372
|
+
*/
|
2373
|
+
|
2374
|
+
// Affix pattern set for currency.
|
2375
|
+
// It is a set of AffixPatternsForCurrency,
|
2376
|
+
// each element of the set saves the negative prefix pattern,
|
2377
|
+
// negative suffix pattern, positive prefix pattern,
|
2378
|
+
// and positive suffix pattern of a pattern.
|
2379
|
+
// It is used for currency mixed style parsing.
|
2380
|
+
// It is actually is a set.
|
2381
|
+
// The set contains the default currency pattern from the locale,
|
2382
|
+
// and the currency plural patterns.
|
2383
|
+
// Since it is a set, it does not contain duplicated items.
|
2384
|
+
// For example, if 2 currency plural patterns are the same, only one pattern
|
2385
|
+
// is included in the set. When parsing, we do not check whether the plural
|
2386
|
+
// count match or not.
|
2387
|
+
Hashtable* fAffixPatternsForCurrency;
|
2388
|
+
|
2389
|
+
// Following 2 are affixes for currency.
|
2390
|
+
// It is a hash map from plural count to AffixesForCurrency.
|
2391
|
+
// AffixesForCurrency saves the negative prefix,
|
2392
|
+
// negative suffix, positive prefix, and positive suffix of a pattern.
|
2393
|
+
// It is used during currency formatting only when the currency sign count
|
2394
|
+
// is 3. In which case, the affixes are getting from here, not
|
2395
|
+
// from the fNegativePrefix etc.
|
2396
|
+
Hashtable* fAffixesForCurrency; // for current pattern
|
2397
|
+
Hashtable* fPluralAffixesForCurrency; // for plural pattern
|
2398
|
+
|
2399
|
+
// Information needed for DecimalFormat to format/parse currency plural.
|
2400
|
+
CurrencyPluralInfo* fCurrencyPluralInfo;
|
2401
|
+
|
2402
|
+
#if UCONFIG_HAVE_PARSEALLINPUT
|
2403
|
+
UNumberFormatAttributeValue fParseAllInput;
|
2404
|
+
#endif
|
2405
|
+
|
2406
|
+
// Decimal Format Static Sets singleton.
|
2407
|
+
const DecimalFormatStaticSets *fStaticSets;
|
2408
|
+
|
2409
|
+
// Currency Usage(STANDARD vs CASH)
|
2410
|
+
UCurrencyUsage fCurrencyUsage;
|
2411
|
+
|
2412
|
+
protected:
|
2413
|
+
|
2414
|
+
#ifndef U_HIDE_INTERNAL_API
|
2415
|
+
/**
|
2416
|
+
* Rounds a value according to the rules of this object.
|
2417
|
+
* @internal
|
2418
|
+
*/
|
2419
|
+
DigitList& _round(const DigitList& number, DigitList& adjustedNum, UBool& isNegative, UErrorCode& status) const;
|
2420
|
+
#endif /* U_HIDE_INTERNAL_API */
|
2421
|
+
|
2422
|
+
/**
|
2423
|
+
* Returns the currency in effect for this formatter. Subclasses
|
2424
|
+
* should override this method as needed. Unlike getCurrency(),
|
2425
|
+
* this method should never return "".
|
2426
|
+
* @result output parameter for null-terminated result, which must
|
2427
|
+
* have a capacity of at least 4
|
2428
|
+
* @internal
|
2429
|
+
*/
|
2430
|
+
virtual void getEffectiveCurrency(UChar* result, UErrorCode& ec) const;
|
2431
|
+
|
2432
|
+
/** number of integer digits
|
2433
|
+
* @stable ICU 2.4
|
2434
|
+
*/
|
2435
|
+
static const int32_t kDoubleIntegerDigits;
|
2436
|
+
/** number of fraction digits
|
2437
|
+
* @stable ICU 2.4
|
2438
|
+
*/
|
2439
|
+
static const int32_t kDoubleFractionDigits;
|
2440
|
+
|
2441
|
+
/**
|
2442
|
+
* When someone turns on scientific mode, we assume that more than this
|
2443
|
+
* number of digits is due to flipping from some other mode that didn't
|
2444
|
+
* restrict the maximum, and so we force 1 integer digit. We don't bother
|
2445
|
+
* to track and see if someone is using exponential notation with more than
|
2446
|
+
* this number, it wouldn't make sense anyway, and this is just to make sure
|
2447
|
+
* that someone turning on scientific mode with default settings doesn't
|
2448
|
+
* end up with lots of zeroes.
|
2449
|
+
* @stable ICU 2.8
|
2450
|
+
*/
|
2451
|
+
static const int32_t kMaxScientificIntegerDigits;
|
2452
|
+
|
2453
|
+
#if UCONFIG_FORMAT_FASTPATHS_49
|
2454
|
+
private:
|
2455
|
+
/**
|
2456
|
+
* Internal state.
|
2457
|
+
* @internal
|
2458
|
+
*/
|
2459
|
+
uint8_t fReserved[UNUM_DECIMALFORMAT_INTERNAL_SIZE];
|
2460
|
+
|
2461
|
+
|
2462
|
+
/**
|
2463
|
+
* Called whenever any state changes. Recomputes whether fastpath is OK to use.
|
2464
|
+
*/
|
2465
|
+
void handleChanged();
|
2466
|
+
#endif
|
2467
|
+
};
|
2468
|
+
|
2469
|
+
inline const UnicodeString &
|
2470
|
+
DecimalFormat::getConstSymbol(DecimalFormatSymbols::ENumberFormatSymbol symbol) const {
|
2471
|
+
return fSymbols->getConstSymbol(symbol);
|
2472
|
+
}
|
2473
|
+
|
2474
|
+
U_NAMESPACE_END
|
2475
|
+
|
2476
|
+
#endif /* #if !UCONFIG_NO_FORMATTING */
|
2477
|
+
|
2478
|
+
#endif // _DECIMFMT
|
2479
|
+
//eof
|