Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(99)

Side by Side Diff: icu46/source/i18n/measure.cpp

Issue 5516007: Check in the pristine copy of ICU 4.6... (Closed) Base URL: svn://chrome-svn/chrome/trunk/deps/third_party/
Patch Set: Created 10 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « icu46/source/i18n/measfmt.cpp ('k') | icu46/source/i18n/msgfmt.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
(Empty)
1 /*
2 **********************************************************************
3 * Copyright (c) 2004-2010, International Business Machines
4 * Corporation and others. All Rights Reserved.
5 **********************************************************************
6 * Author: Alan Liu
7 * Created: April 26, 2004
8 * Since: ICU 3.0
9 **********************************************************************
10 */
11 #include <typeinfo> // for 'typeid' to work
12
13 #include "unicode/utypes.h"
14
15 #if !UCONFIG_NO_FORMATTING
16
17 #include "unicode/measure.h"
18 #include "unicode/measunit.h"
19
20 U_NAMESPACE_BEGIN
21
22 Measure::Measure() {}
23
24 Measure::Measure(const Formattable& _number, MeasureUnit* adoptedUnit,
25 UErrorCode& ec) :
26 number(_number), unit(adoptedUnit) {
27 if (U_SUCCESS(ec) &&
28 (!number.isNumeric() || adoptedUnit == 0)) {
29 ec = U_ILLEGAL_ARGUMENT_ERROR;
30 }
31 }
32
33 Measure::Measure(const Measure& other) :
34 UObject(other), unit(0) {
35 *this = other;
36 }
37
38 Measure& Measure::operator=(const Measure& other) {
39 if (this != &other) {
40 delete unit;
41 number = other.number;
42 unit = (MeasureUnit*) other.unit->clone();
43 }
44 return *this;
45 }
46
47 Measure::~Measure() {
48 delete unit;
49 }
50
51 UBool Measure::operator==(const UObject& other) const {
52 const Measure* m = (const Measure*) &other;
53 return typeid(*this) == typeid(other) &&
54 number == m->getNumber() &&
55 (unit != NULL && *unit == m->getUnit());
56 }
57
58 //----------------------------------------------------------------------
59 // MeasureUnit implementation
60
61 MeasureUnit:: MeasureUnit() {}
62
63 MeasureUnit::~MeasureUnit() {}
64
65 U_NAMESPACE_END
66
67 #endif // !UCONFIG_NO_FORMATTING
OLDNEW
« no previous file with comments | « icu46/source/i18n/measfmt.cpp ('k') | icu46/source/i18n/msgfmt.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698