]>
git.saurik.com Git - apple/icu.git/blob - icuSources/i18n/measure.cpp
2 **********************************************************************
3 * Copyright (c) 2004-2008, International Business Machines
4 * Corporation and others. All Rights Reserved.
5 **********************************************************************
7 * Created: April 26, 2004
9 **********************************************************************
11 #include "unicode/utypes.h"
13 #if !UCONFIG_NO_FORMATTING
15 #include "unicode/measure.h"
16 #include "unicode/measunit.h"
22 Measure::Measure(const Formattable
& _number
, MeasureUnit
* adoptedUnit
,
24 number(_number
), unit(adoptedUnit
) {
26 (!number
.isNumeric() || adoptedUnit
== 0)) {
27 ec
= U_ILLEGAL_ARGUMENT_ERROR
;
31 Measure::Measure(const Measure
& other
) :
32 UObject(other
), unit(0) {
36 Measure
& Measure::operator=(const Measure
& other
) {
39 number
= other
.number
;
40 unit
= (MeasureUnit
*) other
.unit
->clone();
49 UBool
Measure::operator==(const UObject
& other
) const {
50 const Measure
* m
= (const Measure
*) &other
;
51 return getDynamicClassID() == other
.getDynamicClassID() &&
52 number
== m
->getNumber() &&
53 (unit
!= NULL
&& *unit
== m
->getUnit());
56 //----------------------------------------------------------------------
57 // MeasureUnit implementation
59 MeasureUnit:: MeasureUnit() {}
61 MeasureUnit::~MeasureUnit() {}
65 #endif // !UCONFIG_NO_FORMATTING