| OLD | NEW |
| 1 /******************************************************************************* | 1 /******************************************************************************* |
| 2 * Copyright (C) 2008-2010, International Business Machines Corporation and | 2 * Copyright (C) 2008-2010, International Business Machines Corporation and |
| 3 * others. All Rights Reserved. | 3 * others. All Rights Reserved. |
| 4 ******************************************************************************* | 4 ******************************************************************************* |
| 5 * | 5 * |
| 6 * File DTITVFMT.CPP | 6 * File DTITVFMT.CPP |
| 7 * | 7 * |
| 8 ******************************************************************************* | 8 ******************************************************************************* |
| 9 */ | 9 */ |
| 10 | 10 |
| 11 #include <typeinfo> // for 'typeid' to work | |
| 12 | 11 |
| 13 #include "unicode/dtitvfmt.h" | 12 #include "unicode/dtitvfmt.h" |
| 14 | 13 |
| 15 #if !UCONFIG_NO_FORMATTING | 14 #if !UCONFIG_NO_FORMATTING |
| 16 | 15 |
| 17 //TODO: put in compilation | 16 //TODO: put in compilation |
| 18 //#define DTITVFMT_DEBUG 1 | 17 //#define DTITVFMT_DEBUG 1 |
| 19 | 18 |
| 20 #include "cstring.h" | 19 #include "cstring.h" |
| 21 #include "unicode/msgfmt.h" | 20 #include "unicode/msgfmt.h" |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 | 182 |
| 184 | 183 |
| 185 Format* | 184 Format* |
| 186 DateIntervalFormat::clone(void) const { | 185 DateIntervalFormat::clone(void) const { |
| 187 return new DateIntervalFormat(*this); | 186 return new DateIntervalFormat(*this); |
| 188 } | 187 } |
| 189 | 188 |
| 190 | 189 |
| 191 UBool | 190 UBool |
| 192 DateIntervalFormat::operator==(const Format& other) const { | 191 DateIntervalFormat::operator==(const Format& other) const { |
| 193 if (typeid(*this) == typeid(other)) { | 192 if (CR_TYPEID(*this) == CR_TYPEID(other)) { |
| 194 const DateIntervalFormat* fmt = (DateIntervalFormat*)&other; | 193 const DateIntervalFormat* fmt = (DateIntervalFormat*)&other; |
| 195 #ifdef DTITVFMT_DEBUG | 194 #ifdef DTITVFMT_DEBUG |
| 196 UBool equal; | 195 UBool equal; |
| 197 equal = (this == fmt); | 196 equal = (this == fmt); |
| 198 | 197 |
| 199 equal = (*fInfo == *fmt->fInfo); | 198 equal = (*fInfo == *fmt->fInfo); |
| 200 equal = (*fDateFormat == *fmt->fDateFormat); | 199 equal = (*fDateFormat == *fmt->fDateFormat); |
| 201 equal = fFromCalendar->isEquivalentTo(*fmt->fFromCalendar) ; | 200 equal = fFromCalendar->isEquivalentTo(*fmt->fFromCalendar) ; |
| 202 equal = fToCalendar->isEquivalentTo(*fmt->fToCalendar) ; | 201 equal = fToCalendar->isEquivalentTo(*fmt->fToCalendar) ; |
| 203 equal = (fSkeleton == fmt->fSkeleton); | 202 equal = (fSkeleton == fmt->fSkeleton); |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 236 DateIntervalFormat::format(const Formattable& obj, | 235 DateIntervalFormat::format(const Formattable& obj, |
| 237 UnicodeString& appendTo, | 236 UnicodeString& appendTo, |
| 238 FieldPosition& fieldPosition, | 237 FieldPosition& fieldPosition, |
| 239 UErrorCode& status) const { | 238 UErrorCode& status) const { |
| 240 if ( U_FAILURE(status) ) { | 239 if ( U_FAILURE(status) ) { |
| 241 return appendTo; | 240 return appendTo; |
| 242 } | 241 } |
| 243 | 242 |
| 244 if ( obj.getType() == Formattable::kObject ) { | 243 if ( obj.getType() == Formattable::kObject ) { |
| 245 const UObject* formatObj = obj.getObject(); | 244 const UObject* formatObj = obj.getObject(); |
| 246 const DateInterval* interval = dynamic_cast<const DateInterval*>(formatO
bj); | 245 const DateInterval* interval = CR_DYNAMIC_CAST<const DateInterval*>(form
atObj); |
| 247 if (interval != NULL){ | 246 if (interval != NULL){ |
| 248 return format(interval, appendTo, fieldPosition, status); | 247 return format(interval, appendTo, fieldPosition, status); |
| 249 } | 248 } |
| 250 } | 249 } |
| 251 status = U_ILLEGAL_ARGUMENT_ERROR; | 250 status = U_ILLEGAL_ARGUMENT_ERROR; |
| 252 return appendTo; | 251 return appendTo; |
| 253 } | 252 } |
| 254 | 253 |
| 255 | 254 |
| 256 UnicodeString& | 255 UnicodeString& |
| (...skipping 1166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1423 /*wWd*/ LOW_W, CAP_W, LOW_D, | 1422 /*wWd*/ LOW_W, CAP_W, LOW_D, |
| 1424 /*DEF*/ CAP_D, CAP_E, CAP_F, | 1423 /*DEF*/ CAP_D, CAP_E, CAP_F, |
| 1425 /*ahH*/ LOW_A, LOW_H, CAP_H, | 1424 /*ahH*/ LOW_A, LOW_H, CAP_H, |
| 1426 /*m..*/ LOW_M, | 1425 /*m..*/ LOW_M, |
| 1427 }; | 1426 }; |
| 1428 | 1427 |
| 1429 | 1428 |
| 1430 U_NAMESPACE_END | 1429 U_NAMESPACE_END |
| 1431 | 1430 |
| 1432 #endif | 1431 #endif |
| OLD | NEW |