1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/intl/icu/source/i18n/tmutamt.cpp Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,76 @@ 1.4 +/* 1.5 + ******************************************************************************* 1.6 + * Copyright (C) 2008, Google, International Business Machines Corporation and * 1.7 + * others. All Rights Reserved. * 1.8 + ******************************************************************************* 1.9 + */ 1.10 + 1.11 +#include "unicode/tmutamt.h" 1.12 + 1.13 +#if !UCONFIG_NO_FORMATTING 1.14 + 1.15 +U_NAMESPACE_BEGIN 1.16 + 1.17 +UOBJECT_DEFINE_RTTI_IMPLEMENTATION(TimeUnitAmount) 1.18 + 1.19 + 1.20 +TimeUnitAmount::TimeUnitAmount(const Formattable& number, 1.21 + TimeUnit::UTimeUnitFields timeUnitField, 1.22 + UErrorCode& status) 1.23 +: Measure(number, TimeUnit::createInstance(timeUnitField, status), status) { 1.24 +} 1.25 + 1.26 + 1.27 +TimeUnitAmount::TimeUnitAmount(double amount, 1.28 + TimeUnit::UTimeUnitFields timeUnitField, 1.29 + UErrorCode& status) 1.30 +: Measure(Formattable(amount), 1.31 + TimeUnit::createInstance(timeUnitField, status), 1.32 + status) { 1.33 +} 1.34 + 1.35 + 1.36 +TimeUnitAmount::TimeUnitAmount(const TimeUnitAmount& other) 1.37 +: Measure(other) 1.38 +{ 1.39 +} 1.40 + 1.41 + 1.42 +TimeUnitAmount& 1.43 +TimeUnitAmount::operator=(const TimeUnitAmount& other) { 1.44 + Measure::operator=(other); 1.45 + return *this; 1.46 +} 1.47 + 1.48 + 1.49 +UBool 1.50 +TimeUnitAmount::operator==(const UObject& other) const { 1.51 + return Measure::operator==(other); 1.52 +} 1.53 + 1.54 +UObject* 1.55 +TimeUnitAmount::clone() const { 1.56 + return new TimeUnitAmount(*this); 1.57 +} 1.58 + 1.59 + 1.60 +TimeUnitAmount::~TimeUnitAmount() { 1.61 +} 1.62 + 1.63 + 1.64 + 1.65 +const TimeUnit& 1.66 +TimeUnitAmount::getTimeUnit() const { 1.67 + return (const TimeUnit&) getUnit(); 1.68 +} 1.69 + 1.70 + 1.71 +TimeUnit::UTimeUnitFields 1.72 +TimeUnitAmount::getTimeUnitField() const { 1.73 + return getTimeUnit().getTimeUnitField(); 1.74 +} 1.75 + 1.76 + 1.77 +U_NAMESPACE_END 1.78 + 1.79 +#endif