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,1032 @@
|
|
1
|
+
/*
|
2
|
+
*******************************************************************************
|
3
|
+
* Copyright (C) 1997-2014, International Business Machines Corporation and others.
|
4
|
+
* All Rights Reserved.
|
5
|
+
*******************************************************************************
|
6
|
+
*/
|
7
|
+
|
8
|
+
#ifndef RBNF_H
|
9
|
+
#define RBNF_H
|
10
|
+
|
11
|
+
#include "unicode/utypes.h"
|
12
|
+
|
13
|
+
/**
|
14
|
+
* \file
|
15
|
+
* \brief C++ API: Rule Based Number Format
|
16
|
+
*/
|
17
|
+
|
18
|
+
/**
|
19
|
+
* \def U_HAVE_RBNF
|
20
|
+
* This will be 0 if RBNF support is not included in ICU
|
21
|
+
* and 1 if it is.
|
22
|
+
*
|
23
|
+
* @stable ICU 2.4
|
24
|
+
*/
|
25
|
+
#if UCONFIG_NO_FORMATTING
|
26
|
+
#define U_HAVE_RBNF 0
|
27
|
+
#else
|
28
|
+
#define U_HAVE_RBNF 1
|
29
|
+
|
30
|
+
#include "unicode/dcfmtsym.h"
|
31
|
+
#include "unicode/fmtable.h"
|
32
|
+
#include "unicode/locid.h"
|
33
|
+
#include "unicode/numfmt.h"
|
34
|
+
#include "unicode/unistr.h"
|
35
|
+
#include "unicode/strenum.h"
|
36
|
+
#include "unicode/brkiter.h"
|
37
|
+
#include "unicode/upluralrules.h"
|
38
|
+
|
39
|
+
U_NAMESPACE_BEGIN
|
40
|
+
|
41
|
+
class NFRuleSet;
|
42
|
+
class LocalizationInfo;
|
43
|
+
class PluralFormat;
|
44
|
+
class RuleBasedCollator;
|
45
|
+
|
46
|
+
/**
|
47
|
+
* Tags for the predefined rulesets.
|
48
|
+
*
|
49
|
+
* @stable ICU 2.2
|
50
|
+
*/
|
51
|
+
enum URBNFRuleSetTag {
|
52
|
+
URBNF_SPELLOUT,
|
53
|
+
URBNF_ORDINAL,
|
54
|
+
URBNF_DURATION,
|
55
|
+
URBNF_NUMBERING_SYSTEM,
|
56
|
+
URBNF_COUNT
|
57
|
+
};
|
58
|
+
|
59
|
+
/**
|
60
|
+
* The RuleBasedNumberFormat class formats numbers according to a set of rules. This number formatter is
|
61
|
+
* typically used for spelling out numeric values in words (e.g., 25,3476 as
|
62
|
+
* "twenty-five thousand three hundred seventy-six" or "vingt-cinq mille trois
|
63
|
+
* cents soixante-seize" or
|
64
|
+
* "fünfundzwanzigtausenddreihundertsechsundsiebzig"), but can also be used for
|
65
|
+
* other complicated formatting tasks, such as formatting a number of seconds as hours,
|
66
|
+
* minutes and seconds (e.g., 3,730 as "1:02:10").
|
67
|
+
*
|
68
|
+
* <p>The resources contain three predefined formatters for each locale: spellout, which
|
69
|
+
* spells out a value in words (123 is "one hundred twenty-three"); ordinal, which
|
70
|
+
* appends an ordinal suffix to the end of a numeral (123 is "123rd"); and
|
71
|
+
* duration, which shows a duration in seconds as hours, minutes, and seconds (123 is
|
72
|
+
* "2:03"). The client can also define more specialized <tt>RuleBasedNumberFormat</tt>s
|
73
|
+
* by supplying programmer-defined rule sets.</p>
|
74
|
+
*
|
75
|
+
* <p>The behavior of a <tt>RuleBasedNumberFormat</tt> is specified by a textual description
|
76
|
+
* that is either passed to the constructor as a <tt>String</tt> or loaded from a resource
|
77
|
+
* bundle. In its simplest form, the description consists of a semicolon-delimited list of <em>rules.</em>
|
78
|
+
* Each rule has a string of output text and a value or range of values it is applicable to.
|
79
|
+
* In a typical spellout rule set, the first twenty rules are the words for the numbers from
|
80
|
+
* 0 to 19:</p>
|
81
|
+
*
|
82
|
+
* <pre>zero; one; two; three; four; five; six; seven; eight; nine;
|
83
|
+
* ten; eleven; twelve; thirteen; fourteen; fifteen; sixteen; seventeen; eighteen; nineteen;</pre>
|
84
|
+
*
|
85
|
+
* <p>For larger numbers, we can use the preceding set of rules to format the ones place, and
|
86
|
+
* we only have to supply the words for the multiples of 10:</p>
|
87
|
+
*
|
88
|
+
* <pre> 20: twenty[->>];
|
89
|
+
* 30: thirty[->>];
|
90
|
+
* 40: forty[->>];
|
91
|
+
* 50: fifty[->>];
|
92
|
+
* 60: sixty[->>];
|
93
|
+
* 70: seventy[->>];
|
94
|
+
* 80: eighty[->>];
|
95
|
+
* 90: ninety[->>];</pre>
|
96
|
+
*
|
97
|
+
* <p>In these rules, the <em>base value</em> is spelled out explicitly and set off from the
|
98
|
+
* rule's output text with a colon. The rules are in a sorted list, and a rule is applicable
|
99
|
+
* to all numbers from its own base value to one less than the next rule's base value. The
|
100
|
+
* ">>" token is called a <em>substitution</em> and tells the fomatter to
|
101
|
+
* isolate the number's ones digit, format it using this same set of rules, and place the
|
102
|
+
* result at the position of the ">>" token. Text in brackets is omitted if
|
103
|
+
* the number being formatted is an even multiple of 10 (the hyphen is a literal hyphen; 24
|
104
|
+
* is "twenty-four," not "twenty four").</p>
|
105
|
+
*
|
106
|
+
* <p>For even larger numbers, we can actually look up several parts of the number in the
|
107
|
+
* list:</p>
|
108
|
+
*
|
109
|
+
* <pre>100: << hundred[ >>];</pre>
|
110
|
+
*
|
111
|
+
* <p>The "<<" represents a new kind of substitution. The << isolates
|
112
|
+
* the hundreds digit (and any digits to its left), formats it using this same rule set, and
|
113
|
+
* places the result where the "<<" was. Notice also that the meaning of
|
114
|
+
* >> has changed: it now refers to both the tens and the ones digits. The meaning of
|
115
|
+
* both substitutions depends on the rule's base value. The base value determines the rule's <em>divisor,</em>
|
116
|
+
* which is the highest power of 10 that is less than or equal to the base value (the user
|
117
|
+
* can change this). To fill in the substitutions, the formatter divides the number being
|
118
|
+
* formatted by the divisor. The integral quotient is used to fill in the <<
|
119
|
+
* substitution, and the remainder is used to fill in the >> substitution. The meaning
|
120
|
+
* of the brackets changes similarly: text in brackets is omitted if the value being
|
121
|
+
* formatted is an even multiple of the rule's divisor. The rules are applied recursively, so
|
122
|
+
* if a substitution is filled in with text that includes another substitution, that
|
123
|
+
* substitution is also filled in.</p>
|
124
|
+
*
|
125
|
+
* <p>This rule covers values up to 999, at which point we add another rule:</p>
|
126
|
+
*
|
127
|
+
* <pre>1000: << thousand[ >>];</pre>
|
128
|
+
*
|
129
|
+
* <p>Again, the meanings of the brackets and substitution tokens shift because the rule's
|
130
|
+
* base value is a higher power of 10, changing the rule's divisor. This rule can actually be
|
131
|
+
* used all the way up to 999,999. This allows us to finish out the rules as follows:</p>
|
132
|
+
*
|
133
|
+
* <pre> 1,000,000: << million[ >>];
|
134
|
+
* 1,000,000,000: << billion[ >>];
|
135
|
+
* 1,000,000,000,000: << trillion[ >>];
|
136
|
+
* 1,000,000,000,000,000: OUT OF RANGE!;</pre>
|
137
|
+
*
|
138
|
+
* <p>Commas, periods, and spaces can be used in the base values to improve legibility and
|
139
|
+
* are ignored by the rule parser. The last rule in the list is customarily treated as an
|
140
|
+
* "overflow rule," applying to everything from its base value on up, and often (as
|
141
|
+
* in this example) being used to print out an error message or default representation.
|
142
|
+
* Notice also that the size of the major groupings in large numbers is controlled by the
|
143
|
+
* spacing of the rules: because in English we group numbers by thousand, the higher rules
|
144
|
+
* are separated from each other by a factor of 1,000.</p>
|
145
|
+
*
|
146
|
+
* <p>To see how these rules actually work in practice, consider the following example:
|
147
|
+
* Formatting 25,430 with this rule set would work like this:</p>
|
148
|
+
*
|
149
|
+
* <table border="0" width="100%">
|
150
|
+
* <tr>
|
151
|
+
* <td><strong><< thousand >></strong></td>
|
152
|
+
* <td>[the rule whose base value is 1,000 is applicable to 25,340]</td>
|
153
|
+
* </tr>
|
154
|
+
* <tr>
|
155
|
+
* <td><strong>twenty->></strong> thousand >></td>
|
156
|
+
* <td>[25,340 over 1,000 is 25. The rule for 20 applies.]</td>
|
157
|
+
* </tr>
|
158
|
+
* <tr>
|
159
|
+
* <td>twenty-<strong>five</strong> thousand >></td>
|
160
|
+
* <td>[25 mod 10 is 5. The rule for 5 is "five."</td>
|
161
|
+
* </tr>
|
162
|
+
* <tr>
|
163
|
+
* <td>twenty-five thousand <strong><< hundred >></strong></td>
|
164
|
+
* <td>[25,340 mod 1,000 is 340. The rule for 100 applies.]</td>
|
165
|
+
* </tr>
|
166
|
+
* <tr>
|
167
|
+
* <td>twenty-five thousand <strong>three</strong> hundred >></td>
|
168
|
+
* <td>[340 over 100 is 3. The rule for 3 is "three."]</td>
|
169
|
+
* </tr>
|
170
|
+
* <tr>
|
171
|
+
* <td>twenty-five thousand three hundred <strong>forty</strong></td>
|
172
|
+
* <td>[340 mod 100 is 40. The rule for 40 applies. Since 40 divides
|
173
|
+
* evenly by 10, the hyphen and substitution in the brackets are omitted.]</td>
|
174
|
+
* </tr>
|
175
|
+
* </table>
|
176
|
+
*
|
177
|
+
* <p>The above syntax suffices only to format positive integers. To format negative numbers,
|
178
|
+
* we add a special rule:</p>
|
179
|
+
*
|
180
|
+
* <pre>-x: minus >>;</pre>
|
181
|
+
*
|
182
|
+
* <p>This is called a <em>negative-number rule,</em> and is identified by "-x"
|
183
|
+
* where the base value would be. This rule is used to format all negative numbers. the
|
184
|
+
* >> token here means "find the number's absolute value, format it with these
|
185
|
+
* rules, and put the result here."</p>
|
186
|
+
*
|
187
|
+
* <p>We also add a special rule called a <em>fraction rule </em>for numbers with fractional
|
188
|
+
* parts:</p>
|
189
|
+
*
|
190
|
+
* <pre>x.x: << point >>;</pre>
|
191
|
+
*
|
192
|
+
* <p>This rule is used for all positive non-integers (negative non-integers pass through the
|
193
|
+
* negative-number rule first and then through this rule). Here, the << token refers to
|
194
|
+
* the number's integral part, and the >> to the number's fractional part. The
|
195
|
+
* fractional part is formatted as a series of single-digit numbers (e.g., 123.456 would be
|
196
|
+
* formatted as "one hundred twenty-three point four five six").</p>
|
197
|
+
*
|
198
|
+
* <p>To see how this rule syntax is applied to various languages, examine the resource data.</p>
|
199
|
+
*
|
200
|
+
* <p>There is actually much more flexibility built into the rule language than the
|
201
|
+
* description above shows. A formatter may own multiple rule sets, which can be selected by
|
202
|
+
* the caller, and which can use each other to fill in their substitutions. Substitutions can
|
203
|
+
* also be filled in with digits, using a DecimalFormat object. There is syntax that can be
|
204
|
+
* used to alter a rule's divisor in various ways. And there is provision for much more
|
205
|
+
* flexible fraction handling. A complete description of the rule syntax follows:</p>
|
206
|
+
*
|
207
|
+
* <hr>
|
208
|
+
*
|
209
|
+
* <p>The description of a <tt>RuleBasedNumberFormat</tt>'s behavior consists of one or more <em>rule
|
210
|
+
* sets.</em> Each rule set consists of a name, a colon, and a list of <em>rules.</em> A rule
|
211
|
+
* set name must begin with a % sign. Rule sets with names that begin with a single % sign
|
212
|
+
* are <em>public:</em> the caller can specify that they be used to format and parse numbers.
|
213
|
+
* Rule sets with names that begin with %% are <em>private:</em> they exist only for the use
|
214
|
+
* of other rule sets. If a formatter only has one rule set, the name may be omitted.</p>
|
215
|
+
*
|
216
|
+
* <p>The user can also specify a special "rule set" named <tt>%%lenient-parse</tt>.
|
217
|
+
* The body of <tt>%%lenient-parse</tt> isn't a set of number-formatting rules, but a <tt>RuleBasedCollator</tt>
|
218
|
+
* description which is used to define equivalences for lenient parsing. For more information
|
219
|
+
* on the syntax, see <tt>RuleBasedCollator</tt>. For more information on lenient parsing,
|
220
|
+
* see <tt>setLenientParse()</tt>. <em>Note:</em> symbols that have syntactic meaning
|
221
|
+
* in collation rules, such as '&', have no particular meaning when appearing outside
|
222
|
+
* of the <tt>lenient-parse</tt> rule set.</p>
|
223
|
+
*
|
224
|
+
* <p>The body of a rule set consists of an ordered, semicolon-delimited list of <em>rules.</em>
|
225
|
+
* Internally, every rule has a base value, a divisor, rule text, and zero, one, or two <em>substitutions.</em>
|
226
|
+
* These parameters are controlled by the description syntax, which consists of a <em>rule
|
227
|
+
* descriptor,</em> a colon, and a <em>rule body.</em></p>
|
228
|
+
*
|
229
|
+
* <p>A rule descriptor can take one of the following forms (text in <em>italics</em> is the
|
230
|
+
* name of a token):</p>
|
231
|
+
*
|
232
|
+
* <table border="0" width="100%">
|
233
|
+
* <tr>
|
234
|
+
* <td><em>bv</em>:</td>
|
235
|
+
* <td><em>bv</em> specifies the rule's base value. <em>bv</em> is a decimal
|
236
|
+
* number expressed using ASCII digits. <em>bv</em> may contain spaces, period, and commas,
|
237
|
+
* which are ignored. The rule's divisor is the highest power of 10 less than or equal to
|
238
|
+
* the base value.</td>
|
239
|
+
* </tr>
|
240
|
+
* <tr>
|
241
|
+
* <td><em>bv</em>/<em>rad</em>:</td>
|
242
|
+
* <td><em>bv</em> specifies the rule's base value. The rule's divisor is the
|
243
|
+
* highest power of <em>rad</em> less than or equal to the base value.</td>
|
244
|
+
* </tr>
|
245
|
+
* <tr>
|
246
|
+
* <td><em>bv</em>>:</td>
|
247
|
+
* <td><em>bv</em> specifies the rule's base value. To calculate the divisor,
|
248
|
+
* let the radix be 10, and the exponent be the highest exponent of the radix that yields a
|
249
|
+
* result less than or equal to the base value. Every > character after the base value
|
250
|
+
* decreases the exponent by 1. If the exponent is positive or 0, the divisor is the radix
|
251
|
+
* raised to the power of the exponent; otherwise, the divisor is 1.</td>
|
252
|
+
* </tr>
|
253
|
+
* <tr>
|
254
|
+
* <td><em>bv</em>/<em>rad</em>>:</td>
|
255
|
+
* <td><em>bv</em> specifies the rule's base value. To calculate the divisor,
|
256
|
+
* let the radix be <em>rad</em>, and the exponent be the highest exponent of the radix that
|
257
|
+
* yields a result less than or equal to the base value. Every > character after the radix
|
258
|
+
* decreases the exponent by 1. If the exponent is positive or 0, the divisor is the radix
|
259
|
+
* raised to the power of the exponent; otherwise, the divisor is 1.</td>
|
260
|
+
* </tr>
|
261
|
+
* <tr>
|
262
|
+
* <td>-x:</td>
|
263
|
+
* <td>The rule is a negative-number rule.</td>
|
264
|
+
* </tr>
|
265
|
+
* <tr>
|
266
|
+
* <td>x.x:</td>
|
267
|
+
* <td>The rule is an <em>improper fraction rule.</em></td>
|
268
|
+
* </tr>
|
269
|
+
* <tr>
|
270
|
+
* <td>0.x:</td>
|
271
|
+
* <td>The rule is a <em>proper fraction rule.</em></td>
|
272
|
+
* </tr>
|
273
|
+
* <tr>
|
274
|
+
* <td>x.0:</td>
|
275
|
+
* <td>The rule is a <em>master rule.</em></td>
|
276
|
+
* </tr>
|
277
|
+
* <tr>
|
278
|
+
* <td><em>nothing</em></td>
|
279
|
+
* <td>If the rule's rule descriptor is left out, the base value is one plus the
|
280
|
+
* preceding rule's base value (or zero if this is the first rule in the list) in a normal
|
281
|
+
* rule set. In a fraction rule set, the base value is the same as the preceding rule's
|
282
|
+
* base value.</td>
|
283
|
+
* </tr>
|
284
|
+
* </table>
|
285
|
+
*
|
286
|
+
* <p>A rule set may be either a regular rule set or a <em>fraction rule set,</em> depending
|
287
|
+
* on whether it is used to format a number's integral part (or the whole number) or a
|
288
|
+
* number's fractional part. Using a rule set to format a rule's fractional part makes it a
|
289
|
+
* fraction rule set.</p>
|
290
|
+
*
|
291
|
+
* <p>Which rule is used to format a number is defined according to one of the following
|
292
|
+
* algorithms: If the rule set is a regular rule set, do the following:
|
293
|
+
*
|
294
|
+
* <ul>
|
295
|
+
* <li>If the rule set includes a master rule (and the number was passed in as a <tt>double</tt>),
|
296
|
+
* use the master rule. (If the number being formatted was passed in as a <tt>long</tt>,
|
297
|
+
* the master rule is ignored.)</li>
|
298
|
+
* <li>If the number is negative, use the negative-number rule.</li>
|
299
|
+
* <li>If the number has a fractional part and is greater than 1, use the improper fraction
|
300
|
+
* rule.</li>
|
301
|
+
* <li>If the number has a fractional part and is between 0 and 1, use the proper fraction
|
302
|
+
* rule.</li>
|
303
|
+
* <li>Binary-search the rule list for the rule with the highest base value less than or equal
|
304
|
+
* to the number. If that rule has two substitutions, its base value is not an even multiple
|
305
|
+
* of its divisor, and the number <em>is</em> an even multiple of the rule's divisor, use the
|
306
|
+
* rule that precedes it in the rule list. Otherwise, use the rule itself.</li>
|
307
|
+
* </ul>
|
308
|
+
*
|
309
|
+
* <p>If the rule set is a fraction rule set, do the following:
|
310
|
+
*
|
311
|
+
* <ul>
|
312
|
+
* <li>Ignore negative-number and fraction rules.</li>
|
313
|
+
* <li>For each rule in the list, multiply the number being formatted (which will always be
|
314
|
+
* between 0 and 1) by the rule's base value. Keep track of the distance between the result
|
315
|
+
* the nearest integer.</li>
|
316
|
+
* <li>Use the rule that produced the result closest to zero in the above calculation. In the
|
317
|
+
* event of a tie or a direct hit, use the first matching rule encountered. (The idea here is
|
318
|
+
* to try each rule's base value as a possible denominator of a fraction. Whichever
|
319
|
+
* denominator produces the fraction closest in value to the number being formatted wins.) If
|
320
|
+
* the rule following the matching rule has the same base value, use it if the numerator of
|
321
|
+
* the fraction is anything other than 1; if the numerator is 1, use the original matching
|
322
|
+
* rule. (This is to allow singular and plural forms of the rule text without a lot of extra
|
323
|
+
* hassle.)</li>
|
324
|
+
* </ul>
|
325
|
+
*
|
326
|
+
* <p>A rule's body consists of a string of characters terminated by a semicolon. The rule
|
327
|
+
* may include zero, one, or two <em>substitution tokens,</em> and a range of text in
|
328
|
+
* brackets. The brackets denote optional text (and may also include one or both
|
329
|
+
* substitutions). The exact meanings of the substitution tokens, and under what conditions
|
330
|
+
* optional text is omitted, depend on the syntax of the substitution token and the context.
|
331
|
+
* The rest of the text in a rule body is literal text that is output when the rule matches
|
332
|
+
* the number being formatted.</p>
|
333
|
+
*
|
334
|
+
* <p>A substitution token begins and ends with a <em>token character.</em> The token
|
335
|
+
* character and the context together specify a mathematical operation to be performed on the
|
336
|
+
* number being formatted. An optional <em>substitution descriptor </em>specifies how the
|
337
|
+
* value resulting from that operation is used to fill in the substitution. The position of
|
338
|
+
* the substitution token in the rule body specifies the location of the resultant text in
|
339
|
+
* the original rule text.</p>
|
340
|
+
*
|
341
|
+
* <p>The meanings of the substitution token characters are as follows:</p>
|
342
|
+
*
|
343
|
+
* <table border="0" width="100%">
|
344
|
+
* <tr>
|
345
|
+
* <td>>></td>
|
346
|
+
* <td>in normal rule</td>
|
347
|
+
* <td>Divide the number by the rule's divisor and format the remainder</td>
|
348
|
+
* </tr>
|
349
|
+
* <tr>
|
350
|
+
* <td></td>
|
351
|
+
* <td>in negative-number rule</td>
|
352
|
+
* <td>Find the absolute value of the number and format the result</td>
|
353
|
+
* </tr>
|
354
|
+
* <tr>
|
355
|
+
* <td></td>
|
356
|
+
* <td>in fraction or master rule</td>
|
357
|
+
* <td>Isolate the number's fractional part and format it.</td>
|
358
|
+
* </tr>
|
359
|
+
* <tr>
|
360
|
+
* <td></td>
|
361
|
+
* <td>in rule in fraction rule set</td>
|
362
|
+
* <td>Not allowed.</td>
|
363
|
+
* </tr>
|
364
|
+
* <tr>
|
365
|
+
* <td>>>></td>
|
366
|
+
* <td>in normal rule</td>
|
367
|
+
* <td>Divide the number by the rule's divisor and format the remainder,
|
368
|
+
* but bypass the normal rule-selection process and just use the
|
369
|
+
* rule that precedes this one in this rule list.</td>
|
370
|
+
* </tr>
|
371
|
+
* <tr>
|
372
|
+
* <td></td>
|
373
|
+
* <td>in all other rules</td>
|
374
|
+
* <td>Not allowed.</td>
|
375
|
+
* </tr>
|
376
|
+
* <tr>
|
377
|
+
* <td><<</td>
|
378
|
+
* <td>in normal rule</td>
|
379
|
+
* <td>Divide the number by the rule's divisor and format the quotient</td>
|
380
|
+
* </tr>
|
381
|
+
* <tr>
|
382
|
+
* <td></td>
|
383
|
+
* <td>in negative-number rule</td>
|
384
|
+
* <td>Not allowed.</td>
|
385
|
+
* </tr>
|
386
|
+
* <tr>
|
387
|
+
* <td></td>
|
388
|
+
* <td>in fraction or master rule</td>
|
389
|
+
* <td>Isolate the number's integral part and format it.</td>
|
390
|
+
* </tr>
|
391
|
+
* <tr>
|
392
|
+
* <td></td>
|
393
|
+
* <td>in rule in fraction rule set</td>
|
394
|
+
* <td>Multiply the number by the rule's base value and format the result.</td>
|
395
|
+
* </tr>
|
396
|
+
* <tr>
|
397
|
+
* <td>==</td>
|
398
|
+
* <td>in all rule sets</td>
|
399
|
+
* <td>Format the number unchanged</td>
|
400
|
+
* </tr>
|
401
|
+
* <tr>
|
402
|
+
* <td>[]</td>
|
403
|
+
* <td>in normal rule</td>
|
404
|
+
* <td>Omit the optional text if the number is an even multiple of the rule's divisor</td>
|
405
|
+
* </tr>
|
406
|
+
* <tr>
|
407
|
+
* <td></td>
|
408
|
+
* <td>in negative-number rule</td>
|
409
|
+
* <td>Not allowed.</td>
|
410
|
+
* </tr>
|
411
|
+
* <tr>
|
412
|
+
* <td></td>
|
413
|
+
* <td>in improper-fraction rule</td>
|
414
|
+
* <td>Omit the optional text if the number is between 0 and 1 (same as specifying both an
|
415
|
+
* x.x rule and a 0.x rule)</td>
|
416
|
+
* </tr>
|
417
|
+
* <tr>
|
418
|
+
* <td></td>
|
419
|
+
* <td>in master rule</td>
|
420
|
+
* <td>Omit the optional text if the number is an integer (same as specifying both an x.x
|
421
|
+
* rule and an x.0 rule)</td>
|
422
|
+
* </tr>
|
423
|
+
* <tr>
|
424
|
+
* <td></td>
|
425
|
+
* <td>in proper-fraction rule</td>
|
426
|
+
* <td>Not allowed.</td>
|
427
|
+
* </tr>
|
428
|
+
* <tr>
|
429
|
+
* <td></td>
|
430
|
+
* <td>in rule in fraction rule set</td>
|
431
|
+
* <td>Omit the optional text if multiplying the number by the rule's base value yields 1.</td>
|
432
|
+
* </tr>
|
433
|
+
* <tr>
|
434
|
+
* <td width="37">$(cardinal,<i>plural syntax</i>)$</td>
|
435
|
+
* <td width="23"></td>
|
436
|
+
* <td width="165" valign="top">in all rule sets</td>
|
437
|
+
* <td>This provides the ability to choose a word based on the number divided by the radix to the power of the
|
438
|
+
* exponent of the base value for the specified locale, which is normally equivalent to the << value.
|
439
|
+
* This uses the cardinal plural rules from PluralFormat. All strings used in the plural format are treated
|
440
|
+
* as the same base value for parsing.</td>
|
441
|
+
* </tr>
|
442
|
+
* <tr>
|
443
|
+
* <td width="37">$(ordinal,<i>plural syntax</i>)$</td>
|
444
|
+
* <td width="23"></td>
|
445
|
+
* <td width="165" valign="top">in all rule sets</td>
|
446
|
+
* <td>This provides the ability to choose a word based on the number divided by the radix to the power of the
|
447
|
+
* exponent of the base value for the specified locale, which is normally equivalent to the << value.
|
448
|
+
* This uses the ordinal plural rules from PluralFormat. All strings used in the plural format are treated
|
449
|
+
* as the same base value for parsing.</td>
|
450
|
+
* </tr>
|
451
|
+
* </table>
|
452
|
+
*
|
453
|
+
* <p>The substitution descriptor (i.e., the text between the token characters) may take one
|
454
|
+
* of three forms:</p>
|
455
|
+
*
|
456
|
+
* <table border="0" width="100%">
|
457
|
+
* <tr>
|
458
|
+
* <td>a rule set name</td>
|
459
|
+
* <td>Perform the mathematical operation on the number, and format the result using the
|
460
|
+
* named rule set.</td>
|
461
|
+
* </tr>
|
462
|
+
* <tr>
|
463
|
+
* <td>a DecimalFormat pattern</td>
|
464
|
+
* <td>Perform the mathematical operation on the number, and format the result using a
|
465
|
+
* DecimalFormat with the specified pattern. The pattern must begin with 0 or #.</td>
|
466
|
+
* </tr>
|
467
|
+
* <tr>
|
468
|
+
* <td>nothing</td>
|
469
|
+
* <td>Perform the mathematical operation on the number, and format the result using the rule
|
470
|
+
* set containing the current rule, except:
|
471
|
+
* <ul>
|
472
|
+
* <li>You can't have an empty substitution descriptor with a == substitution.</li>
|
473
|
+
* <li>If you omit the substitution descriptor in a >> substitution in a fraction rule,
|
474
|
+
* format the result one digit at a time using the rule set containing the current rule.</li>
|
475
|
+
* <li>If you omit the substitution descriptor in a << substitution in a rule in a
|
476
|
+
* fraction rule set, format the result using the default rule set for this formatter.</li>
|
477
|
+
* </ul>
|
478
|
+
* </td>
|
479
|
+
* </tr>
|
480
|
+
* </table>
|
481
|
+
*
|
482
|
+
* <p>Whitespace is ignored between a rule set name and a rule set body, between a rule
|
483
|
+
* descriptor and a rule body, or between rules. If a rule body begins with an apostrophe,
|
484
|
+
* the apostrophe is ignored, but all text after it becomes significant (this is how you can
|
485
|
+
* have a rule's rule text begin with whitespace). There is no escape function: the semicolon
|
486
|
+
* is not allowed in rule set names or in rule text, and the colon is not allowed in rule set
|
487
|
+
* names. The characters beginning a substitution token are always treated as the beginning
|
488
|
+
* of a substitution token.</p>
|
489
|
+
*
|
490
|
+
* <p>See the resource data and the demo program for annotated examples of real rule sets
|
491
|
+
* using these features.</p>
|
492
|
+
*
|
493
|
+
* <p><em>User subclasses are not supported.</em> While clients may write
|
494
|
+
* subclasses, such code will not necessarily work and will not be
|
495
|
+
* guaranteed to work stably from release to release.
|
496
|
+
*
|
497
|
+
* <p><b>Localizations</b></p>
|
498
|
+
* <p>Constructors are available that allow the specification of localizations for the
|
499
|
+
* public rule sets (and also allow more control over what public rule sets are available).
|
500
|
+
* Localization data is represented as a textual description. The description represents
|
501
|
+
* an array of arrays of string. The first element is an array of the public rule set names,
|
502
|
+
* each of these must be one of the public rule set names that appear in the rules. Only
|
503
|
+
* names in this array will be treated as public rule set names by the API. Each subsequent
|
504
|
+
* element is an array of localizations of these names. The first element of one of these
|
505
|
+
* subarrays is the locale name, and the remaining elements are localizations of the
|
506
|
+
* public rule set names, in the same order as they were listed in the first arrray.</p>
|
507
|
+
* <p>In the syntax, angle brackets '<', '>' are used to delimit the arrays, and comma ',' is used
|
508
|
+
* to separate elements of an array. Whitespace is ignored, unless quoted.</p>
|
509
|
+
* <p>For example:<pre>
|
510
|
+
* < < %foo, %bar, %baz >,
|
511
|
+
* < en, Foo, Bar, Baz >,
|
512
|
+
* < fr, 'le Foo', 'le Bar', 'le Baz' >
|
513
|
+
* < zh, \\u7532, \\u4e59, \\u4e19 > >
|
514
|
+
* </pre></p>
|
515
|
+
* @author Richard Gillam
|
516
|
+
* @see NumberFormat
|
517
|
+
* @see DecimalFormat
|
518
|
+
* @see PluralFormat
|
519
|
+
* @see PluralRules
|
520
|
+
* @stable ICU 2.0
|
521
|
+
*/
|
522
|
+
class U_I18N_API RuleBasedNumberFormat : public NumberFormat {
|
523
|
+
public:
|
524
|
+
|
525
|
+
//-----------------------------------------------------------------------
|
526
|
+
// constructors
|
527
|
+
//-----------------------------------------------------------------------
|
528
|
+
|
529
|
+
/**
|
530
|
+
* Creates a RuleBasedNumberFormat that behaves according to the description
|
531
|
+
* passed in. The formatter uses the default locale.
|
532
|
+
* @param rules A description of the formatter's desired behavior.
|
533
|
+
* See the class documentation for a complete explanation of the description
|
534
|
+
* syntax.
|
535
|
+
* @param perror The parse error if an error was encountered.
|
536
|
+
* @param status The status indicating whether the constructor succeeded.
|
537
|
+
* @stable ICU 3.2
|
538
|
+
*/
|
539
|
+
RuleBasedNumberFormat(const UnicodeString& rules, UParseError& perror, UErrorCode& status);
|
540
|
+
|
541
|
+
/**
|
542
|
+
* Creates a RuleBasedNumberFormat that behaves according to the description
|
543
|
+
* passed in. The formatter uses the default locale.
|
544
|
+
* <p>
|
545
|
+
* The localizations data provides information about the public
|
546
|
+
* rule sets and their localized display names for different
|
547
|
+
* locales. The first element in the list is an array of the names
|
548
|
+
* of the public rule sets. The first element in this array is
|
549
|
+
* the initial default ruleset. The remaining elements in the
|
550
|
+
* list are arrays of localizations of the names of the public
|
551
|
+
* rule sets. Each of these is one longer than the initial array,
|
552
|
+
* with the first String being the ULocale ID, and the remaining
|
553
|
+
* Strings being the localizations of the rule set names, in the
|
554
|
+
* same order as the initial array. Arrays are NULL-terminated.
|
555
|
+
* @param rules A description of the formatter's desired behavior.
|
556
|
+
* See the class documentation for a complete explanation of the description
|
557
|
+
* syntax.
|
558
|
+
* @param localizations the localization information.
|
559
|
+
* names in the description. These will be copied by the constructor.
|
560
|
+
* @param perror The parse error if an error was encountered.
|
561
|
+
* @param status The status indicating whether the constructor succeeded.
|
562
|
+
* @stable ICU 3.2
|
563
|
+
*/
|
564
|
+
RuleBasedNumberFormat(const UnicodeString& rules, const UnicodeString& localizations,
|
565
|
+
UParseError& perror, UErrorCode& status);
|
566
|
+
|
567
|
+
/**
|
568
|
+
* Creates a RuleBasedNumberFormat that behaves according to the rules
|
569
|
+
* passed in. The formatter uses the specified locale to determine the
|
570
|
+
* characters to use when formatting numerals, and to define equivalences
|
571
|
+
* for lenient parsing.
|
572
|
+
* @param rules The formatter rules.
|
573
|
+
* See the class documentation for a complete explanation of the rule
|
574
|
+
* syntax.
|
575
|
+
* @param locale A locale that governs which characters are used for
|
576
|
+
* formatting values in numerals and which characters are equivalent in
|
577
|
+
* lenient parsing.
|
578
|
+
* @param perror The parse error if an error was encountered.
|
579
|
+
* @param status The status indicating whether the constructor succeeded.
|
580
|
+
* @stable ICU 2.0
|
581
|
+
*/
|
582
|
+
RuleBasedNumberFormat(const UnicodeString& rules, const Locale& locale,
|
583
|
+
UParseError& perror, UErrorCode& status);
|
584
|
+
|
585
|
+
/**
|
586
|
+
* Creates a RuleBasedNumberFormat that behaves according to the description
|
587
|
+
* passed in. The formatter uses the default locale.
|
588
|
+
* <p>
|
589
|
+
* The localizations data provides information about the public
|
590
|
+
* rule sets and their localized display names for different
|
591
|
+
* locales. The first element in the list is an array of the names
|
592
|
+
* of the public rule sets. The first element in this array is
|
593
|
+
* the initial default ruleset. The remaining elements in the
|
594
|
+
* list are arrays of localizations of the names of the public
|
595
|
+
* rule sets. Each of these is one longer than the initial array,
|
596
|
+
* with the first String being the ULocale ID, and the remaining
|
597
|
+
* Strings being the localizations of the rule set names, in the
|
598
|
+
* same order as the initial array. Arrays are NULL-terminated.
|
599
|
+
* @param rules A description of the formatter's desired behavior.
|
600
|
+
* See the class documentation for a complete explanation of the description
|
601
|
+
* syntax.
|
602
|
+
* @param localizations a list of localizations for the rule set
|
603
|
+
* names in the description. These will be copied by the constructor.
|
604
|
+
* @param locale A locale that governs which characters are used for
|
605
|
+
* formatting values in numerals and which characters are equivalent in
|
606
|
+
* lenient parsing.
|
607
|
+
* @param perror The parse error if an error was encountered.
|
608
|
+
* @param status The status indicating whether the constructor succeeded.
|
609
|
+
* @stable ICU 3.2
|
610
|
+
*/
|
611
|
+
RuleBasedNumberFormat(const UnicodeString& rules, const UnicodeString& localizations,
|
612
|
+
const Locale& locale, UParseError& perror, UErrorCode& status);
|
613
|
+
|
614
|
+
/**
|
615
|
+
* Creates a RuleBasedNumberFormat from a predefined ruleset. The selector
|
616
|
+
* code choosed among three possible predefined formats: spellout, ordinal,
|
617
|
+
* and duration.
|
618
|
+
* @param tag A selector code specifying which kind of formatter to create for that
|
619
|
+
* locale. There are four legal values: URBNF_SPELLOUT, which creates a formatter that
|
620
|
+
* spells out a value in words in the desired language, URBNF_ORDINAL, which attaches
|
621
|
+
* an ordinal suffix from the desired language to the end of a number (e.g. "123rd"),
|
622
|
+
* URBNF_DURATION, which formats a duration in seconds as hours, minutes, and seconds,
|
623
|
+
* and URBNF_NUMBERING_SYSTEM, which is used to invoke rules for alternate numbering
|
624
|
+
* systems such as the Hebrew numbering system, or for Roman Numerals, etc.
|
625
|
+
* @param locale The locale for the formatter.
|
626
|
+
* @param status The status indicating whether the constructor succeeded.
|
627
|
+
* @stable ICU 2.0
|
628
|
+
*/
|
629
|
+
RuleBasedNumberFormat(URBNFRuleSetTag tag, const Locale& locale, UErrorCode& status);
|
630
|
+
|
631
|
+
//-----------------------------------------------------------------------
|
632
|
+
// boilerplate
|
633
|
+
//-----------------------------------------------------------------------
|
634
|
+
|
635
|
+
/**
|
636
|
+
* Copy constructor
|
637
|
+
* @param rhs the object to be copied from.
|
638
|
+
* @stable ICU 2.6
|
639
|
+
*/
|
640
|
+
RuleBasedNumberFormat(const RuleBasedNumberFormat& rhs);
|
641
|
+
|
642
|
+
/**
|
643
|
+
* Assignment operator
|
644
|
+
* @param rhs the object to be copied from.
|
645
|
+
* @stable ICU 2.6
|
646
|
+
*/
|
647
|
+
RuleBasedNumberFormat& operator=(const RuleBasedNumberFormat& rhs);
|
648
|
+
|
649
|
+
/**
|
650
|
+
* Release memory allocated for a RuleBasedNumberFormat when you are finished with it.
|
651
|
+
* @stable ICU 2.6
|
652
|
+
*/
|
653
|
+
virtual ~RuleBasedNumberFormat();
|
654
|
+
|
655
|
+
/**
|
656
|
+
* Clone this object polymorphically. The caller is responsible
|
657
|
+
* for deleting the result when done.
|
658
|
+
* @return A copy of the object.
|
659
|
+
* @stable ICU 2.6
|
660
|
+
*/
|
661
|
+
virtual Format* clone(void) const;
|
662
|
+
|
663
|
+
/**
|
664
|
+
* Return true if the given Format objects are semantically equal.
|
665
|
+
* Objects of different subclasses are considered unequal.
|
666
|
+
* @param other the object to be compared with.
|
667
|
+
* @return true if the given Format objects are semantically equal.
|
668
|
+
* @stable ICU 2.6
|
669
|
+
*/
|
670
|
+
virtual UBool operator==(const Format& other) const;
|
671
|
+
|
672
|
+
//-----------------------------------------------------------------------
|
673
|
+
// public API functions
|
674
|
+
//-----------------------------------------------------------------------
|
675
|
+
|
676
|
+
/**
|
677
|
+
* return the rules that were provided to the RuleBasedNumberFormat.
|
678
|
+
* @return the result String that was passed in
|
679
|
+
* @stable ICU 2.0
|
680
|
+
*/
|
681
|
+
virtual UnicodeString getRules() const;
|
682
|
+
|
683
|
+
/**
|
684
|
+
* Return the number of public rule set names.
|
685
|
+
* @return the number of public rule set names.
|
686
|
+
* @stable ICU 2.0
|
687
|
+
*/
|
688
|
+
virtual int32_t getNumberOfRuleSetNames() const;
|
689
|
+
|
690
|
+
/**
|
691
|
+
* Return the name of the index'th public ruleSet. If index is not valid,
|
692
|
+
* the function returns null.
|
693
|
+
* @param index the index of the ruleset
|
694
|
+
* @return the name of the index'th public ruleSet.
|
695
|
+
* @stable ICU 2.0
|
696
|
+
*/
|
697
|
+
virtual UnicodeString getRuleSetName(int32_t index) const;
|
698
|
+
|
699
|
+
/**
|
700
|
+
* Return the number of locales for which we have localized rule set display names.
|
701
|
+
* @return the number of locales for which we have localized rule set display names.
|
702
|
+
* @stable ICU 3.2
|
703
|
+
*/
|
704
|
+
virtual int32_t getNumberOfRuleSetDisplayNameLocales(void) const;
|
705
|
+
|
706
|
+
/**
|
707
|
+
* Return the index'th display name locale.
|
708
|
+
* @param index the index of the locale
|
709
|
+
* @param status set to a failure code when this function fails
|
710
|
+
* @return the locale
|
711
|
+
* @see #getNumberOfRuleSetDisplayNameLocales
|
712
|
+
* @stable ICU 3.2
|
713
|
+
*/
|
714
|
+
virtual Locale getRuleSetDisplayNameLocale(int32_t index, UErrorCode& status) const;
|
715
|
+
|
716
|
+
/**
|
717
|
+
* Return the rule set display names for the provided locale. These are in the same order
|
718
|
+
* as those returned by getRuleSetName. The locale is matched against the locales for
|
719
|
+
* which there is display name data, using normal fallback rules. If no locale matches,
|
720
|
+
* the default display names are returned. (These are the internal rule set names minus
|
721
|
+
* the leading '%'.)
|
722
|
+
* @param index the index of the rule set
|
723
|
+
* @param locale the locale (returned by getRuleSetDisplayNameLocales) for which the localized
|
724
|
+
* display name is desired
|
725
|
+
* @return the display name for the given index, which might be bogus if there is an error
|
726
|
+
* @see #getRuleSetName
|
727
|
+
* @stable ICU 3.2
|
728
|
+
*/
|
729
|
+
virtual UnicodeString getRuleSetDisplayName(int32_t index,
|
730
|
+
const Locale& locale = Locale::getDefault());
|
731
|
+
|
732
|
+
/**
|
733
|
+
* Return the rule set display name for the provided rule set and locale.
|
734
|
+
* The locale is matched against the locales for which there is display name data, using
|
735
|
+
* normal fallback rules. If no locale matches, the default display name is returned.
|
736
|
+
* @return the display name for the rule set
|
737
|
+
* @stable ICU 3.2
|
738
|
+
* @see #getRuleSetDisplayName
|
739
|
+
*/
|
740
|
+
virtual UnicodeString getRuleSetDisplayName(const UnicodeString& ruleSetName,
|
741
|
+
const Locale& locale = Locale::getDefault());
|
742
|
+
|
743
|
+
|
744
|
+
using NumberFormat::format;
|
745
|
+
|
746
|
+
/**
|
747
|
+
* Formats the specified 32-bit number using the default ruleset.
|
748
|
+
* @param number The number to format.
|
749
|
+
* @param toAppendTo the string that will hold the (appended) result
|
750
|
+
* @param pos the fieldposition
|
751
|
+
* @return A textual representation of the number.
|
752
|
+
* @stable ICU 2.0
|
753
|
+
*/
|
754
|
+
virtual UnicodeString& format(int32_t number,
|
755
|
+
UnicodeString& toAppendTo,
|
756
|
+
FieldPosition& pos) const;
|
757
|
+
|
758
|
+
/**
|
759
|
+
* Formats the specified 64-bit number using the default ruleset.
|
760
|
+
* @param number The number to format.
|
761
|
+
* @param toAppendTo the string that will hold the (appended) result
|
762
|
+
* @param pos the fieldposition
|
763
|
+
* @return A textual representation of the number.
|
764
|
+
* @stable ICU 2.1
|
765
|
+
*/
|
766
|
+
virtual UnicodeString& format(int64_t number,
|
767
|
+
UnicodeString& toAppendTo,
|
768
|
+
FieldPosition& pos) const;
|
769
|
+
/**
|
770
|
+
* Formats the specified number using the default ruleset.
|
771
|
+
* @param number The number to format.
|
772
|
+
* @param toAppendTo the string that will hold the (appended) result
|
773
|
+
* @param pos the fieldposition
|
774
|
+
* @return A textual representation of the number.
|
775
|
+
* @stable ICU 2.0
|
776
|
+
*/
|
777
|
+
virtual UnicodeString& format(double number,
|
778
|
+
UnicodeString& toAppendTo,
|
779
|
+
FieldPosition& pos) const;
|
780
|
+
|
781
|
+
/**
|
782
|
+
* Formats the specified number using the named ruleset.
|
783
|
+
* @param number The number to format.
|
784
|
+
* @param ruleSetName The name of the rule set to format the number with.
|
785
|
+
* This must be the name of a valid public rule set for this formatter.
|
786
|
+
* @param toAppendTo the string that will hold the (appended) result
|
787
|
+
* @param pos the fieldposition
|
788
|
+
* @param status the status
|
789
|
+
* @return A textual representation of the number.
|
790
|
+
* @stable ICU 2.0
|
791
|
+
*/
|
792
|
+
virtual UnicodeString& format(int32_t number,
|
793
|
+
const UnicodeString& ruleSetName,
|
794
|
+
UnicodeString& toAppendTo,
|
795
|
+
FieldPosition& pos,
|
796
|
+
UErrorCode& status) const;
|
797
|
+
/**
|
798
|
+
* Formats the specified 64-bit number using the named ruleset.
|
799
|
+
* @param number The number to format.
|
800
|
+
* @param ruleSetName The name of the rule set to format the number with.
|
801
|
+
* This must be the name of a valid public rule set for this formatter.
|
802
|
+
* @param toAppendTo the string that will hold the (appended) result
|
803
|
+
* @param pos the fieldposition
|
804
|
+
* @param status the status
|
805
|
+
* @return A textual representation of the number.
|
806
|
+
* @stable ICU 2.1
|
807
|
+
*/
|
808
|
+
virtual UnicodeString& format(int64_t number,
|
809
|
+
const UnicodeString& ruleSetName,
|
810
|
+
UnicodeString& toAppendTo,
|
811
|
+
FieldPosition& pos,
|
812
|
+
UErrorCode& status) const;
|
813
|
+
/**
|
814
|
+
* Formats the specified number using the named ruleset.
|
815
|
+
* @param number The number to format.
|
816
|
+
* @param ruleSetName The name of the rule set to format the number with.
|
817
|
+
* This must be the name of a valid public rule set for this formatter.
|
818
|
+
* @param toAppendTo the string that will hold the (appended) result
|
819
|
+
* @param pos the fieldposition
|
820
|
+
* @param status the status
|
821
|
+
* @return A textual representation of the number.
|
822
|
+
* @stable ICU 2.0
|
823
|
+
*/
|
824
|
+
virtual UnicodeString& format(double number,
|
825
|
+
const UnicodeString& ruleSetName,
|
826
|
+
UnicodeString& toAppendTo,
|
827
|
+
FieldPosition& pos,
|
828
|
+
UErrorCode& status) const;
|
829
|
+
|
830
|
+
using NumberFormat::parse;
|
831
|
+
|
832
|
+
/**
|
833
|
+
* Parses the specfied string, beginning at the specified position, according
|
834
|
+
* to this formatter's rules. This will match the string against all of the
|
835
|
+
* formatter's public rule sets and return the value corresponding to the longest
|
836
|
+
* parseable substring. This function's behavior is affected by the lenient
|
837
|
+
* parse mode.
|
838
|
+
* @param text The string to parse
|
839
|
+
* @param result the result of the parse, either a double or a long.
|
840
|
+
* @param parsePosition On entry, contains the position of the first character
|
841
|
+
* in "text" to examine. On exit, has been updated to contain the position
|
842
|
+
* of the first character in "text" that wasn't consumed by the parse.
|
843
|
+
* @see #setLenient
|
844
|
+
* @stable ICU 2.0
|
845
|
+
*/
|
846
|
+
virtual void parse(const UnicodeString& text,
|
847
|
+
Formattable& result,
|
848
|
+
ParsePosition& parsePosition) const;
|
849
|
+
|
850
|
+
#if !UCONFIG_NO_COLLATION
|
851
|
+
|
852
|
+
/**
|
853
|
+
* Turns lenient parse mode on and off.
|
854
|
+
*
|
855
|
+
* When in lenient parse mode, the formatter uses a Collator for parsing the text.
|
856
|
+
* Only primary differences are treated as significant. This means that case
|
857
|
+
* differences, accent differences, alternate spellings of the same letter
|
858
|
+
* (e.g., ae and a-umlaut in German), ignorable characters, etc. are ignored in
|
859
|
+
* matching the text. In many cases, numerals will be accepted in place of words
|
860
|
+
* or phrases as well.
|
861
|
+
*
|
862
|
+
* For example, all of the following will correctly parse as 255 in English in
|
863
|
+
* lenient-parse mode:
|
864
|
+
* <br>"two hundred fifty-five"
|
865
|
+
* <br>"two hundred fifty five"
|
866
|
+
* <br>"TWO HUNDRED FIFTY-FIVE"
|
867
|
+
* <br>"twohundredfiftyfive"
|
868
|
+
* <br>"2 hundred fifty-5"
|
869
|
+
*
|
870
|
+
* The Collator used is determined by the locale that was
|
871
|
+
* passed to this object on construction. The description passed to this object
|
872
|
+
* on construction may supply additional collation rules that are appended to the
|
873
|
+
* end of the default collator for the locale, enabling additional equivalences
|
874
|
+
* (such as adding more ignorable characters or permitting spelled-out version of
|
875
|
+
* symbols; see the demo program for examples).
|
876
|
+
*
|
877
|
+
* It's important to emphasize that even strict parsing is relatively lenient: it
|
878
|
+
* will accept some text that it won't produce as output. In English, for example,
|
879
|
+
* it will correctly parse "two hundred zero" and "fifteen hundred".
|
880
|
+
*
|
881
|
+
* @param enabled If true, turns lenient-parse mode on; if false, turns it off.
|
882
|
+
* @see RuleBasedCollator
|
883
|
+
* @stable ICU 2.0
|
884
|
+
*/
|
885
|
+
virtual void setLenient(UBool enabled);
|
886
|
+
|
887
|
+
/**
|
888
|
+
* Returns true if lenient-parse mode is turned on. Lenient parsing is off
|
889
|
+
* by default.
|
890
|
+
* @return true if lenient-parse mode is turned on.
|
891
|
+
* @see #setLenient
|
892
|
+
* @stable ICU 2.0
|
893
|
+
*/
|
894
|
+
virtual inline UBool isLenient(void) const;
|
895
|
+
|
896
|
+
#endif
|
897
|
+
|
898
|
+
/**
|
899
|
+
* Override the default rule set to use. If ruleSetName is null, reset
|
900
|
+
* to the initial default rule set. If the rule set is not a public rule set name,
|
901
|
+
* U_ILLEGAL_ARGUMENT_ERROR is returned in status.
|
902
|
+
* @param ruleSetName the name of the rule set, or null to reset the initial default.
|
903
|
+
* @param status set to failure code when a problem occurs.
|
904
|
+
* @stable ICU 2.6
|
905
|
+
*/
|
906
|
+
virtual void setDefaultRuleSet(const UnicodeString& ruleSetName, UErrorCode& status);
|
907
|
+
|
908
|
+
/**
|
909
|
+
* Return the name of the current default rule set. If the current rule set is
|
910
|
+
* not public, returns a bogus (and empty) UnicodeString.
|
911
|
+
* @return the name of the current default rule set
|
912
|
+
* @stable ICU 3.0
|
913
|
+
*/
|
914
|
+
virtual UnicodeString getDefaultRuleSetName() const;
|
915
|
+
|
916
|
+
/* Cannot use #ifndef U_HIDE_DRAFT_API for the following draft method since it is virtual */
|
917
|
+
/**
|
918
|
+
* Set a particular UDisplayContext value in the formatter, such as
|
919
|
+
* UDISPCTX_CAPITALIZATION_FOR_STANDALONE. Note: For getContext, see
|
920
|
+
* NumberFormat.
|
921
|
+
* @param value The UDisplayContext value to set.
|
922
|
+
* @param status Input/output status. If at entry this indicates a failure
|
923
|
+
* status, the function will do nothing; otherwise this will be
|
924
|
+
* updated with any new status from the function.
|
925
|
+
* @draft ICU 53
|
926
|
+
*/
|
927
|
+
virtual void setContext(UDisplayContext value, UErrorCode& status);
|
928
|
+
|
929
|
+
public:
|
930
|
+
/**
|
931
|
+
* ICU "poor man's RTTI", returns a UClassID for this class.
|
932
|
+
*
|
933
|
+
* @stable ICU 2.8
|
934
|
+
*/
|
935
|
+
static UClassID U_EXPORT2 getStaticClassID(void);
|
936
|
+
|
937
|
+
/**
|
938
|
+
* ICU "poor man's RTTI", returns a UClassID for the actual class.
|
939
|
+
*
|
940
|
+
* @stable ICU 2.8
|
941
|
+
*/
|
942
|
+
virtual UClassID getDynamicClassID(void) const;
|
943
|
+
|
944
|
+
/**
|
945
|
+
* Sets the decimal format symbols, which is generally not changed
|
946
|
+
* by the programmer or user. The formatter takes ownership of
|
947
|
+
* symbolsToAdopt; the client must not delete it.
|
948
|
+
*
|
949
|
+
* @param symbolsToAdopt DecimalFormatSymbols to be adopted.
|
950
|
+
* @stable ICU 49
|
951
|
+
*/
|
952
|
+
virtual void adoptDecimalFormatSymbols(DecimalFormatSymbols* symbolsToAdopt);
|
953
|
+
|
954
|
+
/**
|
955
|
+
* Sets the decimal format symbols, which is generally not changed
|
956
|
+
* by the programmer or user. A clone of the symbols is created and
|
957
|
+
* the symbols is _not_ adopted; the client is still responsible for
|
958
|
+
* deleting it.
|
959
|
+
*
|
960
|
+
* @param symbols DecimalFormatSymbols.
|
961
|
+
* @stable ICU 49
|
962
|
+
*/
|
963
|
+
virtual void setDecimalFormatSymbols(const DecimalFormatSymbols& symbols);
|
964
|
+
|
965
|
+
private:
|
966
|
+
RuleBasedNumberFormat(); // default constructor not implemented
|
967
|
+
|
968
|
+
// this will ref the localizations if they are not NULL
|
969
|
+
// caller must deref to get adoption
|
970
|
+
RuleBasedNumberFormat(const UnicodeString& description, LocalizationInfo* localizations,
|
971
|
+
const Locale& locale, UParseError& perror, UErrorCode& status);
|
972
|
+
|
973
|
+
void init(const UnicodeString& rules, LocalizationInfo* localizations, UParseError& perror, UErrorCode& status);
|
974
|
+
void initCapitalizationContextInfo(const Locale& thelocale);
|
975
|
+
void dispose();
|
976
|
+
void stripWhitespace(UnicodeString& src);
|
977
|
+
void initDefaultRuleSet();
|
978
|
+
void format(double number, NFRuleSet& ruleSet);
|
979
|
+
NFRuleSet* findRuleSet(const UnicodeString& name, UErrorCode& status) const;
|
980
|
+
|
981
|
+
/* friend access */
|
982
|
+
friend class NFSubstitution;
|
983
|
+
friend class NFRule;
|
984
|
+
friend class FractionalPartSubstitution;
|
985
|
+
|
986
|
+
inline NFRuleSet * getDefaultRuleSet() const;
|
987
|
+
const RuleBasedCollator * getCollator() const;
|
988
|
+
DecimalFormatSymbols * getDecimalFormatSymbols() const;
|
989
|
+
PluralFormat *createPluralFormat(UPluralType pluralType, const UnicodeString &pattern, UErrorCode& status) const;
|
990
|
+
UnicodeString& adjustForCapitalizationContext(int32_t startPos, UnicodeString& currentResult) const;
|
991
|
+
|
992
|
+
private:
|
993
|
+
NFRuleSet **ruleSets;
|
994
|
+
UnicodeString* ruleSetDescriptions;
|
995
|
+
int32_t numRuleSets;
|
996
|
+
NFRuleSet *defaultRuleSet;
|
997
|
+
Locale locale;
|
998
|
+
RuleBasedCollator* collator;
|
999
|
+
DecimalFormatSymbols* decimalFormatSymbols;
|
1000
|
+
UBool lenient;
|
1001
|
+
UnicodeString* lenientParseRules;
|
1002
|
+
LocalizationInfo* localizations;
|
1003
|
+
UnicodeString originalDescription;
|
1004
|
+
UBool capitalizationInfoSet;
|
1005
|
+
UBool capitalizationForUIListMenu;
|
1006
|
+
UBool capitalizationForStandAlone;
|
1007
|
+
BreakIterator* capitalizationBrkIter;
|
1008
|
+
};
|
1009
|
+
|
1010
|
+
// ---------------
|
1011
|
+
|
1012
|
+
#if !UCONFIG_NO_COLLATION
|
1013
|
+
|
1014
|
+
inline UBool
|
1015
|
+
RuleBasedNumberFormat::isLenient(void) const {
|
1016
|
+
return lenient;
|
1017
|
+
}
|
1018
|
+
|
1019
|
+
#endif
|
1020
|
+
|
1021
|
+
inline NFRuleSet*
|
1022
|
+
RuleBasedNumberFormat::getDefaultRuleSet() const {
|
1023
|
+
return defaultRuleSet;
|
1024
|
+
}
|
1025
|
+
|
1026
|
+
U_NAMESPACE_END
|
1027
|
+
|
1028
|
+
/* U_HAVE_RBNF */
|
1029
|
+
#endif
|
1030
|
+
|
1031
|
+
/* RBNF_H */
|
1032
|
+
#endif
|