]>
git.saurik.com Git - apple/icu.git/blob - icuSources/i18n/measure.cpp
2 **********************************************************************
3 * Copyright (c) 2004-2010, International Business Machines
4 * Corporation and others. All Rights Reserved.
5 **********************************************************************
7 * Created: April 26, 2004
9 **********************************************************************
11 #include <typeinfo> // for 'typeid' to work
13 #include "unicode/utypes.h"
15 #if !UCONFIG_NO_FORMATTING
17 #include "unicode/measure.h"
18 #include "unicode/measunit.h"
24 Measure::Measure(const Formattable
& _number
, MeasureUnit
* adoptedUnit
,
26 number(_number
), unit(adoptedUnit
) {
28 (!number
.isNumeric() || adoptedUnit
== 0)) {
29 ec
= U_ILLEGAL_ARGUMENT_ERROR
;
33 Measure::Measure(const Measure
& other
) :
34 UObject(other
), unit(0) {
38 Measure
& Measure::operator=(const Measure
& other
) {
41 number
= other
.number
;
42 unit
= (MeasureUnit
*) other
.unit
->clone();
51 UBool
Measure::operator==(const UObject
& other
) const {
52 const Measure
* m
= (const Measure
*) &other
;
53 return typeid(*this) == typeid(other
) &&
54 number
== m
->getNumber() &&
55 (unit
!= NULL
&& *unit
== m
->getUnit());
58 //----------------------------------------------------------------------
59 // MeasureUnit implementation
61 MeasureUnit:: MeasureUnit() {}
63 MeasureUnit::~MeasureUnit() {}
67 #endif // !UCONFIG_NO_FORMATTING