numberrangeformatter.h
Go to the documentation of this file.
// © 2018 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
#ifndef __NUMBERRANGEFORMATTER_H__
#define __NUMBERRANGEFORMATTER_H__
#include "unicode/utypes.h"
#if U_SHOW_CPLUSPLUS_API
#if !UCONFIG_NO_FORMATTING
#include <atomic>
#include "unicode/appendable.h"
#include "unicode/fieldpos.h"
#include "unicode/formattedvalue.h"
#include "unicode/fpositer.h"
#include "unicode/numberformatter.h"
#include "unicode/unumberrangeformatter.h"
U_NAMESPACE_BEGIN
// Forward declarations:
class PluralRules;
namespace number { // icu::number
// Forward declarations:
class UnlocalizedNumberRangeFormatter;
class LocalizedNumberRangeFormatter;
class FormattedNumberRange;
namespace impl {
// Forward declarations:
struct RangeMacroProps;
class DecimalQuantity;
class UFormattedNumberRangeData;
class NumberRangeFormatterImpl;
struct UFormattedNumberRangeImpl;
} // namespace impl
#if U_PLATFORM == U_PF_WINDOWS && !defined(U_IN_DOXYGEN) && !defined(U_STATIC_IMPLEMENTATION)
} // namespace icu::number
U_NAMESPACE_END
template struct U_I18N_API std::atomic< U_NAMESPACE_QUALIFIER number::impl::NumberRangeFormatterImpl*>;
U_NAMESPACE_BEGIN
namespace number { // icu::number
#endif
// Other helper classes would go here, but there are none.
namespace impl { // icu::number::impl
// Do not enclose entire MacroProps with #ifndef U_HIDE_INTERNAL_API, needed for a protected field
struct U_I18N_API RangeMacroProps : public UMemory {
UnlocalizedNumberFormatter formatter1; // = NumberFormatter::with();
UnlocalizedNumberFormatter formatter2; // = NumberFormatter::with();
bool singleFormatter = true;
UNumberRangeCollapse collapse = UNUM_RANGE_COLLAPSE_AUTO;
UNumberRangeIdentityFallback identityFallback = UNUM_IDENTITY_FALLBACK_APPROXIMATELY;
Locale locale;
// NOTE: Uses default copy and move constructors.
bool copyErrorTo(UErrorCode &status) const {
return formatter1.copyErrorTo(status) || formatter2.copyErrorTo(status);
}
};
} // namespace impl
template<typename Derived>
class U_I18N_API NumberRangeFormatterSettings {
public:
Derived numberFormatterBoth(const UnlocalizedNumberFormatter &formatter) const &;
Derived numberFormatterBoth(const UnlocalizedNumberFormatter &formatter) &&;
Derived numberFormatterBoth(UnlocalizedNumberFormatter &&formatter) const &;
Derived numberFormatterBoth(UnlocalizedNumberFormatter &&formatter) &&;
Derived numberFormatterFirst(const UnlocalizedNumberFormatter &formatterFirst) const &;
Derived numberFormatterFirst(const UnlocalizedNumberFormatter &formatterFirst) &&;
Derived numberFormatterFirst(UnlocalizedNumberFormatter &&formatterFirst) const &;
Derived numberFormatterFirst(UnlocalizedNumberFormatter &&formatterFirst) &&;
Derived numberFormatterSecond(const UnlocalizedNumberFormatter &formatterSecond) const &;
Derived numberFormatterSecond(const UnlocalizedNumberFormatter &formatterSecond) &&;
Derived numberFormatterSecond(UnlocalizedNumberFormatter &&formatterSecond) const &;
Derived numberFormatterSecond(UnlocalizedNumberFormatter &&formatterSecond) &&;
Derived collapse(UNumberRangeCollapse collapse) const &;
Derived collapse(UNumberRangeCollapse collapse) &&;
Derived identityFallback(UNumberRangeIdentityFallback identityFallback) const &;
Derived identityFallback(UNumberRangeIdentityFallback identityFallback) &&;
LocalPointer<Derived> clone() const &;
LocalPointer<Derived> clone() &&;
UBool copyErrorTo(UErrorCode &outErrorCode) const {
if (U_FAILURE(outErrorCode)) {
// Do not overwrite the older error code
return true;
}
fMacros.copyErrorTo(outErrorCode);
return U_FAILURE(outErrorCode);
}
// NOTE: Uses default copy and move constructors.
private:
impl::RangeMacroProps fMacros;
// Don't construct me directly! Use (Un)LocalizedNumberFormatter.
NumberRangeFormatterSettings() = default;
friend class LocalizedNumberRangeFormatter;
friend class UnlocalizedNumberRangeFormatter;
};
// Explicit instantiations in source/i18n/numrange_fluent.cpp.
// (MSVC treats imports/exports of explicit instantiations differently.)
#ifndef _MSC_VER
extern template class NumberRangeFormatterSettings<UnlocalizedNumberRangeFormatter>;
extern template class NumberRangeFormatterSettings<LocalizedNumberRangeFormatter>;
#endif
class U_I18N_API UnlocalizedNumberRangeFormatter
: public NumberRangeFormatterSettings<UnlocalizedNumberRangeFormatter>, public UMemory {
public:
LocalizedNumberRangeFormatter locale(const icu::Locale &locale) const &;
LocalizedNumberRangeFormatter locale(const icu::Locale &locale) &&;
UnlocalizedNumberRangeFormatter() = default;
UnlocalizedNumberRangeFormatter(const UnlocalizedNumberRangeFormatter &other);
UnlocalizedNumberRangeFormatter(UnlocalizedNumberRangeFormatter&& src) noexcept;
UnlocalizedNumberRangeFormatter& operator=(const UnlocalizedNumberRangeFormatter& other);
UnlocalizedNumberRangeFormatter& operator=(UnlocalizedNumberRangeFormatter&& src) noexcept;
private:
explicit UnlocalizedNumberRangeFormatter(
const NumberRangeFormatterSettings<UnlocalizedNumberRangeFormatter>& other);
explicit UnlocalizedNumberRangeFormatter(
NumberRangeFormatterSettings<UnlocalizedNumberRangeFormatter>&& src) noexcept;
explicit UnlocalizedNumberRangeFormatter(const impl::RangeMacroProps &macros);
explicit UnlocalizedNumberRangeFormatter(impl::RangeMacroProps &&macros);
// To give the fluent setters access to this class's constructor:
friend class NumberRangeFormatterSettings<UnlocalizedNumberRangeFormatter>;
// To give NumberRangeFormatter::with() access to this class's constructor:
friend class NumberRangeFormatter;
// To give LNRF::withoutLocale() access to this class's constructor:
friend class LocalizedNumberRangeFormatter;
};
class U_I18N_API LocalizedNumberRangeFormatter
: public NumberRangeFormatterSettings<LocalizedNumberRangeFormatter>, public UMemory {
public:
FormattedNumberRange formatFormattableRange(
const Formattable& first, const Formattable& second, UErrorCode& status) const;
#ifndef U_HIDE_DRAFT_API
UnlocalizedNumberRangeFormatter withoutLocale() const &;
UnlocalizedNumberRangeFormatter withoutLocale() &&;
#endif // U_HIDE_DRAFT_API
LocalizedNumberRangeFormatter() = default;
LocalizedNumberRangeFormatter(const LocalizedNumberRangeFormatter &other);
LocalizedNumberRangeFormatter(LocalizedNumberRangeFormatter&& src) noexcept;
LocalizedNumberRangeFormatter& operator=(const LocalizedNumberRangeFormatter& other);
LocalizedNumberRangeFormatter& operator=(LocalizedNumberRangeFormatter&& src) noexcept;
#ifndef U_HIDE_INTERNAL_API
void formatImpl(impl::UFormattedNumberRangeData& results, bool equalBeforeRounding,
UErrorCode& status) const;
#endif /* U_HIDE_INTERNAL_API */
~LocalizedNumberRangeFormatter();
private:
std::atomic<impl::NumberRangeFormatterImpl*> fAtomicFormatter = {};
const impl::NumberRangeFormatterImpl* getFormatter(UErrorCode& stauts) const;
explicit LocalizedNumberRangeFormatter(
const NumberRangeFormatterSettings<LocalizedNumberRangeFormatter>& other);
explicit LocalizedNumberRangeFormatter(
NumberRangeFormatterSettings<LocalizedNumberRangeFormatter>&& src) noexcept;
LocalizedNumberRangeFormatter(const impl::RangeMacroProps &macros, const Locale &locale);
LocalizedNumberRangeFormatter(impl::RangeMacroProps &&macros, const Locale &locale);
// To give the fluent setters access to this class's constructor:
friend class NumberRangeFormatterSettings<UnlocalizedNumberRangeFormatter>;
friend class NumberRangeFormatterSettings<LocalizedNumberRangeFormatter>;
// To give UnlocalizedNumberRangeFormatter::locale() access to this class's constructor:
friend class UnlocalizedNumberRangeFormatter;
};
class U_I18N_API FormattedNumberRange : public UMemory, public FormattedValue {
public:
// Copybrief: this method is older than the parent method
UnicodeString toString(UErrorCode& status) const override;
// Copydoc: this method is new in ICU 64
UnicodeString toTempString(UErrorCode& status) const override;
// Copybrief: this method is older than the parent method
Appendable &appendTo(Appendable &appendable, UErrorCode& status) const override;
// Copydoc: this method is new in ICU 64
UBool nextPosition(ConstrainedFieldPosition& cfpos, UErrorCode& status) const override;
template<typename StringClass>
inline std::pair<StringClass, StringClass> getDecimalNumbers(UErrorCode& status) const;
UNumberRangeIdentityResult getIdentityResult(UErrorCode& status) const;
FormattedNumberRange()
: fData(nullptr), fErrorCode(U_INVALID_STATE_ERROR) {}
FormattedNumberRange(const FormattedNumberRange&) = delete;
FormattedNumberRange& operator=(const FormattedNumberRange&) = delete;
FormattedNumberRange(FormattedNumberRange&& src) noexcept;
FormattedNumberRange& operator=(FormattedNumberRange&& src) noexcept;
~FormattedNumberRange();
private:
// Can't use LocalPointer because UFormattedNumberRangeData is forward-declared
const impl::UFormattedNumberRangeData *fData;
// Error code for the terminal methods
UErrorCode fErrorCode;
explicit FormattedNumberRange(impl::UFormattedNumberRangeData *results)
: fData(results), fErrorCode(U_ZERO_ERROR) {}
explicit FormattedNumberRange(UErrorCode errorCode)
: fData(nullptr), fErrorCode(errorCode) {}
void getDecimalNumbers(ByteSink& sink1, ByteSink& sink2, UErrorCode& status) const;
const impl::UFormattedNumberRangeData* getData(UErrorCode& status) const;
// To allow PluralRules to access the underlying data
friend class ::icu::PluralRules;
// To give LocalizedNumberRangeFormatter format methods access to this class's constructor:
friend class LocalizedNumberRangeFormatter;
// To give C API access to internals
friend struct impl::UFormattedNumberRangeImpl;
};
// inline impl of @stable ICU 68 method
template<typename StringClass>
std::pair<StringClass, StringClass> FormattedNumberRange::getDecimalNumbers(UErrorCode& status) const {
StringClass str1;
StringClass str2;
StringByteSink<StringClass> sink1(&str1);
StringByteSink<StringClass> sink2(&str2);
getDecimalNumbers(sink1, sink2, status);
return std::make_pair(str1, str2);
}
class U_I18N_API NumberRangeFormatter final {
public:
static UnlocalizedNumberRangeFormatter with();
static LocalizedNumberRangeFormatter withLocale(const Locale &locale);
NumberRangeFormatter() = delete;
};
} // namespace number
U_NAMESPACE_END
#endif /* #if !UCONFIG_NO_FORMATTING */
#endif /* U_SHOW_CPLUSPLUS_API */
#endif // __NUMBERRANGEFORMATTER_H__
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:53
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:191
icu::Locale
A Locale object represents a specific geographical, political, or cultural region.
Definition: locid.h:195
icu::StringByteSink
Implementation of ByteSink that writes to a "string".
Definition: bytestream.h:267
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:296
icu::number::FormattedNumberRange
The result of a number range formatting operation.
Definition: numberrangeformatter.h:612
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:679
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:488
icu::number::LocalizedNumberRangeFormatter::formatFormattableRange
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::operator=
LocalizedNumberRangeFormatter & operator=(const LocalizedNumberRangeFormatter &other)
Copy assignment operator.
icu::number::LocalizedNumberRangeFormatter::LocalizedNumberRangeFormatter
LocalizedNumberRangeFormatter()=default
Default constructor: puts the formatter into a valid but undefined state.
icu::number::LocalizedNumberRangeFormatter::LocalizedNumberRangeFormatter
LocalizedNumberRangeFormatter(const LocalizedNumberRangeFormatter &other)
Returns a copy of this LocalizedNumberRangeFormatter.
icu::number::LocalizedNumberRangeFormatter::operator=
LocalizedNumberRangeFormatter & operator=(LocalizedNumberRangeFormatter &&src) noexcept
Move assignment operator: The source LocalizedNumberRangeFormatter will be left in a valid but undefi...
icu::number::LocalizedNumberRangeFormatter::formatImpl
void formatImpl(impl::UFormattedNumberRangeData &results, bool equalBeforeRounding, UErrorCode &status) const
icu::number::LocalizedNumberRangeFormatter::~LocalizedNumberRangeFormatter
~LocalizedNumberRangeFormatter()
Destruct this LocalizedNumberRangeFormatter, cleaning up any memory it might own.
icu::number::LocalizedNumberRangeFormatter::LocalizedNumberRangeFormatter
LocalizedNumberRangeFormatter(LocalizedNumberRangeFormatter &&src) noexcept
Move constructor: The source LocalizedNumberRangeFormatter will be left in a valid but undefined stat...
icu::number::LocalizedNumberRangeFormatter::withoutLocale
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:131
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:758
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:400
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:93
icu::number::impl::RangeMacroProps::locale
Locale locale
Definition: numberrangeformatter.h:110
icu::number::impl::RangeMacroProps::formatter2
UnlocalizedNumberFormatter formatter2
Definition: numberrangeformatter.h:98
icu::number::impl::RangeMacroProps::formatter1
UnlocalizedNumberFormatter formatter1
Definition: numberrangeformatter.h:95
icu::number::impl::RangeMacroProps::copyErrorTo
bool copyErrorTo(UErrorCode &status) const
Check all members for errors.
Definition: numberrangeformatter.h:118
UBool
int8_t UBool
The ICU boolean type, a signed-byte integer.
Definition: umachine.h:247
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:430
U_INVALID_STATE_ERROR
@ U_INVALID_STATE_ERROR
Requested operation can not be completed with ICU in its current state.
Definition: utypes.h:494
U_ZERO_ERROR
@ U_ZERO_ERROR
No error, no warning.
Definition: utypes.h:465
U_FAILURE
#define U_FAILURE(x)
Does the error code indicate a failure?
Definition: utypes.h:747
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