Inflection
Morphology Inflection
|
Provides representation of numerics as lexical tokens, such as ordinals or cardinals. More...
#include <NumberConcept.hpp>
Public Member Functions | |
virtual NumberConcept * | getAbsolute () const |
virtual NumberConcept * | minFractionDigits (int32_t min) const |
virtual NumberConcept * | maxFractionDigits (int32_t max) const |
virtual NumberConcept * | maxFractionDigitsAboveOne (int32_t given) const |
virtual int32_t | getMaximumFractionDigits () const |
virtual NumberConcept * | minIntegerDigits (int32_t min) const |
virtual NumberConcept * | maxIntegerDigits (int32_t max) const |
virtual NumberConcept * | grouping (bool grouping) const |
virtual NumberConcept * | roundUp () const |
virtual NumberConcept * | roundDown () const |
virtual NumberConcept * | roundHalfUp () const |
virtual NumberConcept * | roundHalfDown () const |
virtual NumberConcept * | roundCeiling () const |
virtual NumberConcept * | roundFloor () const |
virtual bool | getIsNegative () const |
virtual bool | hasFraction () const |
virtual const ::inflection::util::ULocale & | getLanguage () const |
virtual const ::inflection::util::ULocale & | getRegionLocale () const |
::std::u16string | toString () const override |
SpeakableString * | toSpeakableString () const override |
virtual ::std::u16string | getAsWords () const |
virtual ::std::u16string | asWords (const ::std::u16string &variant) const |
virtual SpeakableString | getAsSpokenWords () const |
virtual SpeakableString | asSpokenWords (const ::std::u16string &variant) const |
virtual SpeakableString | getAsDigits () const |
virtual ::std::u16string | getAsOrdinalDigits () const |
virtual ::std::u16string | asDigits (const ::std::u16string &variant) const |
bool | operator== (const NumberConcept &o) const |
std::size_t | operator() (const NumberConcept &o) const noexcept |
std::partial_ordering | operator<=> (const NumberConcept &o) const |
int64_t | longValue () const |
double | doubleValue () const |
NumberConcept (int64_t value, const ::inflection::util::ULocale &language, const ::inflection::util::ULocale ®ionLocale) | |
NumberConcept (double value, const ::inflection::util::ULocale &language, const ::inflection::util::ULocale ®ionLocale) | |
NumberConcept (const NumberConcept &original) | |
![]() | |
~SpeakableConcept () override | |
![]() | |
virtual ::std::u16string | toString () const |
virtual | ~Object () |
Provides representation of numerics as lexical tokens, such as ordinals or cardinals.
An object that provides representation of numerics.
As with the other concepts within Siri, NumberConcept provides utility functions, grammatical rules, and lexical representation for a real-world or linguistic concept. In this case: generic numerals.
Definition at line 21 of file NumberConcept.hpp.
inflection::dialog::NumberConcept::NumberConcept | ( | int64_t | value, |
const ::inflection::util::ULocale & | language, | ||
const ::inflection::util::ULocale & | regionLocale | ||
) |
Construct a NumberConcept.
value | a 64-bit value |
language | This locale is primarily used for the speak property of a SpeakableString. |
regionLocale | This locale is primarily used for the print property of a SpeakableString. |
inflection::dialog::NumberConcept::NumberConcept | ( | double | value, |
const ::inflection::util::ULocale & | language, | ||
const ::inflection::util::ULocale & | regionLocale | ||
) |
Construct a NumberConcept.
value | an IEEE 754 double value. |
language | This locale is primarily used for the speak property of a SpeakableString. |
regionLocale | This locale is primarily used for the print property of a SpeakableString. |
inflection::dialog::NumberConcept::NumberConcept | ( | const NumberConcept & | original | ) |
Copy constructor
virtual ::std::u16string inflection::dialog::NumberConcept::asDigits | ( | const ::std::u16string & | variant | ) | const |
Format the number as ordinal digits using the language with the requested variant. For example, you can request the Spanish forms for 1º. and 1ª.
variant | Check out the complete list of rule names see https://st.unicode.org/cldr-apps/numbers.jsp?type=OrdinalRules for details. |
|
virtual |
Format the number with a printable and speakable form. The print part of the SpeakableString is the same as asDigits(). The speak part of the SpeakableString is the same as asWords(variant).
variant | Check out the complete list of rule names see https://st.unicode.org/cldr-apps/numbers.jsp for details. |
virtual ::std::u16string inflection::dialog::NumberConcept::asWords | ( | const ::std::u16string & | variant | ) | const |
Format the number with words with the variant rule name. The words are based on the language used to construct this object.
variant | Check out the complete list of rule names see https://st.unicode.org/cldr-apps/numbers.jsp for details. |
double inflection::dialog::NumberConcept::doubleValue | ( | ) | const |
Returns the value of this NumberConcept as a double number.
|
virtual |
Return the absolute value of this NumberConcept.
|
virtual |
Format the number with digits using the region locale. The speak part may contain words or digits for the given language when the language is not the same as the region locale or the TTS system can not properly pronounce the printed form.
virtual ::std::u16string inflection::dialog::NumberConcept::getAsOrdinalDigits | ( | ) | const |
Format the number as ordinal digits using the language. For example, the number would be formatted as 1st, 2nd and 3rd in English.
|
virtual |
Format the number with a printable and speakable form. The print part of the SpeakableString is the same as asDigits(). The speak part of the SpeakableString is the same as asWords().
virtual ::std::u16string inflection::dialog::NumberConcept::getAsWords | ( | ) | const |
Format the number with words. The words are based on the language used to construct this object.
|
virtual |
Returns true when the number is negative.
|
virtual |
Returns the language used to format the speakable part of a SpeakableString.
|
virtual |
Get the maximum number of digits to show after the decimal point
|
virtual |
Returns the locale used to format the printable part of a SpeakableString.
|
virtual |
Is grouping shown? For example: 1,234.56 turns into 1234.56 when grouping is false.
|
virtual |
Returns true when the value can not be represented as an integer without rounding.
int64_t inflection::dialog::NumberConcept::longValue | ( | ) | const |
Returns the value of this NumberConcept as a 64-bit number.
|
virtual |
Set the maximum number of digits to show after the decimal point for a new NumberConcept. For example: 12.3456 turns into 12.35 when set to 2.
|
virtual |
For values greater than 1.0, always have given fractional digits. For numbers between 1.0 and 0.0, always have at least given non-zero digits, no matter how many leading zeros are needed. Omit the trailing zeros of the fractional part.
|
virtual |
Set the maximum number of digits to show before the decimal point for a new NumberConcept.
|
virtual |
Set the minimum number of digits to show after the decimal point for a new NumberConcept. For example: 12 turns into 12.00 when set to 2.
|
virtual |
Set the minimum number of digits to show before the decimal point for a new NumberConcept.
|
noexcept |
size_t
. std::partial_ordering inflection::dialog::NumberConcept::operator<=> | ( | const NumberConcept & | o | ) | const |
String compares the order of the NumberConcept objects. Formatting differences are not considered.
o | The object to be compared with this. |
bool inflection::dialog::NumberConcept::operator== | ( | const NumberConcept & | o | ) | const |
Returns true when both NumberConcept objects are the same value. Formatting differences are not considered.
|
virtual |
Rounds any fraction towards positive infinity.
|
virtual |
Round toward zero. Use maxFractionDigits to round at a specific place after the decimal point.
|
virtual |
Rounds any fraction towards negative infinity.
|
virtual |
Round to closest number, preferring toward zero if halfway in between. Use maxFractionDigits to round at a specific place after the decimal point.
|
virtual |
Round to closest number, preferring away from zero if halfway in between. Use maxFractionDigits to round at a specific place after the decimal point.
|
virtual |
Round away from zero. Use maxFractionDigits to round at a specific place after the decimal point.
|
overridevirtual |
Return a SpeakableString of this NumberConcept. The behavior is the same as getAsDigits().
Implements inflection::dialog::SpeakableConcept.
|
override |
Return a debuggable form of this NumberConcept.