pango 3.2.7-x64-mingw32 → 3.2.8-x64-mingw32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Rakefile +10 -7
- data/lib/2.2/pango.so +0 -0
- data/lib/2.3/pango.so +0 -0
- data/lib/2.4/pango.so +0 -0
- data/lib/2.5/pango.so +0 -0
- data/pango.gemspec +2 -0
- data/vendor/local/bin/derb.exe +0 -0
- data/vendor/local/bin/escapesrc.exe +0 -0
- data/vendor/local/bin/fribidi.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-subset.exe +0 -0
- data/vendor/local/bin/hb-view.exe +0 -0
- data/vendor/local/bin/icu-config +6 -6
- data/vendor/local/bin/icuinfo.exe +0 -0
- data/vendor/local/bin/icupkg.exe +0 -0
- data/vendor/local/bin/libfribidi-0.dll +0 -0
- data/vendor/local/bin/libgraphene-1.0-0.dll +0 -0
- data/vendor/local/bin/libharfbuzz-0.dll +0 -0
- data/vendor/local/bin/libharfbuzz-subset-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/{libexec/installed-tests/graphene-1.0/quad.exe → bin/pango-list.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/include/fribidi/fribidi-config.h +2 -2
- data/vendor/local/include/graphene-1.0/graphene-macros.h +1 -1
- data/vendor/local/include/graphene-1.0/graphene-matrix.h +1 -1
- data/vendor/local/include/graphene-1.0/graphene-vec2.h +1 -1
- data/vendor/local/include/graphene-1.0/graphene-vec3.h +1 -1
- data/vendor/local/include/graphene-1.0/graphene-vec4.h +1 -1
- data/vendor/local/include/graphene-1.0/graphene-version.h +2 -2
- data/vendor/local/include/harfbuzz/hb-ot-layout.h +13 -0
- data/vendor/local/include/harfbuzz/hb-set.h +4 -0
- data/vendor/local/include/harfbuzz/hb-subset-plan.hh +1 -1
- data/vendor/local/include/harfbuzz/hb-subset-private.hh +1 -0
- data/vendor/local/include/harfbuzz/hb-subset.h +3 -0
- data/vendor/local/include/harfbuzz/hb-version.h +2 -2
- data/vendor/local/include/pango-1.0/pango/pango-features.h +2 -2
- data/vendor/local/include/unicode/brkiter.h +1 -1
- data/vendor/local/include/unicode/bytestriebuilder.h +1 -1
- data/vendor/local/include/unicode/caniter.h +2 -2
- data/vendor/local/include/unicode/compactdecimalformat.h +17 -250
- data/vendor/local/include/unicode/currunit.h +3 -2
- data/vendor/local/include/unicode/dcfmtsym.h +8 -1
- data/vendor/local/include/unicode/decimfmt.h +301 -439
- data/vendor/local/include/unicode/docmain.h +1 -1
- data/vendor/local/include/unicode/edits.h +129 -21
- data/vendor/local/include/unicode/fmtable.h +14 -21
- data/vendor/local/include/unicode/fpositer.h +0 -8
- data/vendor/local/include/unicode/measunit.h +0 -8
- data/vendor/local/include/unicode/nounit.h +6 -6
- data/vendor/local/include/unicode/numberformatter.h +1005 -553
- data/vendor/local/include/unicode/numfmt.h +10 -10
- data/vendor/local/include/unicode/platform.h +0 -14
- data/vendor/local/include/unicode/plurrule.h +0 -21
- data/vendor/local/include/unicode/rbbi.h +9 -15
- data/vendor/local/include/unicode/rbnf.h +2 -2
- data/vendor/local/include/unicode/scientificnumberformatter.h +0 -5
- data/vendor/local/include/unicode/smpdtfmt.h +33 -6
- data/vendor/local/include/unicode/timezone.h +2 -0
- data/vendor/local/include/unicode/uchar.h +42 -3
- data/vendor/local/include/unicode/unistr.h +3 -3
- data/vendor/local/include/unicode/unum.h +26 -5
- data/vendor/local/include/unicode/unumberformatter.h +717 -0
- data/vendor/local/include/unicode/urename.h +13 -0
- data/vendor/local/include/unicode/uscript.h +16 -1
- data/vendor/local/include/unicode/uspoof.h +24 -1
- data/vendor/local/include/unicode/utypes.h +4 -1
- data/vendor/local/include/unicode/uvernum.h +5 -5
- data/vendor/local/lib/cmake/harfbuzz/harfbuzz-config.cmake +1 -1
- data/vendor/local/lib/graphene-1.0/include/graphene-config.h +3 -1
- data/vendor/local/lib/icu/{61.1 → 62.1}/Makefile.inc +6 -6
- data/vendor/local/lib/icu/{61.1 → 62.1}/pkgdata.inc +3 -3
- data/vendor/local/lib/icu/Makefile.inc +6 -6
- data/vendor/local/lib/icu/pkgdata.inc +3 -3
- data/vendor/local/lib/icudt.dll +0 -0
- data/vendor/local/lib/{icudt61.dll → icudt62.dll} +0 -0
- data/vendor/local/lib/icuin.dll +0 -0
- data/vendor/local/lib/icuin62.dll +0 -0
- data/vendor/local/lib/icuio.dll +0 -0
- data/vendor/local/lib/{icuio61.dll → icuio62.dll} +0 -0
- data/vendor/local/lib/icutest.dll +0 -0
- data/vendor/local/lib/{icutest61.dll → icutest62.dll} +0 -0
- data/vendor/local/lib/icutu.dll +0 -0
- data/vendor/local/lib/{icutu61.dll → icutu62.dll} +0 -0
- data/vendor/local/lib/icuuc.dll +0 -0
- data/vendor/local/lib/{icuuc61.dll → icuuc62.dll} +0 -0
- data/vendor/local/lib/libfribidi.dll.a +0 -0
- data/vendor/local/lib/libgraphene-1.0.dll.a +0 -0
- data/vendor/local/lib/libharfbuzz-icu.a +0 -0
- data/vendor/local/lib/libharfbuzz-icu.la +2 -2
- data/vendor/local/lib/libharfbuzz-subset.dll.a +0 -0
- data/vendor/local/lib/libharfbuzz-subset.la +2 -2
- data/vendor/local/lib/libharfbuzz.dll.a +0 -0
- data/vendor/local/lib/libharfbuzz.la +2 -2
- 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/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 +2 -2
- data/vendor/local/lib/libpangocairo-1.0.dll.a +0 -0
- data/vendor/local/lib/libpangocairo-1.0.la +2 -2
- data/vendor/local/lib/libpangoft2-1.0.dll.a +0 -0
- data/vendor/local/lib/libpangoft2-1.0.la +2 -2
- data/vendor/local/lib/libpangowin32-1.0.dll.a +0 -0
- data/vendor/local/lib/libpangowin32-1.0.la +2 -2
- data/vendor/local/lib/pkgconfig/fribidi.pc +1 -1
- data/vendor/local/lib/pkgconfig/graphene-1.0.pc +7 -11
- data/vendor/local/lib/pkgconfig/graphene-gobject-1.0.pc +6 -12
- data/vendor/local/lib/pkgconfig/harfbuzz-icu.pc +1 -1
- data/vendor/local/lib/pkgconfig/harfbuzz-subset.pc +1 -1
- data/vendor/local/lib/pkgconfig/harfbuzz.pc +1 -1
- data/vendor/local/lib/pkgconfig/icu-i18n.pc +6 -6
- data/vendor/local/lib/pkgconfig/icu-io.pc +6 -6
- data/vendor/local/lib/pkgconfig/icu-uc.pc +6 -6
- data/vendor/local/lib/pkgconfig/pango.pc +3 -2
- data/vendor/local/lib/pkgconfig/pangocairo.pc +1 -1
- data/vendor/local/lib/pkgconfig/pangoft2.pc +1 -1
- data/vendor/local/lib/pkgconfig/pangowin32.pc +2 -2
- data/vendor/local/share/gir-1.0/Graphene-1.0.gir +1 -1
- data/vendor/local/share/gtk-doc/html/harfbuzz/api-index-full.html +80 -0
- data/vendor/local/share/gtk-doc/html/harfbuzz/harfbuzz-hb-blob.html +34 -0
- data/vendor/local/share/gtk-doc/html/harfbuzz/harfbuzz-hb-face.html +13 -0
- data/vendor/local/share/gtk-doc/html/harfbuzz/harfbuzz-hb-ot-layout.html +20 -0
- data/vendor/local/share/gtk-doc/html/harfbuzz/harfbuzz-hb-set.html +83 -28
- data/vendor/local/share/gtk-doc/html/harfbuzz/harfbuzz.devhelp2 +5 -1
- data/vendor/local/share/gtk-doc/html/harfbuzz/object-tree.html +1 -0
- data/vendor/local/share/gtk-doc/html/harfbuzz/pt02.html +1 -1
- data/vendor/local/share/gtk-doc/html/pango/PangoEngineLang.html +2 -2
- data/vendor/local/share/gtk-doc/html/pango/PangoEngineShape.html +2 -2
- data/vendor/local/share/gtk-doc/html/pango/PangoFcDecoder.html +2 -2
- data/vendor/local/share/gtk-doc/html/pango/PangoFcFont.html +2 -2
- data/vendor/local/share/gtk-doc/html/pango/PangoFcFontMap.html +2 -2
- data/vendor/local/share/gtk-doc/html/pango/PangoMarkupFormat.html +2 -2
- data/vendor/local/share/gtk-doc/html/pango/PangoRenderer.html +2 -2
- data/vendor/local/share/gtk-doc/html/pango/annotation-glossary.html +2 -2
- data/vendor/local/share/gtk-doc/html/pango/api-index-full.html +2 -2
- data/vendor/local/share/gtk-doc/html/pango/index.html +3 -3
- data/vendor/local/share/gtk-doc/html/pango/lowlevel.html +2 -2
- data/vendor/local/share/gtk-doc/html/pango/pango-Bidirectional-Text.html +2 -2
- data/vendor/local/share/gtk-doc/html/pango/pango-Cairo-Rendering.html +2 -2
- data/vendor/local/share/gtk-doc/html/pango/pango-CoreText-Fonts.html +2 -2
- data/vendor/local/share/gtk-doc/html/pango/pango-Coverage-Maps.html +2 -2
- data/vendor/local/share/gtk-doc/html/pango/pango-Engines.html +2 -2
- data/vendor/local/share/gtk-doc/html/pango/pango-Fonts.html +2 -2
- data/vendor/local/share/gtk-doc/html/pango/pango-FreeType-Fonts-and-Rendering.html +2 -2
- data/vendor/local/share/gtk-doc/html/pango/pango-Glyph-Storage.html +2 -2
- data/vendor/local/share/gtk-doc/html/pango/pango-Layout-Objects.html +2 -2
- data/vendor/local/share/gtk-doc/html/pango/pango-Miscellaneous-Utilities.html +2 -2
- data/vendor/local/share/gtk-doc/html/pango/pango-Modules.html +2 -2
- data/vendor/local/share/gtk-doc/html/pango/pango-OpenType-Font-Handling.html +2 -2
- data/vendor/local/share/gtk-doc/html/pango/pango-Scripts-and-Languages.html +2 -2
- data/vendor/local/share/gtk-doc/html/pango/pango-Tab-Stops.html +2 -2
- data/vendor/local/share/gtk-doc/html/pango/pango-Text-Attributes.html +2 -2
- data/vendor/local/share/gtk-doc/html/pango/pango-Text-Processing.html +2 -2
- data/vendor/local/share/gtk-doc/html/pango/pango-Version-Checking.html +4 -4
- data/vendor/local/share/gtk-doc/html/pango/pango-Vertical-Text.html +2 -2
- data/vendor/local/share/gtk-doc/html/pango/pango-Win32-Fonts-and-Rendering.html +2 -2
- data/vendor/local/share/gtk-doc/html/pango/pango-Xft-Fonts-and-Rendering.html +2 -2
- data/vendor/local/share/gtk-doc/html/pango/pango-hierarchy.html +2 -2
- data/vendor/local/share/gtk-doc/html/pango/pango.html +2 -2
- data/vendor/local/share/gtk-doc/html/pango/rendering.html +2 -2
- data/vendor/local/share/gtk-doc/html/pango/style.css +4 -0
- data/vendor/local/share/icu/{61.1 → 62.1}/LICENSE +0 -0
- data/vendor/local/share/icu/{61.1 → 62.1}/config/mh-mingw64 +0 -0
- data/vendor/local/share/icu/{61.1 → 62.1}/install-sh +0 -0
- data/vendor/local/share/icu/{61.1 → 62.1}/mkinstalldirs +0 -0
- data/vendor/local/share/man/man1/derb.1 +2 -2
- data/vendor/local/share/man/man1/genbrk.1 +2 -2
- data/vendor/local/share/man/man1/gencfu.1 +1 -1
- data/vendor/local/share/man/man1/gencnval.1 +3 -3
- data/vendor/local/share/man/man1/gendict.1 +2 -2
- data/vendor/local/share/man/man1/genrb.1 +3 -3
- data/vendor/local/share/man/man1/icu-config.1 +2 -2
- data/vendor/local/share/man/man1/makeconv.1 +3 -3
- data/vendor/local/share/man/man1/pkgdata.1 +2 -2
- data/vendor/local/share/man/man1/uconv.1 +2 -2
- data/vendor/local/share/man/man8/genccode.8 +2 -2
- data/vendor/local/share/man/man8/gencmn.8 +3 -3
- data/vendor/local/share/man/man8/gensprep.8 +3 -3
- data/vendor/local/share/man/man8/icupkg.8 +1 -1
- metadata +20 -54
- data/vendor/local/lib/icuin61.dll +0 -0
- data/vendor/local/libexec/installed-tests/graphene-1.0/box.exe +0 -0
- data/vendor/local/libexec/installed-tests/graphene-1.0/euler.exe +0 -0
- data/vendor/local/libexec/installed-tests/graphene-1.0/frustum.exe +0 -0
- data/vendor/local/libexec/installed-tests/graphene-1.0/matrix.exe +0 -0
- data/vendor/local/libexec/installed-tests/graphene-1.0/plane.exe +0 -0
- data/vendor/local/libexec/installed-tests/graphene-1.0/point.exe +0 -0
- data/vendor/local/libexec/installed-tests/graphene-1.0/point3d.exe +0 -0
- data/vendor/local/libexec/installed-tests/graphene-1.0/quaternion.exe +0 -0
- data/vendor/local/libexec/installed-tests/graphene-1.0/ray.exe +0 -0
- data/vendor/local/libexec/installed-tests/graphene-1.0/rect.exe +0 -0
- data/vendor/local/libexec/installed-tests/graphene-1.0/simd.exe +0 -0
- data/vendor/local/libexec/installed-tests/graphene-1.0/size.exe +0 -0
- data/vendor/local/libexec/installed-tests/graphene-1.0/sphere.exe +0 -0
- data/vendor/local/libexec/installed-tests/graphene-1.0/triangle.exe +0 -0
- data/vendor/local/libexec/installed-tests/graphene-1.0/vec2.exe +0 -0
- data/vendor/local/libexec/installed-tests/graphene-1.0/vec3.exe +0 -0
- data/vendor/local/libexec/installed-tests/graphene-1.0/vec4.exe +0 -0
- data/vendor/local/share/installed-tests/graphene-1.0/box.test +0 -3
- data/vendor/local/share/installed-tests/graphene-1.0/euler.test +0 -3
- data/vendor/local/share/installed-tests/graphene-1.0/frustum.test +0 -3
- data/vendor/local/share/installed-tests/graphene-1.0/matrix.test +0 -3
- data/vendor/local/share/installed-tests/graphene-1.0/plane.test +0 -3
- data/vendor/local/share/installed-tests/graphene-1.0/point.test +0 -3
- data/vendor/local/share/installed-tests/graphene-1.0/point3d.test +0 -3
- data/vendor/local/share/installed-tests/graphene-1.0/quad.test +0 -3
- data/vendor/local/share/installed-tests/graphene-1.0/quaternion.test +0 -3
- data/vendor/local/share/installed-tests/graphene-1.0/ray.test +0 -3
- data/vendor/local/share/installed-tests/graphene-1.0/rect.test +0 -3
- data/vendor/local/share/installed-tests/graphene-1.0/simd.test +0 -3
- data/vendor/local/share/installed-tests/graphene-1.0/size.test +0 -3
- data/vendor/local/share/installed-tests/graphene-1.0/sphere.test +0 -3
- data/vendor/local/share/installed-tests/graphene-1.0/triangle.test +0 -3
- data/vendor/local/share/installed-tests/graphene-1.0/vec2.test +0 -3
- data/vendor/local/share/installed-tests/graphene-1.0/vec3.test +0 -3
- data/vendor/local/share/installed-tests/graphene-1.0/vec4.test +0 -3
@@ -1892,7 +1892,7 @@ public:
|
|
1892
1892
|
UnicodeString &fastCopyFrom(const UnicodeString &src);
|
1893
1893
|
|
1894
1894
|
/**
|
1895
|
-
* Move assignment operator
|
1895
|
+
* Move assignment operator; might leave src in bogus state.
|
1896
1896
|
* This string will have the same contents and state that the source string had.
|
1897
1897
|
* The behavior is undefined if *this and src are the same object.
|
1898
1898
|
* @param src source string
|
@@ -1905,7 +1905,7 @@ public:
|
|
1905
1905
|
|
1906
1906
|
// do not use #ifndef U_HIDE_DRAFT_API for moveFrom, needed by non-draft API
|
1907
1907
|
/**
|
1908
|
-
* Move assignment
|
1908
|
+
* Move assignment; might leave src in bogus state.
|
1909
1909
|
* This string will have the same contents and state that the source string had.
|
1910
1910
|
* The behavior is undefined if *this and src are the same object.
|
1911
1911
|
*
|
@@ -3314,7 +3314,7 @@ public:
|
|
3314
3314
|
UnicodeString(const UnicodeString& that);
|
3315
3315
|
|
3316
3316
|
/**
|
3317
|
-
* Move constructor
|
3317
|
+
* Move constructor; might leave src in bogus state.
|
3318
3318
|
* This string will have the same contents and state that the source string had.
|
3319
3319
|
* @param src source string
|
3320
3320
|
* @stable ICU 56
|
@@ -29,12 +29,13 @@
|
|
29
29
|
|
30
30
|
/**
|
31
31
|
* \file
|
32
|
-
* \brief C API:
|
32
|
+
* \brief C API: Compatibility APIs for number formatting.
|
33
33
|
*
|
34
34
|
* <h2> Number Format C API </h2>
|
35
35
|
*
|
36
|
-
* <p><strong>IMPORTANT:</strong> New users with
|
37
|
-
*
|
36
|
+
* <p><strong>IMPORTANT:</strong> New users with are strongly encouraged to
|
37
|
+
* see if unumberformatter.h fits their use case. Although not deprecated,
|
38
|
+
* this header is provided for backwards compatibility only.
|
38
39
|
*
|
39
40
|
* Number Format C API Provides functions for
|
40
41
|
* formatting and parsing a number. Also provides methods for
|
@@ -399,6 +400,10 @@ typedef enum UNumberFormatFields {
|
|
399
400
|
* number format is opened using the given pattern, which must conform
|
400
401
|
* to the syntax described in DecimalFormat or RuleBasedNumberFormat,
|
401
402
|
* respectively.
|
403
|
+
*
|
404
|
+
* <p><strong>NOTE::</strong> New users with are strongly encouraged to
|
405
|
+
* use unumf_openWithSkeletonAndLocale instead of unum_open.
|
406
|
+
*
|
402
407
|
* @param pattern A pattern specifying the format to use.
|
403
408
|
* This parameter is ignored unless the style is
|
404
409
|
* UNUM_PATTERN_DECIMAL or UNUM_PATTERN_RULEBASED.
|
@@ -1013,6 +1018,8 @@ typedef enum UNumberFormatAttribute {
|
|
1013
1018
|
* <p>Example: setting the scale to 3, 123 formats as "123,000"
|
1014
1019
|
* <p>Example: setting the scale to -4, 123 formats as "0.0123"
|
1015
1020
|
*
|
1021
|
+
* This setting is analogous to getMultiplierScale() and setMultiplierScale() in decimfmt.h.
|
1022
|
+
*
|
1016
1023
|
* @stable ICU 51 */
|
1017
1024
|
UNUM_SCALE = 21,
|
1018
1025
|
#ifndef U_HIDE_INTERNAL_API
|
@@ -1052,7 +1059,7 @@ typedef enum UNumberFormatAttribute {
|
|
1052
1059
|
* Default: 0 (unset)
|
1053
1060
|
* @stable ICU 50
|
1054
1061
|
*/
|
1055
|
-
UNUM_PARSE_NO_EXPONENT,
|
1062
|
+
UNUM_PARSE_NO_EXPONENT = 0x1001,
|
1056
1063
|
|
1057
1064
|
/**
|
1058
1065
|
* if this attribute is set to 1, specifies that, if the pattern contains a
|
@@ -1067,7 +1074,21 @@ typedef enum UNumberFormatAttribute {
|
|
1067
1074
|
/* The following cannot be #ifndef U_HIDE_INTERNAL_API, needed in .h file variable declararions */
|
1068
1075
|
/** Limit of boolean attributes.
|
1069
1076
|
* @internal */
|
1070
|
-
UNUM_LIMIT_BOOLEAN_ATTRIBUTE = 0x1003
|
1077
|
+
UNUM_LIMIT_BOOLEAN_ATTRIBUTE = 0x1003,
|
1078
|
+
|
1079
|
+
/**
|
1080
|
+
* Whether parsing is sensitive to case (lowercase/uppercase).
|
1081
|
+
* TODO: Add to the test suite.
|
1082
|
+
* @internal This API is a technical preview. It may change in an upcoming release.
|
1083
|
+
*/
|
1084
|
+
UNUM_PARSE_CASE_SENSITIVE = 0x1004,
|
1085
|
+
|
1086
|
+
/**
|
1087
|
+
* Formatting: whether to show the plus sign on non-negative numbers.
|
1088
|
+
* TODO: Add to the test suite.
|
1089
|
+
* @internal This API is a technical preview. It may change in an upcoming release.
|
1090
|
+
*/
|
1091
|
+
UNUM_SIGN_ALWAYS_SHOWN = 0x1005,
|
1071
1092
|
} UNumberFormatAttribute;
|
1072
1093
|
|
1073
1094
|
/**
|
@@ -0,0 +1,717 @@
|
|
1
|
+
// © 2018 and later: Unicode, Inc. and others.
|
2
|
+
// License & terms of use: http://www.unicode.org/copyright.html
|
3
|
+
|
4
|
+
#include "unicode/utypes.h"
|
5
|
+
|
6
|
+
#if !UCONFIG_NO_FORMATTING
|
7
|
+
#ifndef __UNUMBERFORMATTER_H__
|
8
|
+
#define __UNUMBERFORMATTER_H__
|
9
|
+
|
10
|
+
#include "unicode/ufieldpositer.h"
|
11
|
+
#include "unicode/umisc.h"
|
12
|
+
|
13
|
+
|
14
|
+
/**
|
15
|
+
* \file
|
16
|
+
* \brief C-compatible API for localized number formatting; not recommended for C++.
|
17
|
+
*
|
18
|
+
* This is the C-compatible version of the NumberFormatter API introduced in ICU 60. C++ users should
|
19
|
+
* include unicode/numberformatter.h and use the proper C++ APIs.
|
20
|
+
*
|
21
|
+
* The C API accepts a number skeleton string for specifying the settings for formatting, which covers a
|
22
|
+
* very large subset of all possible number formatting features. For more information on number skeleton
|
23
|
+
* strings, see unicode/numberformatter.h.
|
24
|
+
*
|
25
|
+
* When using UNumberFormatter, which is treated as immutable, the results are exported to a mutable
|
26
|
+
* UFormattedNumber object, which you subsequently use for populating your string buffer or iterating over
|
27
|
+
* the fields.
|
28
|
+
*
|
29
|
+
* Example code:
|
30
|
+
* <pre>
|
31
|
+
* // Setup:
|
32
|
+
* UErrorCode ec = U_ZERO_ERROR;
|
33
|
+
* UNumberFormatter* uformatter = unumf_openForSkeletonAndLocale(u"precision-integer", -1, "en", &ec);
|
34
|
+
* UFormattedNumber* uresult = unumf_openResult(&ec);
|
35
|
+
* if (U_FAILURE(ec)) { return; }
|
36
|
+
*
|
37
|
+
* // Format a double:
|
38
|
+
* unumf_formatDouble(uformatter, 5142.3, uresult, &ec);
|
39
|
+
* if (U_FAILURE(ec)) { return; }
|
40
|
+
*
|
41
|
+
* // Export the string to a malloc'd buffer:
|
42
|
+
* int32_t len = unumf_resultToString(uresult, NULL, 0, &ec);
|
43
|
+
* // at this point, ec == U_BUFFER_OVERFLOW_ERROR
|
44
|
+
* ec = U_ZERO_ERROR;
|
45
|
+
* UChar* buffer = (UChar*) malloc((len+1)*sizeof(UChar));
|
46
|
+
* unumf_resultToString(uresult, buffer, len+1, &ec);
|
47
|
+
* if (U_FAILURE(ec)) { return; }
|
48
|
+
* // buffer should equal "5,142"
|
49
|
+
*
|
50
|
+
* // Cleanup:
|
51
|
+
* unumf_close(uformatter);
|
52
|
+
* unumf_closeResult(uresult);
|
53
|
+
* free(buffer);
|
54
|
+
* </pre>
|
55
|
+
*
|
56
|
+
* If you are a C++ user linking against the C libraries, you can use the LocalPointer versions of these
|
57
|
+
* APIs. The following example uses LocalPointer with the decimal number and field position APIs:
|
58
|
+
*
|
59
|
+
* <pre>
|
60
|
+
* // Setup:
|
61
|
+
* LocalUNumberFormatterPointer uformatter(unumf_openForSkeletonAndLocale(u"percent", -1, "en", &ec));
|
62
|
+
* LocalUFormattedNumberPointer uresult(unumf_openResult(&ec));
|
63
|
+
* if (U_FAILURE(ec)) { return; }
|
64
|
+
*
|
65
|
+
* // Format a decimal number:
|
66
|
+
* unumf_formatDecimal(uformatter.getAlias(), "9.87E-3", -1, uresult.getAlias(), &ec);
|
67
|
+
* if (U_FAILURE(ec)) { return; }
|
68
|
+
*
|
69
|
+
* // Get the location of the percent sign:
|
70
|
+
* UFieldPosition ufpos = {UNUM_PERCENT_FIELD, 0, 0};
|
71
|
+
* unumf_resultNextFieldPosition(uresult.getAlias(), &ufpos, &ec);
|
72
|
+
* // ufpos should contain beginIndex=7 and endIndex=8 since the string is "0.00987%"
|
73
|
+
*
|
74
|
+
* // No need to do any cleanup since we are using LocalPointer.
|
75
|
+
* </pre>
|
76
|
+
*/
|
77
|
+
|
78
|
+
|
79
|
+
#ifndef U_HIDE_DRAFT_API
|
80
|
+
/**
|
81
|
+
* An enum declaring how to render units, including currencies. Example outputs when formatting 123 USD and 123
|
82
|
+
* meters in <em>en-CA</em>:
|
83
|
+
*
|
84
|
+
* <p>
|
85
|
+
* <ul>
|
86
|
+
* <li>NARROW*: "$123.00" and "123 m"
|
87
|
+
* <li>SHORT: "US$ 123.00" and "123 m"
|
88
|
+
* <li>FULL_NAME: "123.00 US dollars" and "123 meters"
|
89
|
+
* <li>ISO_CODE: "USD 123.00" and undefined behavior
|
90
|
+
* <li>HIDDEN: "123.00" and "123"
|
91
|
+
* </ul>
|
92
|
+
*
|
93
|
+
* <p>
|
94
|
+
* This enum is similar to {@link com.ibm.icu.text.MeasureFormat.FormatWidth}.
|
95
|
+
*
|
96
|
+
* @draft ICU 60
|
97
|
+
*/
|
98
|
+
typedef enum UNumberUnitWidth {
|
99
|
+
/**
|
100
|
+
* Print an abbreviated version of the unit name. Similar to SHORT, but always use the shortest available
|
101
|
+
* abbreviation or symbol. This option can be used when the context hints at the identity of the unit. For more
|
102
|
+
* information on the difference between NARROW and SHORT, see SHORT.
|
103
|
+
*
|
104
|
+
* <p>
|
105
|
+
* In CLDR, this option corresponds to the "Narrow" format for measure units and the "¤¤¤¤¤" placeholder for
|
106
|
+
* currencies.
|
107
|
+
*
|
108
|
+
* @draft ICU 60
|
109
|
+
*/
|
110
|
+
UNUM_UNIT_WIDTH_NARROW,
|
111
|
+
|
112
|
+
/**
|
113
|
+
* Print an abbreviated version of the unit name. Similar to NARROW, but use a slightly wider abbreviation or
|
114
|
+
* symbol when there may be ambiguity. This is the default behavior.
|
115
|
+
*
|
116
|
+
* <p>
|
117
|
+
* For example, in <em>es-US</em>, the SHORT form for Fahrenheit is "{0} °F", but the NARROW form is "{0}°",
|
118
|
+
* since Fahrenheit is the customary unit for temperature in that locale.
|
119
|
+
*
|
120
|
+
* <p>
|
121
|
+
* In CLDR, this option corresponds to the "Short" format for measure units and the "¤" placeholder for
|
122
|
+
* currencies.
|
123
|
+
*
|
124
|
+
* @draft ICU 60
|
125
|
+
*/
|
126
|
+
UNUM_UNIT_WIDTH_SHORT,
|
127
|
+
|
128
|
+
/**
|
129
|
+
* Print the full name of the unit, without any abbreviations.
|
130
|
+
*
|
131
|
+
* <p>
|
132
|
+
* In CLDR, this option corresponds to the default format for measure units and the "¤¤¤" placeholder for
|
133
|
+
* currencies.
|
134
|
+
*
|
135
|
+
* @draft ICU 60
|
136
|
+
*/
|
137
|
+
UNUM_UNIT_WIDTH_FULL_NAME,
|
138
|
+
|
139
|
+
/**
|
140
|
+
* Use the three-digit ISO XXX code in place of the symbol for displaying currencies. The behavior of this
|
141
|
+
* option is currently undefined for use with measure units.
|
142
|
+
*
|
143
|
+
* <p>
|
144
|
+
* In CLDR, this option corresponds to the "¤¤" placeholder for currencies.
|
145
|
+
*
|
146
|
+
* @draft ICU 60
|
147
|
+
*/
|
148
|
+
UNUM_UNIT_WIDTH_ISO_CODE,
|
149
|
+
|
150
|
+
/**
|
151
|
+
* Format the number according to the specified unit, but do not display the unit. For currencies, apply
|
152
|
+
* monetary symbols and formats as with SHORT, but omit the currency symbol. For measure units, the behavior is
|
153
|
+
* equivalent to not specifying the unit at all.
|
154
|
+
*
|
155
|
+
* @draft ICU 60
|
156
|
+
*/
|
157
|
+
UNUM_UNIT_WIDTH_HIDDEN,
|
158
|
+
|
159
|
+
/**
|
160
|
+
* One more than the highest UNumberUnitWidth value.
|
161
|
+
*
|
162
|
+
* @internal ICU 60: The numeric value may change over time; see ICU ticket #12420.
|
163
|
+
*/
|
164
|
+
UNUM_UNIT_WIDTH_COUNT
|
165
|
+
} UNumberUnitWidth;
|
166
|
+
#endif /* U_HIDE_DRAFT_API */
|
167
|
+
|
168
|
+
#ifndef U_HIDE_DRAFT_API
|
169
|
+
/**
|
170
|
+
* An enum declaring the strategy for when and how to display grouping separators (i.e., the
|
171
|
+
* separator, often a comma or period, after every 2-3 powers of ten). The choices are several
|
172
|
+
* pre-built strategies for different use cases that employ locale data whenever possible. Example
|
173
|
+
* outputs for 1234 and 1234567 in <em>en-IN</em>:
|
174
|
+
*
|
175
|
+
* <ul>
|
176
|
+
* <li>OFF: 1234 and 12345
|
177
|
+
* <li>MIN2: 1234 and 12,34,567
|
178
|
+
* <li>AUTO: 1,234 and 12,34,567
|
179
|
+
* <li>ON_ALIGNED: 1,234 and 12,34,567
|
180
|
+
* <li>THOUSANDS: 1,234 and 1,234,567
|
181
|
+
* </ul>
|
182
|
+
*
|
183
|
+
* <p>
|
184
|
+
* The default is AUTO, which displays grouping separators unless the locale data says that grouping
|
185
|
+
* is not customary. To force grouping for all numbers greater than 1000 consistently across locales,
|
186
|
+
* use ON_ALIGNED. On the other hand, to display grouping less frequently than the default, use MIN2
|
187
|
+
* or OFF. See the docs of each option for details.
|
188
|
+
*
|
189
|
+
* <p>
|
190
|
+
* Note: This enum specifies the strategy for grouping sizes. To set which character to use as the
|
191
|
+
* grouping separator, use the "symbols" setter.
|
192
|
+
*
|
193
|
+
* @draft ICU 61 -- TODO: This should be renamed to UNumberGroupingStrategy before promoting to stable,
|
194
|
+
* for consistency with the other enums.
|
195
|
+
*/
|
196
|
+
typedef enum UGroupingStrategy {
|
197
|
+
/**
|
198
|
+
* Do not display grouping separators in any locale.
|
199
|
+
*
|
200
|
+
* @draft ICU 61
|
201
|
+
*/
|
202
|
+
UNUM_GROUPING_OFF,
|
203
|
+
|
204
|
+
/**
|
205
|
+
* Display grouping using locale defaults, except do not show grouping on values smaller than
|
206
|
+
* 10000 (such that there is a <em>minimum of two digits</em> before the first separator).
|
207
|
+
*
|
208
|
+
* <p>
|
209
|
+
* Note that locales may restrict grouping separators to be displayed only on 1 million or
|
210
|
+
* greater (for example, ee and hu) or disable grouping altogether (for example, bg currency).
|
211
|
+
*
|
212
|
+
* <p>
|
213
|
+
* Locale data is used to determine whether to separate larger numbers into groups of 2
|
214
|
+
* (customary in South Asia) or groups of 3 (customary in Europe and the Americas).
|
215
|
+
*
|
216
|
+
* @draft ICU 61
|
217
|
+
*/
|
218
|
+
UNUM_GROUPING_MIN2,
|
219
|
+
|
220
|
+
/**
|
221
|
+
* Display grouping using the default strategy for all locales. This is the default behavior.
|
222
|
+
*
|
223
|
+
* <p>
|
224
|
+
* Note that locales may restrict grouping separators to be displayed only on 1 million or
|
225
|
+
* greater (for example, ee and hu) or disable grouping altogether (for example, bg currency).
|
226
|
+
*
|
227
|
+
* <p>
|
228
|
+
* Locale data is used to determine whether to separate larger numbers into groups of 2
|
229
|
+
* (customary in South Asia) or groups of 3 (customary in Europe and the Americas).
|
230
|
+
*
|
231
|
+
* @draft ICU 61
|
232
|
+
*/
|
233
|
+
UNUM_GROUPING_AUTO,
|
234
|
+
|
235
|
+
/**
|
236
|
+
* Always display the grouping separator on values of at least 1000.
|
237
|
+
*
|
238
|
+
* <p>
|
239
|
+
* This option ignores the locale data that restricts or disables grouping, described in MIN2 and
|
240
|
+
* AUTO. This option may be useful to normalize the alignment of numbers, such as in a
|
241
|
+
* spreadsheet.
|
242
|
+
*
|
243
|
+
* <p>
|
244
|
+
* Locale data is used to determine whether to separate larger numbers into groups of 2
|
245
|
+
* (customary in South Asia) or groups of 3 (customary in Europe and the Americas).
|
246
|
+
*
|
247
|
+
* @draft ICU 61
|
248
|
+
*/
|
249
|
+
UNUM_GROUPING_ON_ALIGNED,
|
250
|
+
|
251
|
+
/**
|
252
|
+
* Use the Western defaults: groups of 3 and enabled for all numbers 1000 or greater. Do not use
|
253
|
+
* locale data for determining the grouping strategy.
|
254
|
+
*
|
255
|
+
* @draft ICU 61
|
256
|
+
*/
|
257
|
+
UNUM_GROUPING_THOUSANDS,
|
258
|
+
|
259
|
+
/**
|
260
|
+
* One more than the highest UGroupingStrategy value.
|
261
|
+
*
|
262
|
+
* @internal ICU 62: The numeric value may change over time; see ICU ticket #12420.
|
263
|
+
*/
|
264
|
+
UNUM_GROUPING_COUNT
|
265
|
+
|
266
|
+
} UGroupingStrategy;
|
267
|
+
#endif /* U_HIDE_DRAFT_API */
|
268
|
+
|
269
|
+
#ifndef U_HIDE_DRAFT_API
|
270
|
+
/**
|
271
|
+
* An enum declaring how to denote positive and negative numbers. Example outputs when formatting
|
272
|
+
* 123, 0, and -123 in <em>en-US</em>:
|
273
|
+
*
|
274
|
+
* <ul>
|
275
|
+
* <li>AUTO: "123", "0", and "-123"
|
276
|
+
* <li>ALWAYS: "+123", "+0", and "-123"
|
277
|
+
* <li>NEVER: "123", "0", and "123"
|
278
|
+
* <li>ACCOUNTING: "$123", "$0", and "($123)"
|
279
|
+
* <li>ACCOUNTING_ALWAYS: "+$123", "+$0", and "($123)"
|
280
|
+
* <li>EXCEPT_ZERO: "+123", "0", and "-123"
|
281
|
+
* <li>ACCOUNTING_EXCEPT_ZERO: "+$123", "$0", and "($123)"
|
282
|
+
* </ul>
|
283
|
+
*
|
284
|
+
* <p>
|
285
|
+
* The exact format, including the position and the code point of the sign, differ by locale.
|
286
|
+
*
|
287
|
+
* @draft ICU 60
|
288
|
+
*/
|
289
|
+
typedef enum UNumberSignDisplay {
|
290
|
+
/**
|
291
|
+
* Show the minus sign on negative numbers, and do not show the sign on positive numbers. This is the default
|
292
|
+
* behavior.
|
293
|
+
*
|
294
|
+
* @draft ICU 60
|
295
|
+
*/
|
296
|
+
UNUM_SIGN_AUTO,
|
297
|
+
|
298
|
+
/**
|
299
|
+
* Show the minus sign on negative numbers and the plus sign on positive numbers, including zero.
|
300
|
+
* To hide the sign on zero, see {@link UNUM_SIGN_EXCEPT_ZERO}.
|
301
|
+
*
|
302
|
+
* @draft ICU 60
|
303
|
+
*/
|
304
|
+
UNUM_SIGN_ALWAYS,
|
305
|
+
|
306
|
+
/**
|
307
|
+
* Do not show the sign on positive or negative numbers.
|
308
|
+
*
|
309
|
+
* @draft ICU 60
|
310
|
+
*/
|
311
|
+
UNUM_SIGN_NEVER,
|
312
|
+
|
313
|
+
/**
|
314
|
+
* Use the locale-dependent accounting format on negative numbers, and do not show the sign on positive numbers.
|
315
|
+
*
|
316
|
+
* <p>
|
317
|
+
* The accounting format is defined in CLDR and varies by locale; in many Western locales, the format is a pair
|
318
|
+
* of parentheses around the number.
|
319
|
+
*
|
320
|
+
* <p>
|
321
|
+
* Note: Since CLDR defines the accounting format in the monetary context only, this option falls back to the
|
322
|
+
* AUTO sign display strategy when formatting without a currency unit. This limitation may be lifted in the
|
323
|
+
* future.
|
324
|
+
*
|
325
|
+
* @draft ICU 60
|
326
|
+
*/
|
327
|
+
UNUM_SIGN_ACCOUNTING,
|
328
|
+
|
329
|
+
/**
|
330
|
+
* Use the locale-dependent accounting format on negative numbers, and show the plus sign on
|
331
|
+
* positive numbers, including zero. For more information on the accounting format, see the
|
332
|
+
* ACCOUNTING sign display strategy. To hide the sign on zero, see
|
333
|
+
* {@link UNUM_SIGN_ACCOUNTING_EXCEPT_ZERO}.
|
334
|
+
*
|
335
|
+
* @draft ICU 60
|
336
|
+
*/
|
337
|
+
UNUM_SIGN_ACCOUNTING_ALWAYS,
|
338
|
+
|
339
|
+
/**
|
340
|
+
* Show the minus sign on negative numbers and the plus sign on positive numbers. Do not show a
|
341
|
+
* sign on zero.
|
342
|
+
*
|
343
|
+
* @draft ICU 61
|
344
|
+
*/
|
345
|
+
UNUM_SIGN_EXCEPT_ZERO,
|
346
|
+
|
347
|
+
/**
|
348
|
+
* Use the locale-dependent accounting format on negative numbers, and show the plus sign on
|
349
|
+
* positive numbers. Do not show a sign on zero. For more information on the accounting format,
|
350
|
+
* see the ACCOUNTING sign display strategy.
|
351
|
+
*
|
352
|
+
* @draft ICU 61
|
353
|
+
*/
|
354
|
+
UNUM_SIGN_ACCOUNTING_EXCEPT_ZERO,
|
355
|
+
|
356
|
+
/**
|
357
|
+
* One more than the highest UNumberSignDisplay value.
|
358
|
+
*
|
359
|
+
* @internal ICU 60: The numeric value may change over time; see ICU ticket #12420.
|
360
|
+
*/
|
361
|
+
UNUM_SIGN_COUNT
|
362
|
+
} UNumberSignDisplay;
|
363
|
+
#endif /* U_HIDE_DRAFT_API */
|
364
|
+
|
365
|
+
#ifndef U_HIDE_DRAFT_API
|
366
|
+
/**
|
367
|
+
* An enum declaring how to render the decimal separator.
|
368
|
+
*
|
369
|
+
* <p>
|
370
|
+
* <ul>
|
371
|
+
* <li>UNUM_DECIMAL_SEPARATOR_AUTO: "1", "1.1"
|
372
|
+
* <li>UNUM_DECIMAL_SEPARATOR_ALWAYS: "1.", "1.1"
|
373
|
+
* </ul>
|
374
|
+
*/
|
375
|
+
typedef enum UNumberDecimalSeparatorDisplay {
|
376
|
+
/**
|
377
|
+
* Show the decimal separator when there are one or more digits to display after the separator, and do not show
|
378
|
+
* it otherwise. This is the default behavior.
|
379
|
+
*
|
380
|
+
* @draft ICU 60
|
381
|
+
*/
|
382
|
+
UNUM_DECIMAL_SEPARATOR_AUTO,
|
383
|
+
|
384
|
+
/**
|
385
|
+
* Always show the decimal separator, even if there are no digits to display after the separator.
|
386
|
+
*
|
387
|
+
* @draft ICU 60
|
388
|
+
*/
|
389
|
+
UNUM_DECIMAL_SEPARATOR_ALWAYS,
|
390
|
+
|
391
|
+
/**
|
392
|
+
* One more than the highest UNumberDecimalSeparatorDisplay value.
|
393
|
+
*
|
394
|
+
* @internal ICU 60: The numeric value may change over time; see ICU ticket #12420.
|
395
|
+
*/
|
396
|
+
UNUM_DECIMAL_SEPARATOR_COUNT
|
397
|
+
} UNumberDecimalSeparatorDisplay;
|
398
|
+
#endif /* U_HIDE_DRAFT_API */
|
399
|
+
|
400
|
+
#ifndef U_HIDE_DRAFT_API
|
401
|
+
/**
|
402
|
+
* C-compatible version of icu::number::LocalizedNumberFormatter.
|
403
|
+
*
|
404
|
+
* NOTE: This is a C-compatible API; C++ users should build against numberformatter.h instead.
|
405
|
+
*
|
406
|
+
* @draft ICU 62
|
407
|
+
*/
|
408
|
+
struct UNumberFormatter;
|
409
|
+
typedef struct UNumberFormatter UNumberFormatter;
|
410
|
+
|
411
|
+
|
412
|
+
/**
|
413
|
+
* C-compatible version of icu::number::FormattedNumber.
|
414
|
+
*
|
415
|
+
* NOTE: This is a C-compatible API; C++ users should build against numberformatter.h instead.
|
416
|
+
*
|
417
|
+
* @draft ICU 62
|
418
|
+
*/
|
419
|
+
struct UFormattedNumber;
|
420
|
+
typedef struct UFormattedNumber UFormattedNumber;
|
421
|
+
|
422
|
+
|
423
|
+
/**
|
424
|
+
* Creates a new UNumberFormatter for the given skeleton string and locale. This is currently the only
|
425
|
+
* method for creating a new UNumberFormatter.
|
426
|
+
*
|
427
|
+
* Objects of type UNumberFormatter returned by this method are threadsafe.
|
428
|
+
*
|
429
|
+
* For more details on skeleton strings, see the documentation in numberformatter.h. For more details on
|
430
|
+
* the usage of this API, see the documentation at the top of unumberformatter.h.
|
431
|
+
*
|
432
|
+
* NOTE: This is a C-compatible API; C++ users should build against numberformatter.h instead.
|
433
|
+
*
|
434
|
+
* @param skeleton The skeleton string, like u"percent precision-integer"
|
435
|
+
* @param skeletonLen The number of UChars in the skeleton string, or -1 it it is NUL-terminated.
|
436
|
+
* @param locale The NUL-terminated locale ID.
|
437
|
+
* @param ec Set if an error occurs.
|
438
|
+
* @draft ICU 62
|
439
|
+
*/
|
440
|
+
U_DRAFT UNumberFormatter* U_EXPORT2
|
441
|
+
unumf_openForSkeletonAndLocale(const UChar* skeleton, int32_t skeletonLen, const char* locale,
|
442
|
+
UErrorCode* ec);
|
443
|
+
|
444
|
+
|
445
|
+
/**
|
446
|
+
* Creates a new UFormattedNumber for holding the result of a number formatting operation.
|
447
|
+
*
|
448
|
+
* Objects of type UFormattedNumber are not guaranteed to be threadsafe.
|
449
|
+
*
|
450
|
+
* NOTE: This is a C-compatible API; C++ users should build against numberformatter.h instead.
|
451
|
+
*
|
452
|
+
* @param ec Set if an error occurs.
|
453
|
+
* @draft ICU 62
|
454
|
+
*/
|
455
|
+
U_DRAFT UFormattedNumber* U_EXPORT2
|
456
|
+
unumf_openResult(UErrorCode* ec);
|
457
|
+
|
458
|
+
|
459
|
+
/**
|
460
|
+
* Uses a UNumberFormatter to format an integer to a UFormattedNumber. A string, field position, and other
|
461
|
+
* information can be retrieved from the UFormattedNumber.
|
462
|
+
*
|
463
|
+
* The UNumberFormatter can be shared between threads. Each thread should have its own local
|
464
|
+
* UFormattedNumber, however, for storing the result of the formatting operation.
|
465
|
+
*
|
466
|
+
* NOTE: This is a C-compatible API; C++ users should build against numberformatter.h instead.
|
467
|
+
*
|
468
|
+
* @param uformatter A formatter object created by unumf_openForSkeletonAndLocale or similar.
|
469
|
+
* @param value The number to be formatted.
|
470
|
+
* @param uresult The object that will be mutated to store the result; see unumf_openResult.
|
471
|
+
* @param ec Set if an error occurs.
|
472
|
+
* @draft ICU 62
|
473
|
+
*/
|
474
|
+
U_DRAFT void U_EXPORT2
|
475
|
+
unumf_formatInt(const UNumberFormatter* uformatter, int64_t value, UFormattedNumber* uresult,
|
476
|
+
UErrorCode* ec);
|
477
|
+
|
478
|
+
|
479
|
+
/**
|
480
|
+
* Uses a UNumberFormatter to format a double to a UFormattedNumber. A string, field position, and other
|
481
|
+
* information can be retrieved from the UFormattedNumber.
|
482
|
+
*
|
483
|
+
* The UNumberFormatter can be shared between threads. Each thread should have its own local
|
484
|
+
* UFormattedNumber, however, for storing the result of the formatting operation.
|
485
|
+
*
|
486
|
+
* NOTE: This is a C-compatible API; C++ users should build against numberformatter.h instead.
|
487
|
+
*
|
488
|
+
* @param uformatter A formatter object created by unumf_openForSkeletonAndLocale or similar.
|
489
|
+
* @param value The number to be formatted.
|
490
|
+
* @param uresult The object that will be mutated to store the result; see unumf_openResult.
|
491
|
+
* @param ec Set if an error occurs.
|
492
|
+
* @draft ICU 62
|
493
|
+
*/
|
494
|
+
U_DRAFT void U_EXPORT2
|
495
|
+
unumf_formatDouble(const UNumberFormatter* uformatter, double value, UFormattedNumber* uresult,
|
496
|
+
UErrorCode* ec);
|
497
|
+
|
498
|
+
|
499
|
+
/**
|
500
|
+
* Uses a UNumberFormatter to format a decimal number to a UFormattedNumber. A string, field position, and
|
501
|
+
* other information can be retrieved from the UFormattedNumber.
|
502
|
+
*
|
503
|
+
* The UNumberFormatter can be shared between threads. Each thread should have its own local
|
504
|
+
* UFormattedNumber, however, for storing the result of the formatting operation.
|
505
|
+
*
|
506
|
+
* The syntax of the unformatted number is a "numeric string" as defined in the Decimal Arithmetic
|
507
|
+
* Specification, available at http://speleotrove.com/decimal
|
508
|
+
*
|
509
|
+
* NOTE: This is a C-compatible API; C++ users should build against numberformatter.h instead.
|
510
|
+
*
|
511
|
+
* @param uformatter A formatter object created by unumf_openForSkeletonAndLocale or similar.
|
512
|
+
* @param value The numeric string to be formatted.
|
513
|
+
* @param valueLen The length of the numeric string, or -1 if it is NUL-terminated.
|
514
|
+
* @param uresult The object that will be mutated to store the result; see unumf_openResult.
|
515
|
+
* @param ec Set if an error occurs.
|
516
|
+
* @draft ICU 62
|
517
|
+
*/
|
518
|
+
U_DRAFT void U_EXPORT2
|
519
|
+
unumf_formatDecimal(const UNumberFormatter* uformatter, const char* value, int32_t valueLen,
|
520
|
+
UFormattedNumber* uresult, UErrorCode* ec);
|
521
|
+
|
522
|
+
|
523
|
+
/**
|
524
|
+
* Extracts the result number string out of a UFormattedNumber to a UChar buffer if possible.
|
525
|
+
* If bufferCapacity is greater than the required length, a terminating NUL is written.
|
526
|
+
* If bufferCapacity is less than the required length, an error code is set.
|
527
|
+
*
|
528
|
+
* NOTE: This is a C-compatible API; C++ users should build against numberformatter.h instead.
|
529
|
+
*
|
530
|
+
* @param uresult The object containing the formatted number.
|
531
|
+
* @param buffer Where to save the string output.
|
532
|
+
* @param bufferCapacity The number of UChars available in the buffer.
|
533
|
+
* @param ec Set if an error occurs.
|
534
|
+
* @return The required length.
|
535
|
+
* @draft ICU 62
|
536
|
+
*/
|
537
|
+
U_DRAFT int32_t U_EXPORT2
|
538
|
+
unumf_resultToString(const UFormattedNumber* uresult, UChar* buffer, int32_t bufferCapacity,
|
539
|
+
UErrorCode* ec);
|
540
|
+
|
541
|
+
|
542
|
+
/**
|
543
|
+
* Determines the start and end indices of the next occurrence of the given <em>field</em> in the
|
544
|
+
* output string. This allows you to determine the locations of, for example, the integer part,
|
545
|
+
* fraction part, or symbols.
|
546
|
+
*
|
547
|
+
* If a field occurs just once, calling this method will find that occurrence and return it. If a
|
548
|
+
* field occurs multiple times, this method may be called repeatedly with the following pattern:
|
549
|
+
*
|
550
|
+
* <pre>
|
551
|
+
* UFieldPosition ufpos = {UNUM_GROUPING_SEPARATOR_FIELD, 0, 0};
|
552
|
+
* while (unumf_resultNextFieldPosition(uresult, ufpos, &ec)) {
|
553
|
+
* // do something with ufpos.
|
554
|
+
* }
|
555
|
+
* </pre>
|
556
|
+
*
|
557
|
+
* This method is useful if you know which field to query. If you want all available field position
|
558
|
+
* information, use unumf_resultGetAllFieldPositions().
|
559
|
+
*
|
560
|
+
* NOTE: All fields of the UFieldPosition must be initialized before calling this method.
|
561
|
+
*
|
562
|
+
* @param fieldPosition
|
563
|
+
* Input+output variable. On input, the "field" property determines which field to look up,
|
564
|
+
* and the "endIndex" property determines where to begin the search. On output, the
|
565
|
+
* "beginIndex" field is set to the beginning of the first occurrence of the field after the
|
566
|
+
* input "endIndex", and "endIndex" is set to the end of that occurrence of the field
|
567
|
+
* (exclusive index). If a field position is not found, the FieldPosition is not changed and
|
568
|
+
* the method returns FALSE.
|
569
|
+
* @param ec Set if an error occurs.
|
570
|
+
* @draft ICU 62
|
571
|
+
*/
|
572
|
+
U_DRAFT UBool U_EXPORT2
|
573
|
+
unumf_resultNextFieldPosition(const UFormattedNumber* uresult, UFieldPosition* ufpos, UErrorCode* ec);
|
574
|
+
|
575
|
+
|
576
|
+
/**
|
577
|
+
* Populates the given iterator with all fields in the formatted output string. This allows you to
|
578
|
+
* determine the locations of the integer part, fraction part, and sign.
|
579
|
+
*
|
580
|
+
* If you need information on only one field, use unumf_resultNextFieldPosition().
|
581
|
+
*
|
582
|
+
* @param uresult The object containing the formatted number.
|
583
|
+
* @param fpositer
|
584
|
+
* A pointer to a UFieldPositionIterator created by {@link #ufieldpositer_open}. Iteration
|
585
|
+
* information already present in the UFieldPositionIterator is deleted, and the iterator is reset
|
586
|
+
* to apply to the fields in the formatted string created by this function call. The field values
|
587
|
+
* and indexes returned by {@link #ufieldpositer_next} represent fields denoted by
|
588
|
+
* the UNumberFormatFields enum. Fields are not returned in a guaranteed order. Fields cannot
|
589
|
+
* overlap, but they may nest. For example, 1234 could format as "1,234" which might consist of a
|
590
|
+
* grouping separator field for ',' and an integer field encompassing the entire string.
|
591
|
+
* @param ec Set if an error occurs.
|
592
|
+
* @draft ICU 62
|
593
|
+
*/
|
594
|
+
U_DRAFT void U_EXPORT2
|
595
|
+
unumf_resultGetAllFieldPositions(const UFormattedNumber* uresult, UFieldPositionIterator* ufpositer,
|
596
|
+
UErrorCode* ec);
|
597
|
+
|
598
|
+
|
599
|
+
/**
|
600
|
+
* Releases the UNumberFormatter created by unumf_openForSkeletonAndLocale().
|
601
|
+
*
|
602
|
+
* NOTE: This is a C-compatible API; C++ users should build against numberformatter.h instead.
|
603
|
+
*
|
604
|
+
* @param uformatter An object created by unumf_openForSkeletonAndLocale().
|
605
|
+
* @draft ICU 62
|
606
|
+
*/
|
607
|
+
U_DRAFT void U_EXPORT2
|
608
|
+
unumf_close(UNumberFormatter* uformatter);
|
609
|
+
|
610
|
+
|
611
|
+
/**
|
612
|
+
* Releases the UFormattedNumber created by unumf_openResult().
|
613
|
+
*
|
614
|
+
* NOTE: This is a C-compatible API; C++ users should build against numberformatter.h instead.
|
615
|
+
*
|
616
|
+
* @param uresult An object created by unumf_openResult().
|
617
|
+
* @draft ICU 62
|
618
|
+
*/
|
619
|
+
U_DRAFT void U_EXPORT2
|
620
|
+
unumf_closeResult(UFormattedNumber* uresult);
|
621
|
+
|
622
|
+
|
623
|
+
#if U_SHOW_CPLUSPLUS_API
|
624
|
+
U_NAMESPACE_BEGIN
|
625
|
+
|
626
|
+
/**
|
627
|
+
* \class LocalUNumberFormatterPointer
|
628
|
+
* "Smart pointer" class; closes a UNumberFormatter via unumf_close().
|
629
|
+
* For most methods see the LocalPointerBase base class.
|
630
|
+
*
|
631
|
+
* Usage:
|
632
|
+
* <pre>
|
633
|
+
* LocalUNumberFormatterPointer uformatter(unumf_openForSkeletonAndLocale(...));
|
634
|
+
* // no need to explicitly call unumf_close()
|
635
|
+
* </pre>
|
636
|
+
*
|
637
|
+
* @see LocalPointerBase
|
638
|
+
* @see LocalPointer
|
639
|
+
* @draft ICU 62
|
640
|
+
*/
|
641
|
+
U_DEFINE_LOCAL_OPEN_POINTER(LocalUNumberFormatterPointer, UNumberFormatter, unumf_close);
|
642
|
+
|
643
|
+
/**
|
644
|
+
* \class LocalUNumberFormatterPointer
|
645
|
+
* "Smart pointer" class; closes a UFormattedNumber via unumf_closeResult().
|
646
|
+
* For most methods see the LocalPointerBase base class.
|
647
|
+
*
|
648
|
+
* Usage:
|
649
|
+
* <pre>
|
650
|
+
* LocalUFormattedNumberPointer uformatter(unumf_openResult(...));
|
651
|
+
* // no need to explicitly call unumf_closeResult()
|
652
|
+
* </pre>
|
653
|
+
*
|
654
|
+
* @see LocalPointerBase
|
655
|
+
* @see LocalPointer
|
656
|
+
* @draft ICU 62
|
657
|
+
*/
|
658
|
+
U_DEFINE_LOCAL_OPEN_POINTER(LocalUFormattedNumberPointer, UFormattedNumber, unumf_closeResult);
|
659
|
+
|
660
|
+
U_NAMESPACE_END
|
661
|
+
#endif // U_SHOW_CPLUSPLUS_API
|
662
|
+
|
663
|
+
#endif /* U_HIDE_DRAFT_API */
|
664
|
+
|
665
|
+
#endif //__UNUMBERFORMATTER_H__
|
666
|
+
#endif /* #if !UCONFIG_NO_FORMATTING */
|
667
|
+
|
668
|
+
|
669
|
+
|
670
|
+
|
671
|
+
|
672
|
+
|
673
|
+
|
674
|
+
|
675
|
+
|
676
|
+
|
677
|
+
|
678
|
+
|
679
|
+
|
680
|
+
|
681
|
+
|
682
|
+
|
683
|
+
|
684
|
+
|
685
|
+
|
686
|
+
|
687
|
+
|
688
|
+
|
689
|
+
|
690
|
+
|
691
|
+
|
692
|
+
|
693
|
+
|
694
|
+
|
695
|
+
|
696
|
+
|
697
|
+
|
698
|
+
|
699
|
+
|
700
|
+
|
701
|
+
|
702
|
+
|
703
|
+
|
704
|
+
|
705
|
+
|
706
|
+
|
707
|
+
|
708
|
+
|
709
|
+
|
710
|
+
|
711
|
+
|
712
|
+
|
713
|
+
|
714
|
+
|
715
|
+
|
716
|
+
|
717
|
+
|