ICU 62.1 62.1
measure.h
Go to the documentation of this file.
1// © 2016 and later: Unicode, Inc. and others.
2// License & terms of use: http://www.unicode.org/copyright.html
3/*
4**********************************************************************
5* Copyright (c) 2004-2015, International Business Machines
6* Corporation and others. All Rights Reserved.
7**********************************************************************
8* Author: Alan Liu
9* Created: April 26, 2004
10* Since: ICU 3.0
11**********************************************************************
12*/
13#ifndef __MEASURE_H__
14#define __MEASURE_H__
15
16#include "unicode/utypes.h"
17
23#if !UCONFIG_NO_FORMATTING
24
25#include "unicode/fmtable.h"
26
28
29class MeasureUnit;
30
43class U_I18N_API Measure: public UObject {
44 public:
56 UErrorCode& ec);
57
63
69
75 virtual UObject* clone() const;
76
81 virtual ~Measure();
82
89
96 inline const Formattable& getNumber() const;
97
102 inline const MeasureUnit& getUnit() const;
103
116
128 virtual UClassID getDynamicClassID(void) const;
129
130 protected:
136
137 private:
141 Formattable number;
142
147 MeasureUnit* unit;
148};
149
150inline const Formattable& Measure::getNumber() const {
151 return number;
152}
153
154inline const MeasureUnit& Measure::getUnit() const {
155 return *unit;
156}
157
159
160#endif // !UCONFIG_NO_FORMATTING
161#endif // __MEASURE_H__
Formattable objects can be passed to the Format class or its subclasses for formatting.
Definition fmtable.h:62
"Smart pointer" base class; do not use directly: use LocalPointer etc.
A unit such as length, mass, volume, currency, etc.
Definition measunit.h:38
An amount of a specified unit, consisting of a number and a Unit.
Definition measure.h:43
Measure(const Formattable &number, MeasureUnit *adoptedUnit, UErrorCode &ec)
Construct an object with the given numeric amount and the given unit.
virtual ~Measure()
Destructor.
UBool operator==(const UObject &other) const
Equality operator.
virtual UObject * clone() const
Return a polymorphic clone of this object.
Measure()
Default constructor.
static UClassID getStaticClassID(void)
Return the class ID for this class.
Measure & operator=(const Measure &other)
Assignment operator.
Measure(const Measure &other)
Copy constructor.
virtual UClassID getDynamicClassID(void) const
Returns a unique class ID POLYMORPHICALLY.
UObject is the common ICU "boilerplate" class.
Definition uobject.h:223
C++ API: Formattable is a thin wrapper for primitive types used for formatting and parsing.
int8_t UBool
The ICU boolean type.
Definition umachine.h:236
void * UClassID
UClassID is used to identify classes without using the compiler's RTTI.
Definition uobject.h:93
Basic definitions for ICU, for both C and C++ APIs.
UErrorCode
Error code to replace exception handling, so that the code is compatible with all C++ compilers,...
Definition utypes.h:396
#define U_I18N_API
Set to export library symbols from inside the i18n library, and to import them from outside.
Definition utypes.h:360
#define U_NAMESPACE_END
This is used to end a declaration of a public ICU C++ API.
Definition uversion.h:138
#define U_NAMESPACE_BEGIN
This is used to begin a declaration of a public ICU C++ API.
Definition uversion.h:137