Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/unicode/unumberoptions.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 // © 2017 and later: Unicode, Inc. and others.
0002 // License & terms of use: http://www.unicode.org/copyright.html
0003 
0004 #ifndef __UNUMBEROPTIONS_H__
0005 #define __UNUMBEROPTIONS_H__
0006 
0007 #include "unicode/utypes.h"
0008 
0009 #if !UCONFIG_NO_FORMATTING
0010 
0011 /**
0012  * \file
0013  * \brief C API: Header-only input options for various number formatting APIs.
0014  *
0015  * You do not normally need to include this header file directly, because it is included in all
0016  * files that use these enums.
0017  */
0018 
0019 
0020 /** The possible number format rounding modes.
0021  *
0022  * <p>
0023  * For more detail on rounding modes, see:
0024  * https://unicode-org.github.io/icu/userguide/format_parse/numbers/rounding-modes
0025  *
0026  * @stable ICU 2.0
0027  */
0028 typedef enum UNumberFormatRoundingMode {
0029     UNUM_ROUND_CEILING,
0030     UNUM_ROUND_FLOOR,
0031     UNUM_ROUND_DOWN,
0032     UNUM_ROUND_UP,
0033     /**
0034      * Half-even rounding
0035      * @stable, ICU 3.8
0036      */
0037     UNUM_ROUND_HALFEVEN,
0038 #ifndef U_HIDE_DEPRECATED_API
0039     /**
0040      * Half-even rounding, misspelled name
0041      * @deprecated, ICU 3.8
0042      */
0043     UNUM_FOUND_HALFEVEN = UNUM_ROUND_HALFEVEN,
0044 #endif  /* U_HIDE_DEPRECATED_API */
0045     UNUM_ROUND_HALFDOWN = UNUM_ROUND_HALFEVEN + 1,
0046     UNUM_ROUND_HALFUP,
0047     /** 
0048       * ROUND_UNNECESSARY reports an error if formatted result is not exact.
0049       * @stable ICU 4.8
0050       */
0051     UNUM_ROUND_UNNECESSARY,
0052     /**
0053      * Rounds ties toward the odd number.
0054      * @stable ICU 69
0055      */
0056     UNUM_ROUND_HALF_ODD,
0057     /**
0058      * Rounds ties toward +∞.
0059      * @stable ICU 69
0060      */
0061     UNUM_ROUND_HALF_CEILING,
0062     /**
0063      * Rounds ties toward -∞.
0064      * @stable ICU 69
0065      */
0066     UNUM_ROUND_HALF_FLOOR,
0067 } UNumberFormatRoundingMode;
0068 
0069 
0070 /**
0071  * An enum declaring the strategy for when and how to display grouping separators (i.e., the
0072  * separator, often a comma or period, after every 2-3 powers of ten). The choices are several
0073  * pre-built strategies for different use cases that employ locale data whenever possible. Example
0074  * outputs for 1234 and 1234567 in <em>en-IN</em>:
0075  *
0076  * <ul>
0077  * <li>OFF: 1234 and 12345
0078  * <li>MIN2: 1234 and 12,34,567
0079  * <li>AUTO: 1,234 and 12,34,567
0080  * <li>ON_ALIGNED: 1,234 and 12,34,567
0081  * <li>THOUSANDS: 1,234 and 1,234,567
0082  * </ul>
0083  *
0084  * <p>
0085  * The default is AUTO, which displays grouping separators unless the locale data says that grouping
0086  * is not customary. To force grouping for all numbers greater than 1000 consistently across locales,
0087  * use ON_ALIGNED. On the other hand, to display grouping less frequently than the default, use MIN2
0088  * or OFF. See the docs of each option for details.
0089  *
0090  * <p>
0091  * Note: This enum specifies the strategy for grouping sizes. To set which character to use as the
0092  * grouping separator, use the "symbols" setter.
0093  *
0094  * @stable ICU 63
0095  */
0096 typedef enum UNumberGroupingStrategy {
0097     /**
0098      * Do not display grouping separators in any locale.
0099      *
0100      * @stable ICU 61
0101      */
0102             UNUM_GROUPING_OFF,
0103 
0104     /**
0105      * Display grouping using locale defaults, except do not show grouping on values smaller than
0106      * 10000 (such that there is a <em>minimum of two digits</em> before the first separator).
0107      *
0108      * <p>
0109      * Note that locales may restrict grouping separators to be displayed only on 1 million or
0110      * greater (for example, ee and hu) or disable grouping altogether (for example, bg currency).
0111      *
0112      * <p>
0113      * Locale data is used to determine whether to separate larger numbers into groups of 2
0114      * (customary in South Asia) or groups of 3 (customary in Europe and the Americas).
0115      *
0116      * @stable ICU 61
0117      */
0118             UNUM_GROUPING_MIN2,
0119 
0120     /**
0121      * Display grouping using the default strategy for all locales. This is the default behavior.
0122      *
0123      * <p>
0124      * Note that locales may restrict grouping separators to be displayed only on 1 million or
0125      * greater (for example, ee and hu) or disable grouping altogether (for example, bg currency).
0126      *
0127      * <p>
0128      * Locale data is used to determine whether to separate larger numbers into groups of 2
0129      * (customary in South Asia) or groups of 3 (customary in Europe and the Americas).
0130      *
0131      * @stable ICU 61
0132      */
0133             UNUM_GROUPING_AUTO,
0134 
0135     /**
0136      * Always display the grouping separator on values of at least 1000.
0137      *
0138      * <p>
0139      * This option ignores the locale data that restricts or disables grouping, described in MIN2 and
0140      * AUTO. This option may be useful to normalize the alignment of numbers, such as in a
0141      * spreadsheet.
0142      *
0143      * <p>
0144      * Locale data is used to determine whether to separate larger numbers into groups of 2
0145      * (customary in South Asia) or groups of 3 (customary in Europe and the Americas).
0146      *
0147      * @stable ICU 61
0148      */
0149             UNUM_GROUPING_ON_ALIGNED,
0150 
0151     /**
0152      * Use the Western defaults: groups of 3 and enabled for all numbers 1000 or greater. Do not use
0153      * locale data for determining the grouping strategy.
0154      *
0155      * @stable ICU 61
0156      */
0157             UNUM_GROUPING_THOUSANDS
0158 
0159 #ifndef U_HIDE_INTERNAL_API
0160     ,
0161     /**
0162      * One more than the highest UNumberGroupingStrategy value.
0163      *
0164      * @internal ICU 62: The numeric value may change over time; see ICU ticket #12420.
0165      */
0166             UNUM_GROUPING_COUNT
0167 #endif  /* U_HIDE_INTERNAL_API */
0168 
0169 } UNumberGroupingStrategy;
0170 
0171 
0172 #endif /* #if !UCONFIG_NO_FORMATTING */
0173 #endif //__UNUMBEROPTIONS_H__