1 // © 2016 and later: Unicode, Inc. and others.
2 // License & terms of use: http://www.unicode.org/copyright.html
4 *******************************************************************************
5 * Copyright (C) 2008, Google, International Business Machines Corporation and *
6 * others. All Rights Reserved. *
7 *******************************************************************************
10 #include "unicode/tmutamt.h"
12 #if !UCONFIG_NO_FORMATTING
16 UOBJECT_DEFINE_RTTI_IMPLEMENTATION(TimeUnitAmount
)
19 TimeUnitAmount::TimeUnitAmount(const Formattable
& number
,
20 TimeUnit::UTimeUnitFields timeUnitField
,
22 : Measure(number
, TimeUnit::createInstance(timeUnitField
, status
), status
) {
26 TimeUnitAmount::TimeUnitAmount(double amount
,
27 TimeUnit::UTimeUnitFields timeUnitField
,
29 : Measure(Formattable(amount
),
30 TimeUnit::createInstance(timeUnitField
, status
),
35 TimeUnitAmount::TimeUnitAmount(const TimeUnitAmount
& other
)
42 TimeUnitAmount::operator=(const TimeUnitAmount
& other
) {
43 Measure::operator=(other
);
49 TimeUnitAmount::operator==(const UObject
& other
) const {
50 return Measure::operator==(other
);
54 TimeUnitAmount::clone() const {
55 return new TimeUnitAmount(*this);
59 TimeUnitAmount::~TimeUnitAmount() {
65 TimeUnitAmount::getTimeUnit() const {
66 return (const TimeUnit
&) getUnit();
70 TimeUnit::UTimeUnitFields
71 TimeUnitAmount::getTimeUnitField() const {
72 return getTimeUnit().getTimeUnitField();