ICU 78.2 78.2

numberrangeformatter.h
Go to the documentation of this file.
1 // © 2018 and later: Unicode, Inc. and others.
2 // License & terms of use: http://www.unicode.org/copyright.html
3
4 #ifndef __NUMBERRANGEFORMATTER_H__
5 #define __NUMBERRANGEFORMATTER_H__
6
7 #include "unicode/utypes.h"
8
9 #if U_SHOW_CPLUSPLUS_API
10
11 #if !UCONFIG_NO_FORMATTING
12
13 #include <atomic>
14 #include "unicode/appendable.h"
15 #include "unicode/fieldpos.h"
16 #include "unicode/formattedvalue.h"
17 #include "unicode/fpositer.h"
18 #include "unicode/numberformatter.h"
19 #include "unicode/unumberrangeformatter.h"
20
48 U_NAMESPACE_BEGIN
49
50 // Forward declarations:
51 class PluralRules;
52
53 namespace number { // icu::number
54
55 // Forward declarations:
56 class UnlocalizedNumberRangeFormatter;
57 class LocalizedNumberRangeFormatter;
58 class FormattedNumberRange;
59
60 namespace impl {
61
62 // Forward declarations:
63 struct RangeMacroProps;
64 class DecimalQuantity;
65 class UFormattedNumberRangeData;
66 class NumberRangeFormatterImpl;
67 struct UFormattedNumberRangeImpl;
68
69 } // namespace impl
70
71 // Other helper classes would go here, but there are none.
72
73 namespace impl { // icu::number::impl
74
75 // Do not enclose entire MacroProps with #ifndef U_HIDE_INTERNAL_API, needed for a protected field
77 struct RangeMacroProps : public UMemory {
79 UnlocalizedNumberFormatter formatter1; // = NumberFormatter::with();
80
82 UnlocalizedNumberFormatter formatter2; // = NumberFormatter::with();
83
85 bool singleFormatter = true;
86
88 UNumberRangeCollapse collapse = UNUM_RANGE_COLLAPSE_AUTO;
89
91 UNumberRangeIdentityFallback identityFallback = UNUM_IDENTITY_FALLBACK_APPROXIMATELY;
92
94 Locale locale;
95
96 // NOTE: Uses default copy and move constructors.
97
102 bool copyErrorTo(UErrorCode &status) const {
103 return formatter1.copyErrorTo(status) || formatter2.copyErrorTo(status);
104 }
105 };
106
107 } // namespace impl
108
114 template<typename Derived>
115 class U_I18N_API NumberRangeFormatterSettings {
116 public:
129 Derived numberFormatterBoth(const UnlocalizedNumberFormatter &formatter) const &;
130
140 Derived numberFormatterBoth(const UnlocalizedNumberFormatter &formatter) &&;
141
151 Derived numberFormatterBoth(UnlocalizedNumberFormatter &&formatter) const &;
152
162 Derived numberFormatterBoth(UnlocalizedNumberFormatter &&formatter) &&;
163
175 Derived numberFormatterFirst(const UnlocalizedNumberFormatter &formatterFirst) const &;
176
186 Derived numberFormatterFirst(const UnlocalizedNumberFormatter &formatterFirst) &&;
187
197 Derived numberFormatterFirst(UnlocalizedNumberFormatter &&formatterFirst) const &;
198
208 Derived numberFormatterFirst(UnlocalizedNumberFormatter &&formatterFirst) &&;
209
221 Derived numberFormatterSecond(const UnlocalizedNumberFormatter &formatterSecond) const &;
222
232 Derived numberFormatterSecond(const UnlocalizedNumberFormatter &formatterSecond) &&;
233
243 Derived numberFormatterSecond(UnlocalizedNumberFormatter &&formatterSecond) const &;
244
254 Derived numberFormatterSecond(UnlocalizedNumberFormatter &&formatterSecond) &&;
255
273 Derived collapse(UNumberRangeCollapse collapse) const &;
274
284 Derived collapse(UNumberRangeCollapse collapse) &&;
285
306 Derived identityFallback(UNumberRangeIdentityFallback identityFallback) const &;
307
317 Derived identityFallback(UNumberRangeIdentityFallback identityFallback) &&;
318
330 LocalPointer<Derived> clone() const &;
331
339 LocalPointer<Derived> clone() &&;
340
347 UBool copyErrorTo(UErrorCode &outErrorCode) const {
348 if (U_FAILURE(outErrorCode)) {
349 // Do not overwrite the older error code
350 return true;
351 }
352 fMacros.copyErrorTo(outErrorCode);
353 return U_FAILURE(outErrorCode);
354 }
355
356 // NOTE: Uses default copy and move constructors.
357
358 private:
359 impl::RangeMacroProps fMacros;
360
361 // Don't construct me directly! Use (Un)LocalizedNumberFormatter.
362 NumberRangeFormatterSettings() = default;
363
364 friend class LocalizedNumberRangeFormatter;
365 friend class UnlocalizedNumberRangeFormatter;
366 };
367
368 // Explicit instantiations in source/i18n/numrange_fluent.cpp.
369 // (MSVC treats imports/exports of explicit instantiations differently.)
370 #ifndef _MSC_VER
371 extern template class NumberRangeFormatterSettings<UnlocalizedNumberRangeFormatter>;
372 extern template class NumberRangeFormatterSettings<LocalizedNumberRangeFormatter>;
373 #endif
374
383 class U_I18N_API UnlocalizedNumberRangeFormatter
384 : public NumberRangeFormatterSettings<UnlocalizedNumberRangeFormatter>, public UMemory {
385
386 public:
396 LocalizedNumberRangeFormatter locale(const icu::Locale &locale) const &;
397
407 LocalizedNumberRangeFormatter locale(const icu::Locale &locale) &&;
408
414 UnlocalizedNumberRangeFormatter() = default;
415
420 UnlocalizedNumberRangeFormatter(const UnlocalizedNumberRangeFormatter &other);
421
427 UnlocalizedNumberRangeFormatter(UnlocalizedNumberRangeFormatter&& src) noexcept;
428
433 UnlocalizedNumberRangeFormatter& operator=(const UnlocalizedNumberRangeFormatter& other);
434
440 UnlocalizedNumberRangeFormatter& operator=(UnlocalizedNumberRangeFormatter&& src) noexcept;
441
442 private:
443 explicit UnlocalizedNumberRangeFormatter(
444 const NumberRangeFormatterSettings<UnlocalizedNumberRangeFormatter>& other);
445
446 explicit UnlocalizedNumberRangeFormatter(
447 NumberRangeFormatterSettings<UnlocalizedNumberRangeFormatter>&& src) noexcept;
448
449 explicit UnlocalizedNumberRangeFormatter(const impl::RangeMacroProps &macros);
450
451 explicit UnlocalizedNumberRangeFormatter(impl::RangeMacroProps &&macros);
452
453 // To give the fluent setters access to this class's constructor:
454 friend class NumberRangeFormatterSettings<UnlocalizedNumberRangeFormatter>;
455
456 // To give NumberRangeFormatter::with() access to this class's constructor:
457 friend class NumberRangeFormatter;
458
459 // To give LNRF::withoutLocale() access to this class's constructor:
460 friend class LocalizedNumberRangeFormatter;
461 };
462
471 class U_I18N_API_CLASS LocalizedNumberRangeFormatter
472 : public NumberRangeFormatterSettings<LocalizedNumberRangeFormatter>, public UMemory {
473 public:
487 U_I18N_API FormattedNumberRange formatFormattableRange(
488 const Formattable& first, const Formattable& second, UErrorCode& status) const;
489
496 U_I18N_API UnlocalizedNumberRangeFormatter withoutLocale() const &;
497
505 U_I18N_API UnlocalizedNumberRangeFormatter withoutLocale() &&;
506
512 U_I18N_API LocalizedNumberRangeFormatter() = default;
513
518 U_I18N_API LocalizedNumberRangeFormatter(const LocalizedNumberRangeFormatter &other);
519
525 U_I18N_API LocalizedNumberRangeFormatter(LocalizedNumberRangeFormatter&& src) noexcept;
526
531 U_I18N_API LocalizedNumberRangeFormatter& operator=(const LocalizedNumberRangeFormatter& other);
532
538 U_I18N_API LocalizedNumberRangeFormatter& operator=(LocalizedNumberRangeFormatter&& src) noexcept;
539
540 #ifndef U_HIDE_INTERNAL_API
541
552 U_I18N_API void formatImpl(impl::UFormattedNumberRangeData &results, bool equalBeforeRounding,
553 UErrorCode &status) const;
554
555 #endif /* U_HIDE_INTERNAL_API */
556
561 U_I18N_API ~LocalizedNumberRangeFormatter();
562
563 private:
564 std::atomic<impl::NumberRangeFormatterImpl*> fAtomicFormatter = {};
565
566 const impl::NumberRangeFormatterImpl* getFormatter(UErrorCode& stauts) const;
567
568 explicit LocalizedNumberRangeFormatter(
569 const NumberRangeFormatterSettings<LocalizedNumberRangeFormatter>& other);
570
571 explicit LocalizedNumberRangeFormatter(
572 NumberRangeFormatterSettings<LocalizedNumberRangeFormatter>&& src) noexcept;
573
574 LocalizedNumberRangeFormatter(const impl::RangeMacroProps &macros, const Locale &locale);
575
576 LocalizedNumberRangeFormatter(impl::RangeMacroProps &&macros, const Locale &locale);
577
578 // To give the fluent setters access to this class's constructor:
579 friend class NumberRangeFormatterSettings<UnlocalizedNumberRangeFormatter>;
580 friend class NumberRangeFormatterSettings<LocalizedNumberRangeFormatter>;
581
582 // To give UnlocalizedNumberRangeFormatter::locale() access to this class's constructor:
583 friend class UnlocalizedNumberRangeFormatter;
584 };
585
594 class U_I18N_API FormattedNumberRange : public UMemory, public FormattedValue {
595 public:
596 // Copybrief: this method is older than the parent method
604 UnicodeString toString(UErrorCode& status) const override;
605
606 // Copydoc: this method is new in ICU 64
608 UnicodeString toTempString(UErrorCode& status) const override;
609
610 // Copybrief: this method is older than the parent method
618 Appendable &appendTo(Appendable &appendable, UErrorCode& status) const override;
619
620 // Copydoc: this method is new in ICU 64
622 UBool nextPosition(ConstrainedFieldPosition& cfpos, UErrorCode& status) const override;
623
643 template<typename StringClass>
644 inline std::pair<StringClass, StringClass> getDecimalNumbers(UErrorCode& status) const;
645
655 UNumberRangeIdentityResult getIdentityResult(UErrorCode& status) const;
656
661 FormattedNumberRange()
662 : fData(nullptr), fErrorCode(U_INVALID_STATE_ERROR) {}
663
667 FormattedNumberRange(const FormattedNumberRange&) = delete;
668
672 FormattedNumberRange& operator=(const FormattedNumberRange&) = delete;
673
679 FormattedNumberRange(FormattedNumberRange&& src) noexcept;
680
686 FormattedNumberRange& operator=(FormattedNumberRange&& src) noexcept;
687
692 ~FormattedNumberRange();
693
694 private:
695 // Can't use LocalPointer because UFormattedNumberRangeData is forward-declared
696 const impl::UFormattedNumberRangeData *fData;
697
698 // Error code for the terminal methods
699 UErrorCode fErrorCode;
700
704 explicit FormattedNumberRange(impl::UFormattedNumberRangeData *results)
705 : fData(results), fErrorCode(U_ZERO_ERROR) {}
706
707 explicit FormattedNumberRange(UErrorCode errorCode)
708 : fData(nullptr), fErrorCode(errorCode) {}
709
710 void getDecimalNumbers(ByteSink& sink1, ByteSink& sink2, UErrorCode& status) const;
711
712 const impl::UFormattedNumberRangeData* getData(UErrorCode& status) const;
713
714 // To allow PluralRules to access the underlying data
715 friend class ::icu::PluralRules;
716
717 // To give LocalizedNumberRangeFormatter format methods access to this class's constructor:
718 friend class LocalizedNumberRangeFormatter;
719
720 // To give C API access to internals
721 friend struct impl::UFormattedNumberRangeImpl;
722 };
723
724 // inline impl of @stable ICU 68 method
725 template<typename StringClass>
726 std::pair<StringClass, StringClass> FormattedNumberRange::getDecimalNumbers(UErrorCode& status) const {
727 StringClass str1;
728 StringClass str2;
729 StringByteSink<StringClass> sink1(&str1);
730 StringByteSink<StringClass> sink2(&str2);
731 getDecimalNumbers(sink1, sink2, status);
732 return std::make_pair(str1, str2);
733 }
734
740 class U_I18N_API NumberRangeFormatter final {
741 public:
749 static UnlocalizedNumberRangeFormatter with();
750
760 static LocalizedNumberRangeFormatter withLocale(const Locale &locale);
761
765 NumberRangeFormatter() = delete;
766 };
767
768 } // namespace number
769 U_NAMESPACE_END
770
771 #endif /* #if !UCONFIG_NO_FORMATTING */
772
773 #endif /* U_SHOW_CPLUSPLUS_API */
774
775 #endif // __NUMBERRANGEFORMATTER_H__
776
appendable.h
C++ API: Appendable class: Sink for Unicode code points and 16-bit code units (char16_ts).
icu::Appendable
Base class for objects to which Unicode characters and strings can be appended.
Definition: appendable.h:54
icu::ByteSink
A ByteSink can be filled with bytes.
Definition: bytestream.h:55
icu::ConstrainedFieldPosition
Represents a span of a string containing a given field.
Definition: formattedvalue.h:41
icu::Formattable
Formattable objects can be passed to the Format class or its subclasses for formatting.
Definition: fmtable.h:63
icu::FormattedValue
An abstract formatted value: a string with associated field attributes.
Definition: formattedvalue.h:241
icu::LocalPointer
"Smart pointer" class, deletes objects via the standard C++ delete operator.
Definition: localpointer.h:189
icu::Locale
A Locale object represents a specific geographical, political, or cultural region.
Definition: locid.h:198
icu::StringByteSink
Implementation of ByteSink that writes to a "string".
Definition: bytestream.h:291
icu::UMemory
UMemory is the common ICU base class.
Definition: uobject.h:115
icu::UnicodeString
UnicodeString is a string class that stores Unicode characters directly and provides similar function...
Definition: unistr.h:303
icu::number::FormattedNumberRange
The result of a number range formatting operation.
Definition: numberrangeformatter.h:594
icu::number::FormattedNumberRange::toTempString
UnicodeString toTempString(UErrorCode &status) const override
Returns the formatted string as a read-only alias to memory owned by the FormattedValue.
icu::number::FormattedNumberRange::toString
UnicodeString toString(UErrorCode &status) const override
Returns the formatted string as a self-contained UnicodeString.
icu::number::FormattedNumberRange::FormattedNumberRange
FormattedNumberRange(const FormattedNumberRange &)=delete
Copying not supported; use move constructor instead.
icu::number::FormattedNumberRange::nextPosition
UBool nextPosition(ConstrainedFieldPosition &cfpos, UErrorCode &status) const override
Iterates over field positions in the FormattedValue.
icu::number::FormattedNumberRange::getIdentityResult
UNumberRangeIdentityResult getIdentityResult(UErrorCode &status) const
Returns whether the pair of numbers was successfully formatted as a range or whether an identity fall...
icu::number::FormattedNumberRange::appendTo
Appendable & appendTo(Appendable &appendable, UErrorCode &status) const override
Appends the formatted string to an Appendable.
icu::number::FormattedNumberRange::FormattedNumberRange
FormattedNumberRange(FormattedNumberRange &&src) noexcept
Move constructor: Leaves the source FormattedNumberRange in an undefined state.
icu::number::FormattedNumberRange::FormattedNumberRange
FormattedNumberRange()
Default constructor; makes an empty FormattedNumberRange.
Definition: numberrangeformatter.h:661
icu::number::FormattedNumberRange::operator=
FormattedNumberRange & operator=(const FormattedNumberRange &)=delete
Copying not supported; use move assignment instead.
icu::number::FormattedNumberRange::~FormattedNumberRange
~FormattedNumberRange()
Destruct an instance of FormattedNumberRange, cleaning up any memory it might own.
icu::number::FormattedNumberRange::operator=
FormattedNumberRange & operator=(FormattedNumberRange &&src) noexcept
Move assignment: Leaves the source FormattedNumberRange in an undefined state.
icu::number::LocalizedNumberRangeFormatter
A NumberRangeFormatter that has a locale associated with it; this means .formatRange() methods are av...
Definition: numberrangeformatter.h:472
icu::number::LocalizedNumberRangeFormatter::formatFormattableRange
U_I18N_API FormattedNumberRange formatFormattableRange(const Formattable &first, const Formattable &second, UErrorCode &status) const
Format the given Formattables to a string using the settings specified in the NumberRangeFormatter fl...
icu::number::LocalizedNumberRangeFormatter::~LocalizedNumberRangeFormatter
U_I18N_API ~LocalizedNumberRangeFormatter()
Destruct this LocalizedNumberRangeFormatter, cleaning up any memory it might own.
icu::number::LocalizedNumberRangeFormatter::formatImpl
U_I18N_API void formatImpl(impl::UFormattedNumberRangeData &results, bool equalBeforeRounding, UErrorCode &status) const
icu::number::LocalizedNumberRangeFormatter::withoutLocale
U_I18N_API UnlocalizedNumberRangeFormatter withoutLocale() const &
Disassociate the locale from this formatter.
icu::number::NumberFormatterSettings::copyErrorTo
UBool copyErrorTo(UErrorCode &outErrorCode) const
Sets the UErrorCode if an error occurred in the fluent chain.
Definition: numberformatter.h:2393
icu::number::NumberRangeFormatterSettings
An abstract base class for specifying settings related to number formatting.
Definition: numberrangeformatter.h:115
icu::number::NumberRangeFormatterSettings::numberFormatterSecond
Derived numberFormatterSecond(UnlocalizedNumberFormatter &&formatterSecond) &&
Overload of numberFormatterSecond() for use on an rvalue reference.
icu::number::NumberRangeFormatterSettings::numberFormatterFirst
Derived numberFormatterFirst(UnlocalizedNumberFormatter &&formatterFirst) const &
Overload of numberFormatterFirst() for use on an rvalue reference.
icu::number::NumberRangeFormatterSettings::numberFormatterBoth
Derived numberFormatterBoth(const UnlocalizedNumberFormatter &formatter) &&
Overload of numberFormatterBoth() for use on an rvalue reference.
icu::number::NumberRangeFormatterSettings::numberFormatterFirst
Derived numberFormatterFirst(UnlocalizedNumberFormatter &&formatterFirst) &&
Overload of numberFormatterFirst() for use on an rvalue reference.
icu::number::NumberRangeFormatterSettings::numberFormatterBoth
Derived numberFormatterBoth(UnlocalizedNumberFormatter &&formatter) &&
Overload of numberFormatterBoth() for use on an rvalue reference.
icu::number::NumberRangeFormatterSettings::numberFormatterBoth
Derived numberFormatterBoth(const UnlocalizedNumberFormatter &formatter) const &
Sets the NumberFormatter instance to use for the numbers in the range.
icu::number::NumberRangeFormatterSettings::numberFormatterBoth
Derived numberFormatterBoth(UnlocalizedNumberFormatter &&formatter) const &
Overload of numberFormatterBoth() for use on an rvalue reference.
icu::number::NumberRangeFormatterSettings::numberFormatterFirst
Derived numberFormatterFirst(const UnlocalizedNumberFormatter &formatterFirst) &&
Overload of numberFormatterFirst() for use on an rvalue reference.
icu::number::NumberRangeFormatterSettings::identityFallback
Derived identityFallback(UNumberRangeIdentityFallback identityFallback) const &
Sets the behavior when the two sides of the range are the same.
icu::number::NumberRangeFormatterSettings::numberFormatterFirst
Derived numberFormatterFirst(const UnlocalizedNumberFormatter &formatterFirst) const &
Sets the NumberFormatter instance to use for the first number in the range.
icu::number::NumberRangeFormatterSettings::numberFormatterSecond
Derived numberFormatterSecond(UnlocalizedNumberFormatter &&formatterSecond) const &
Overload of numberFormatterSecond() for use on an rvalue reference.
icu::number::NumberRangeFormatterSettings::collapse
Derived collapse(UNumberRangeCollapse collapse) &&
Overload of collapse() for use on an rvalue reference.
icu::number::NumberRangeFormatterSettings::numberFormatterSecond
Derived numberFormatterSecond(const UnlocalizedNumberFormatter &formatterSecond) const &
Sets the NumberFormatter instance to use for the second number in the range.
icu::number::NumberRangeFormatterSettings::collapse
Derived collapse(UNumberRangeCollapse collapse) const &
Sets the aggressiveness of "collapsing" fields across the range separator.
icu::number::NumberRangeFormatterSettings::identityFallback
Derived identityFallback(UNumberRangeIdentityFallback identityFallback) &&
Overload of identityFallback() for use on an rvalue reference.
icu::number::NumberRangeFormatterSettings::numberFormatterSecond
Derived numberFormatterSecond(const UnlocalizedNumberFormatter &formatterSecond) &&
Overload of numberFormatterSecond() for use on an rvalue reference.
icu::number::NumberRangeFormatterSettings::clone
LocalPointer< Derived > clone() const &
Returns the current (Un)LocalizedNumberRangeFormatter as a LocalPointer wrapping a heap-allocated cop...
icu::number::NumberRangeFormatter
See the main description in numberrangeformatter.h for documentation and examples.
Definition: numberrangeformatter.h:740
icu::number::NumberRangeFormatter::with
static UnlocalizedNumberRangeFormatter with()
Call this method at the beginning of a NumberRangeFormatter fluent chain in which the locale is not c...
icu::number::NumberRangeFormatter::NumberRangeFormatter
NumberRangeFormatter()=delete
Use factory methods instead of the constructor to create a NumberFormatter.
icu::number::NumberRangeFormatter::withLocale
static LocalizedNumberRangeFormatter withLocale(const Locale &locale)
Call this method at the beginning of a NumberRangeFormatter fluent chain in which the locale is known...
icu::number::UnlocalizedNumberFormatter
A NumberFormatter that does not yet have a locale.
Definition: numberformatter.h:2434
icu::number::UnlocalizedNumberRangeFormatter
A NumberRangeFormatter that does not yet have a locale.
Definition: numberrangeformatter.h:384
icu::number::UnlocalizedNumberRangeFormatter::UnlocalizedNumberRangeFormatter
UnlocalizedNumberRangeFormatter(const UnlocalizedNumberRangeFormatter &other)
Returns a copy of this UnlocalizedNumberRangeFormatter.
icu::number::UnlocalizedNumberRangeFormatter::operator=
UnlocalizedNumberRangeFormatter & operator=(UnlocalizedNumberRangeFormatter &&src) noexcept
Move assignment operator: The source UnlocalizedNumberRangeFormatter will be left in a valid but unde...
icu::number::UnlocalizedNumberRangeFormatter::locale
LocalizedNumberRangeFormatter locale(const icu::Locale &locale) const &
Associate the given locale with the number range formatter.
icu::number::UnlocalizedNumberRangeFormatter::locale
LocalizedNumberRangeFormatter locale(const icu::Locale &locale) &&
Overload of locale() for use on an rvalue reference.
icu::number::UnlocalizedNumberRangeFormatter::operator=
UnlocalizedNumberRangeFormatter & operator=(const UnlocalizedNumberRangeFormatter &other)
Copy assignment operator.
icu::number::UnlocalizedNumberRangeFormatter::UnlocalizedNumberRangeFormatter
UnlocalizedNumberRangeFormatter(UnlocalizedNumberRangeFormatter &&src) noexcept
Move constructor: The source UnlocalizedNumberRangeFormatter will be left in a valid but undefined st...
icu::number::UnlocalizedNumberRangeFormatter::UnlocalizedNumberRangeFormatter
UnlocalizedNumberRangeFormatter()=default
Default constructor: puts the formatter into a valid but undefined state.
fieldpos.h
C++ API: FieldPosition identifies the fields in a formatted output.
formattedvalue.h
C++ API: Abstract operations for localized strings.
fpositer.h
C++ API: FieldPosition Iterator.
numberformatter.h
C++ API: All-in-one formatter for localized numbers, currencies, and units.
icu::number::impl::RangeMacroProps
Definition: numberrangeformatter.h:77
icu::number::impl::RangeMacroProps::locale
Locale locale
Definition: numberrangeformatter.h:94
icu::number::impl::RangeMacroProps::formatter2
UnlocalizedNumberFormatter formatter2
Definition: numberrangeformatter.h:82
icu::number::impl::RangeMacroProps::formatter1
UnlocalizedNumberFormatter formatter1
Definition: numberrangeformatter.h:79
icu::number::impl::RangeMacroProps::copyErrorTo
bool copyErrorTo(UErrorCode &status) const
Check all members for errors.
Definition: numberrangeformatter.h:102
UBool
int8_t UBool
The ICU boolean type, a signed-byte integer.
Definition: umachine.h:269
unumberrangeformatter.h
C API: Localized number range formatting.
UNumberRangeIdentityResult
UNumberRangeIdentityResult
Used in the result class FormattedNumberRange to indicate to the user whether the numbers formatted i...
Definition: unumberrangeformatter.h:165
UNumberRangeIdentityFallback
UNumberRangeIdentityFallback
Defines the behavior when the two numbers in the range are identical after rounding.
Definition: unumberrangeformatter.h:125
UNUM_IDENTITY_FALLBACK_APPROXIMATELY
@ UNUM_IDENTITY_FALLBACK_APPROXIMATELY
Show the number using a locale-sensitive approximation pattern.
Definition: unumberrangeformatter.h:147
UNumberRangeCollapse
UNumberRangeCollapse
Defines how to merge fields that are identical across the range sign.
Definition: unumberrangeformatter.h:83
UNUM_RANGE_COLLAPSE_AUTO
@ UNUM_RANGE_COLLAPSE_AUTO
Use locale data and heuristics to determine how much of the string to collapse.
Definition: unumberrangeformatter.h:92
utypes.h
Basic definitions for ICU, for both C and C++ APIs.
UErrorCode
UErrorCode
Standard ICU4C error code type, a substitute for exceptions.
Definition: utypes.h:509
U_INVALID_STATE_ERROR
@ U_INVALID_STATE_ERROR
Requested operation can not be completed with ICU in its current state.
Definition: utypes.h:573
U_ZERO_ERROR
@ U_ZERO_ERROR
No error, no warning.
Definition: utypes.h:544
U_FAILURE
#define U_FAILURE(x)
Does the error code indicate a failure?
Definition: utypes.h:827
U_I18N_API_CLASS
#define U_I18N_API_CLASS
Set to export library symbols from inside the i18n library, and to import them from outside,...
Definition: utypes.h:457
U_I18N_API
#define U_I18N_API
Set to export library symbols from inside the i18n library, and to import them from outside.
Definition: utypes.h:316