/** * \file * \brief C++ API: MeasureUnit object.
*/
#if !UCONFIG_NO_FORMATTING
#include"unicode/fmtable.h"
U_NAMESPACE_BEGIN
class MeasureUnit;
/** * An amount of a specified unit, consisting of a number and a Unit. * For example, a length measure consists of a number and a length * unit, such as feet or meters. * * <p>Measure objects are formatted by MeasureFormat. * * <p>Measure objects are immutable. * * @author Alan Liu * @stable ICU 3.0
*/ class U_I18N_API Measure: public UObject { public: /** * Construct an object with the given numeric amount and the given * unit. After this call, the caller must not delete the given * unit object. * @param number a numeric object; amount.isNumeric() must be true * @param adoptedUnit the unit object, which must not be nullptr * @param ec input-output error code. If the amount or the unit * is invalid, then this will be set to a failing value. * @stable ICU 3.0
*/
Measure(const Formattable& number, MeasureUnit* adoptedUnit,
UErrorCode& ec);
/** * Return a polymorphic clone of this object. The result will * have the same class as returned by getDynamicClassID(). * @stable ICU 3.0
*/ virtual Measure* clone() const;
/** * Equality operator. Return true if this object is equal * to the given object. * @stable ICU 3.0
*/ booloperator==(const UObject& other) const;
/** * Inequality operator. Returns true if this object is not equal to the other object. * @param other the object to compare with * @return true if the objects are not equal * @stable ICU 74
*/ inlinebooloperator!=(const UObject& other) const { return !operator==(other); }
/** * Return a reference to the numeric value of this object. The * numeric value may be of any numeric type supported by * Formattable. * @stable ICU 3.0
*/ inlineconst Formattable& getNumber() const;
/** * Return a reference to the unit of this object. * @stable ICU 3.0
*/ inlineconst MeasureUnit& getUnit() const;
/** * Return the class ID for this class. This is useful only for comparing to * a return value from getDynamicClassID(). For example: * <pre> * . Base* polymorphic_pointer = createPolymorphicObject(); * . if (polymorphic_pointer->getDynamicClassID() == * . erived::getStaticClassID()) ... * </pre> * @return The class ID for all objects of this class. * @stable ICU 53
*/ static UClassID U_EXPORT2 getStaticClassID();
/** * Returns a unique class ID POLYMORPHICALLY. Pure virtual override. This * method is to implement a simple version of RTTI, since not all C++ * compilers support genuine RTTI. Polymorphic operator==() and clone() * methods call this method. * * @return The class ID for this object. All objects of a * given class have the same class ID. Objects of * other classes have different class IDs. * @stable ICU 53
*/ virtual UClassID getDynamicClassID() const override;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.