]>
Commit | Line | Data |
---|---|---|
729e4ab9 A |
1 | /* |
2 | ******************************************************************************* | |
3 | * Copyright (C) 2008, Google, International Business Machines Corporation and * | |
4 | * others. All Rights Reserved. * | |
5 | ******************************************************************************* | |
6 | */ | |
7 | ||
8 | #include "unicode/tmutamt.h" | |
9 | ||
10 | #if !UCONFIG_NO_FORMATTING | |
11 | ||
12 | U_NAMESPACE_BEGIN | |
13 | ||
14 | UOBJECT_DEFINE_RTTI_IMPLEMENTATION(TimeUnitAmount) | |
15 | ||
16 | ||
17 | TimeUnitAmount::TimeUnitAmount(const Formattable& number, | |
18 | TimeUnit::UTimeUnitFields timeUnitField, | |
19 | UErrorCode& status) | |
20 | : Measure(number, TimeUnit::createInstance(timeUnitField, status), status) { | |
21 | } | |
22 | ||
23 | ||
24 | TimeUnitAmount::TimeUnitAmount(double amount, | |
25 | TimeUnit::UTimeUnitFields timeUnitField, | |
26 | UErrorCode& status) | |
27 | : Measure(Formattable(amount), | |
28 | TimeUnit::createInstance(timeUnitField, status), | |
29 | status) { | |
30 | } | |
31 | ||
32 | ||
33 | TimeUnitAmount::TimeUnitAmount(const TimeUnitAmount& other) | |
34 | : Measure(other) | |
35 | { | |
36 | } | |
37 | ||
38 | ||
39 | TimeUnitAmount& | |
40 | TimeUnitAmount::operator=(const TimeUnitAmount& other) { | |
41 | Measure::operator=(other); | |
42 | return *this; | |
43 | } | |
44 | ||
45 | ||
46 | UBool | |
47 | TimeUnitAmount::operator==(const UObject& other) const { | |
48 | return Measure::operator==(other); | |
49 | } | |
50 | ||
51 | UObject* | |
52 | TimeUnitAmount::clone() const { | |
53 | return new TimeUnitAmount(*this); | |
54 | } | |
55 | ||
56 | ||
57 | TimeUnitAmount::~TimeUnitAmount() { | |
58 | } | |
59 | ||
60 | ||
61 | ||
62 | const TimeUnit& | |
63 | TimeUnitAmount::getTimeUnit() const { | |
64 | return (const TimeUnit&) getUnit(); | |
65 | } | |
66 | ||
67 | ||
68 | TimeUnit::UTimeUnitFields | |
69 | TimeUnitAmount::getTimeUnitField() const { | |
70 | return getTimeUnit().getTimeUnitField(); | |
71 | } | |
72 | ||
73 | ||
74 | U_NAMESPACE_END | |
75 | ||
76 | #endif |