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