• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 
UOBJECT_DEFINE_RTTI_IMPLEMENTATION(TimeUnitAmount)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 
TimeUnitAmount(double amount,TimeUnit::UTimeUnitFields timeUnitField,UErrorCode & status)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 
TimeUnitAmount(const TimeUnitAmount & other)33 TimeUnitAmount::TimeUnitAmount(const TimeUnitAmount& other)
34 :   Measure(other)
35 {
36 }
37 
38 
39 TimeUnitAmount&
operator =(const TimeUnitAmount & other)40 TimeUnitAmount::operator=(const TimeUnitAmount& other) {
41     Measure::operator=(other);
42     return *this;
43 }
44 
45 
46 UBool
operator ==(const UObject & other) const47 TimeUnitAmount::operator==(const UObject& other) const {
48     return Measure::operator==(other);
49 }
50 
51 UObject*
clone() const52 TimeUnitAmount::clone() const {
53     return new TimeUnitAmount(*this);
54 }
55 
56 
~TimeUnitAmount()57 TimeUnitAmount::~TimeUnitAmount() {
58 }
59 
60 
61 
62 const TimeUnit&
getTimeUnit() const63 TimeUnitAmount::getTimeUnit() const {
64     return (const TimeUnit&) getUnit();
65 }
66 
67 
68 TimeUnit::UTimeUnitFields
getTimeUnitField() const69 TimeUnitAmount::getTimeUnitField() const {
70     return getTimeUnit().getTimeUnitField();
71 }
72 
73 
74 U_NAMESPACE_END
75 
76 #endif
77