measure.h
Go to the documentation of this file.
// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
**********************************************************************
* Copyright (c) 2004-2015, International Business Machines
* Corporation and others. All Rights Reserved.
**********************************************************************
* Author: Alan Liu
* Created: April 26, 2004
* Since: ICU 3.0
**********************************************************************
*/
#ifndef __MEASURE_H__
#define __MEASURE_H__
#include "unicode/utypes.h"
#if U_SHOW_CPLUSPLUS_API
#if !UCONFIG_NO_FORMATTING
#include "unicode/fmtable.h"
U_NAMESPACE_BEGIN
class MeasureUnit;
class U_I18N_API Measure: public UObject {
public:
Measure(const Formattable& number, MeasureUnit* adoptedUnit,
UErrorCode& ec);
Measure(const Measure& other);
Measure& operator=(const Measure& other);
virtual Measure* clone() const;
virtual ~Measure();
bool operator==(const UObject& other) const;
#ifndef U_HIDE_DRAFT_API
inline bool operator!=(const UObject& other) const { return !operator==(other); }
#endif // U_HIDE_DRAFT_API
inline const Formattable& getNumber() const;
inline const MeasureUnit& getUnit() const;
static UClassID U_EXPORT2 getStaticClassID(void);
virtual UClassID getDynamicClassID(void) const override;
protected:
Measure();
private:
Formattable number;
MeasureUnit* unit;
};
inline const Formattable& Measure::getNumber() const {
return number;
}
inline const MeasureUnit& Measure::getUnit() const {
return *unit;
}
U_NAMESPACE_END
#endif // !UCONFIG_NO_FORMATTING
#endif /* U_SHOW_CPLUSPLUS_API */
#endif // __MEASURE_H__
icu::Formattable
Formattable objects can be passed to the Format class or its subclasses for formatting.
Definition: fmtable.h:64
icu::MeasureUnit
A unit such as length, mass, volume, currency, etc.
Definition: measunit.h:369
icu::Measure
An amount of a specified unit, consisting of a number and a Unit.
Definition: measure.h:45
icu::Measure::Measure
Measure(const Formattable &number, MeasureUnit *adoptedUnit, UErrorCode &ec)
Construct an object with the given numeric amount and the given unit.
icu::Measure::operator!=
bool operator!=(const UObject &other) const
Inequality operator.
Definition: measure.h:99
icu::Measure::~Measure
virtual ~Measure()
Destructor.
icu::Measure::Measure
Measure()
Default constructor.
icu::Measure::clone
virtual Measure * clone() const
Return a polymorphic clone of this object.
icu::Measure::operator=
Measure & operator=(const Measure &other)
Assignment operator.
icu::Measure::getStaticClassID
static UClassID getStaticClassID(void)
Return the class ID for this class.
icu::Measure::Measure
Measure(const Measure &other)
Copy constructor.
icu::Measure::getDynamicClassID
virtual UClassID getDynamicClassID(void) const override
Returns a unique class ID POLYMORPHICALLY.
icu::Measure::operator==
bool operator==(const UObject &other) const
Equality operator.
icu::UObject
UObject is the common ICU "boilerplate" class.
Definition: uobject.h:223
fmtable.h
C++ API: Formattable is a thin wrapper for primitive types used for formatting and parsing.
icu::operator==
U_EXPORT UBool operator==(const StringPiece &x, const StringPiece &y)
Global operator == for StringPiece.
UClassID
void * UClassID
UClassID is used to identify classes without using the compiler's RTTI.
Definition: uobject.h:96
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:415
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:301