| OLD | NEW |
| 1 /* | 1 /* |
| 2 ******************************************************************************* | 2 ******************************************************************************* |
| 3 * Copyright (C) 2007-2010, International Business Machines Corporation and | 3 * Copyright (C) 2007-2010, International Business Machines Corporation and |
| 4 * others. All Rights Reserved. | 4 * others. All Rights Reserved. |
| 5 ******************************************************************************* | 5 ******************************************************************************* |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #include "unicode/utypes.h" | 8 #include "unicode/utypes.h" |
| 9 | 9 |
| 10 #if !UCONFIG_NO_FORMATTING | 10 #if !UCONFIG_NO_FORMATTING |
| (...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 281 } | 281 } |
| 282 return result; | 282 return result; |
| 283 } | 283 } |
| 284 | 284 |
| 285 UnicodeString& | 285 UnicodeString& |
| 286 RelativeDateFormat::toPatternDate(UnicodeString& result, UErrorCode& status) con
st | 286 RelativeDateFormat::toPatternDate(UnicodeString& result, UErrorCode& status) con
st |
| 287 { | 287 { |
| 288 if (!U_FAILURE(status)) { | 288 if (!U_FAILURE(status)) { |
| 289 result.remove(); | 289 result.remove(); |
| 290 if ( fDateFormat ) { | 290 if ( fDateFormat ) { |
| 291 SimpleDateFormat* sdtfmt = dynamic_cast<SimpleDateFormat*>(fDateForm
at); | 291 SimpleDateFormat* sdtfmt = CR_DYNAMIC_CAST<SimpleDateFormat*>(fDateF
ormat); |
| 292 if (sdtfmt != NULL) { | 292 if (sdtfmt != NULL) { |
| 293 sdtfmt->toPattern(result); | 293 sdtfmt->toPattern(result); |
| 294 } else { | 294 } else { |
| 295 status = U_UNSUPPORTED_ERROR; | 295 status = U_UNSUPPORTED_ERROR; |
| 296 } | 296 } |
| 297 } | 297 } |
| 298 } | 298 } |
| 299 return result; | 299 return result; |
| 300 } | 300 } |
| 301 | 301 |
| 302 UnicodeString& | 302 UnicodeString& |
| 303 RelativeDateFormat::toPatternTime(UnicodeString& result, UErrorCode& status) con
st | 303 RelativeDateFormat::toPatternTime(UnicodeString& result, UErrorCode& status) con
st |
| 304 { | 304 { |
| 305 if (!U_FAILURE(status)) { | 305 if (!U_FAILURE(status)) { |
| 306 result.remove(); | 306 result.remove(); |
| 307 if ( fTimeFormat ) { | 307 if ( fTimeFormat ) { |
| 308 SimpleDateFormat* sdtfmt = dynamic_cast<SimpleDateFormat*>(fTimeForm
at); | 308 SimpleDateFormat* sdtfmt = CR_DYNAMIC_CAST<SimpleDateFormat*>(fTimeF
ormat); |
| 309 if (sdtfmt != NULL) { | 309 if (sdtfmt != NULL) { |
| 310 sdtfmt->toPattern(result); | 310 sdtfmt->toPattern(result); |
| 311 } else { | 311 } else { |
| 312 status = U_UNSUPPORTED_ERROR; | 312 status = U_UNSUPPORTED_ERROR; |
| 313 } | 313 } |
| 314 } | 314 } |
| 315 } | 315 } |
| 316 return result; | 316 return result; |
| 317 } | 317 } |
| 318 | 318 |
| 319 void | 319 void |
| 320 RelativeDateFormat::applyPatterns(const UnicodeString& datePattern, const Unicod
eString& timePattern, UErrorCode &status) | 320 RelativeDateFormat::applyPatterns(const UnicodeString& datePattern, const Unicod
eString& timePattern, UErrorCode &status) |
| 321 { | 321 { |
| 322 if (!U_FAILURE(status)) { | 322 if (!U_FAILURE(status)) { |
| 323 SimpleDateFormat* sdtfmt = NULL; | 323 SimpleDateFormat* sdtfmt = NULL; |
| 324 SimpleDateFormat* stmfmt = NULL; | 324 SimpleDateFormat* stmfmt = NULL; |
| 325 if (fDateFormat && (sdtfmt = dynamic_cast<SimpleDateFormat*>(fDateFormat
)) == NULL) { | 325 if (fDateFormat && (sdtfmt = CR_DYNAMIC_CAST<SimpleDateFormat*>(fDateFor
mat)) == NULL) { |
| 326 status = U_UNSUPPORTED_ERROR; | 326 status = U_UNSUPPORTED_ERROR; |
| 327 return; | 327 return; |
| 328 } | 328 } |
| 329 if (fTimeFormat && (stmfmt = dynamic_cast<SimpleDateFormat*>(fTimeFormat
)) == NULL) { | 329 if (fTimeFormat && (stmfmt = CR_DYNAMIC_CAST<SimpleDateFormat*>(fTimeFor
mat)) == NULL) { |
| 330 status = U_UNSUPPORTED_ERROR; | 330 status = U_UNSUPPORTED_ERROR; |
| 331 return; | 331 return; |
| 332 } | 332 } |
| 333 if ( fDateFormat ) { | 333 if ( fDateFormat ) { |
| 334 sdtfmt->applyPattern(datePattern); | 334 sdtfmt->applyPattern(datePattern); |
| 335 } | 335 } |
| 336 if ( fTimeFormat ) { | 336 if ( fTimeFormat ) { |
| 337 stmfmt->applyPattern(timePattern); | 337 stmfmt->applyPattern(timePattern); |
| 338 } | 338 } |
| 339 } | 339 } |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 463 int32_t dayDiff = cal.get(UCAL_JULIAN_DAY, status) - nowCal->get(UCAL_JULIAN
_DAY, status); | 463 int32_t dayDiff = cal.get(UCAL_JULIAN_DAY, status) - nowCal->get(UCAL_JULIAN
_DAY, status); |
| 464 | 464 |
| 465 delete nowCal; | 465 delete nowCal; |
| 466 return dayDiff; | 466 return dayDiff; |
| 467 } | 467 } |
| 468 | 468 |
| 469 U_NAMESPACE_END | 469 U_NAMESPACE_END |
| 470 | 470 |
| 471 #endif | 471 #endif |
| 472 | 472 |
| OLD | NEW |