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

Side by Side Diff: third_party/icu/source/i18n/smpdtfmt.cpp

Issue 6520018: Get ICU 4.6 to be compiled without RTTI.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: do not include typeinfo at all Created 9 years, 10 months 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 | « third_party/icu/source/i18n/simpletz.cpp ('k') | third_party/icu/source/i18n/tblcoll.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 ******************************************************************************* 2 *******************************************************************************
3 * Copyright (C) 1997-2010, International Business Machines Corporation and * 3 * Copyright (C) 1997-2010, International Business Machines Corporation and *
4 * others. All Rights Reserved. * 4 * others. All Rights Reserved. *
5 ******************************************************************************* 5 *******************************************************************************
6 * 6 *
7 * File SMPDTFMT.CPP 7 * File SMPDTFMT.CPP
8 * 8 *
9 * Modification History: 9 * Modification History:
10 * 10 *
(...skipping 667 matching lines...) Expand 10 before | Expand all | Expand 10 after
678 // We don't need to check that the row count is >= 1, since all 2d arrays ha ve at 678 // We don't need to check that the row count is >= 1, since all 2d arrays ha ve at
679 // least one row 679 // least one row
680 fNumberFormat = NumberFormat::createInstance(locale, status); 680 fNumberFormat = NumberFormat::createInstance(locale, status);
681 if (fNumberFormat != NULL && U_SUCCESS(status)) 681 if (fNumberFormat != NULL && U_SUCCESS(status))
682 { 682 {
683 // no matter what the locale's default number format looked like, we wan t 683 // no matter what the locale's default number format looked like, we wan t
684 // to modify it so that it doesn't use thousands separators, doesn't alw ays 684 // to modify it so that it doesn't use thousands separators, doesn't alw ays
685 // show the decimal point, and recognizes integers only when parsing 685 // show the decimal point, and recognizes integers only when parsing
686 686
687 fNumberFormat->setGroupingUsed(FALSE); 687 fNumberFormat->setGroupingUsed(FALSE);
688 DecimalFormat* decfmt = dynamic_cast<DecimalFormat*>(fNumberFormat); 688 DecimalFormat* decfmt = CR_DYNAMIC_CAST<DecimalFormat*>(fNumberFormat);
689 if (decfmt != NULL) { 689 if (decfmt != NULL) {
690 decfmt->setDecimalSeparatorAlwaysShown(FALSE); 690 decfmt->setDecimalSeparatorAlwaysShown(FALSE);
691 } 691 }
692 fNumberFormat->setParseIntegerOnly(TRUE); 692 fNumberFormat->setParseIntegerOnly(TRUE);
693 fNumberFormat->setMinimumFractionDigits(0); // To prevent "Jan 1.00, 199 7.00" 693 fNumberFormat->setMinimumFractionDigits(0); // To prevent "Jan 1.00, 199 7.00"
694 694
695 initNumberFormatters(locale,status); 695 initNumberFormatters(locale,status);
696 696
697 } 697 }
698 else if (U_SUCCESS(status)) 698 else if (U_SUCCESS(status))
(...skipping 659 matching lines...) Expand 10 before | Expand all | Expand 10 after
1358 1358
1359 Locale ovrLoc(locale.getLanguage(),locale.getCountry(),locale.get Variant(),kw); 1359 Locale ovrLoc(locale.getLanguage(),locale.getCountry(),locale.get Variant(),kw);
1360 nf = NumberFormat::createInstance(ovrLoc,status); 1360 nf = NumberFormat::createInstance(ovrLoc,status);
1361 1361
1362 // no matter what the locale's default number format looked like, we want 1362 // no matter what the locale's default number format looked like, we want
1363 // to modify it so that it doesn't use thousands separators, does n't always 1363 // to modify it so that it doesn't use thousands separators, does n't always
1364 // show the decimal point, and recognizes integers only when pars ing 1364 // show the decimal point, and recognizes integers only when pars ing
1365 1365
1366 if (U_SUCCESS(status)) { 1366 if (U_SUCCESS(status)) {
1367 nf->setGroupingUsed(FALSE); 1367 nf->setGroupingUsed(FALSE);
1368 DecimalFormat* decfmt = dynamic_cast<DecimalFormat*>(nf); 1368 DecimalFormat* decfmt = CR_DYNAMIC_CAST<DecimalFormat*>(nf);
1369 if (decfmt != NULL) { 1369 if (decfmt != NULL) {
1370 decfmt->setDecimalSeparatorAlwaysShown(FALSE); 1370 decfmt->setDecimalSeparatorAlwaysShown(FALSE);
1371 } 1371 }
1372 nf->setParseIntegerOnly(TRUE); 1372 nf->setParseIntegerOnly(TRUE);
1373 nf->setMinimumFractionDigits(0); // To prevent "Jan 1.00, 199 7.00" 1373 nf->setMinimumFractionDigits(0); // To prevent "Jan 1.00, 199 7.00"
1374 1374
1375 cur->nf = nf; 1375 cur->nf = nf;
1376 cur->hash = nsNameHash; 1376 cur->hash = nsNameHash;
1377 cur->next = fOverrideList; 1377 cur->next = fOverrideList;
1378 fOverrideList = cur; 1378 fOverrideList = cur;
(...skipping 661 matching lines...) Expand 10 before | Expand all | Expand 10 after
2040 if (tztype != TZTYPE_UNK) { 2040 if (tztype != TZTYPE_UNK) {
2041 copy = cal.clone(); 2041 copy = cal.clone();
2042 // Check for failed cloning. 2042 // Check for failed cloning.
2043 if (copy == NULL) { 2043 if (copy == NULL) {
2044 status = U_MEMORY_ALLOCATION_ERROR; 2044 status = U_MEMORY_ALLOCATION_ERROR;
2045 goto ExitParse; 2045 goto ExitParse;
2046 } 2046 }
2047 const TimeZone & tz = cal.getTimeZone(); 2047 const TimeZone & tz = cal.getTimeZone();
2048 BasicTimeZone *btz = NULL; 2048 BasicTimeZone *btz = NULL;
2049 2049
2050 if (dynamic_cast<const OlsonTimeZone *>(&tz) != NULL 2050 if (CR_DYNAMIC_CAST<const OlsonTimeZone *>(&tz) != NULL
2051 || dynamic_cast<const SimpleTimeZone *>(&tz) != NULL 2051 || CR_DYNAMIC_CAST<const SimpleTimeZone *>(&tz) != NULL
2052 || dynamic_cast<const RuleBasedTimeZone *>(&tz) != NULL 2052 || CR_DYNAMIC_CAST<const RuleBasedTimeZone *>(&tz) != NULL
2053 || dynamic_cast<const VTimeZone *>(&tz) != NULL) { 2053 || CR_DYNAMIC_CAST<const VTimeZone *>(&tz) != NULL) {
2054 btz = (BasicTimeZone*)&tz; 2054 btz = (BasicTimeZone*)&tz;
2055 } 2055 }
2056 2056
2057 // Get local millis 2057 // Get local millis
2058 copy->set(UCAL_ZONE_OFFSET, 0); 2058 copy->set(UCAL_ZONE_OFFSET, 0);
2059 copy->set(UCAL_DST_OFFSET, 0); 2059 copy->set(UCAL_DST_OFFSET, 0);
2060 UDate localMillis = copy->getTime(status); 2060 UDate localMillis = copy->getTime(status);
2061 2061
2062 // Make sure parsed time zone type (Standard or Daylight) 2062 // Make sure parsed time zone type (Standard or Daylight)
2063 // matches the rule used by the parsed time zone. 2063 // matches the rule used by the parsed time zone.
(...skipping 862 matching lines...) Expand 10 before | Expand all | Expand 10 after
2926 * Parse an integer using fNumberFormat up to maxDigits. 2926 * Parse an integer using fNumberFormat up to maxDigits.
2927 */ 2927 */
2928 void SimpleDateFormat::parseInt(const UnicodeString& text, 2928 void SimpleDateFormat::parseInt(const UnicodeString& text,
2929 Formattable& number, 2929 Formattable& number,
2930 int32_t maxDigits, 2930 int32_t maxDigits,
2931 ParsePosition& pos, 2931 ParsePosition& pos,
2932 UBool allowNegative, 2932 UBool allowNegative,
2933 NumberFormat *fmt) const { 2933 NumberFormat *fmt) const {
2934 UnicodeString oldPrefix; 2934 UnicodeString oldPrefix;
2935 DecimalFormat* df = NULL; 2935 DecimalFormat* df = NULL;
2936 if (!allowNegative && (df = dynamic_cast<DecimalFormat*>(fmt)) != NULL) { 2936 if (!allowNegative && (df = CR_DYNAMIC_CAST<DecimalFormat*>(fmt)) != NULL) {
2937 df->getNegativePrefix(oldPrefix); 2937 df->getNegativePrefix(oldPrefix);
2938 df->setNegativePrefix(SUPPRESS_NEGATIVE_PREFIX); 2938 df->setNegativePrefix(SUPPRESS_NEGATIVE_PREFIX);
2939 } 2939 }
2940 int32_t oldPos = pos.getIndex(); 2940 int32_t oldPos = pos.getIndex();
2941 fmt->parse(text, number, pos); 2941 fmt->parse(text, number, pos);
2942 if (df != NULL) { 2942 if (df != NULL) {
2943 df->setNegativePrefix(oldPrefix); 2943 df->setNegativePrefix(oldPrefix);
2944 } 2944 }
2945 2945
2946 if (maxDigits > 0) { 2946 if (maxDigits > 0) {
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
3155 // check that we are still in range 3155 // check that we are still in range
3156 if ( (start > text.length()) || 3156 if ( (start > text.length()) ||
3157 (start < 0) || 3157 (start < 0) ||
3158 (patLoc < 0) || 3158 (patLoc < 0) ||
3159 (patLoc > fPattern.length())) { 3159 (patLoc > fPattern.length())) {
3160 // out of range, don't advance location in text 3160 // out of range, don't advance location in text
3161 return start; 3161 return start;
3162 } 3162 }
3163 3163
3164 // get the suffix 3164 // get the suffix
3165 DecimalFormat* decfmt = dynamic_cast<DecimalFormat*>(fNumberFormat); 3165 DecimalFormat* decfmt = CR_DYNAMIC_CAST<DecimalFormat*>(fNumberFormat);
3166 if (decfmt != NULL) { 3166 if (decfmt != NULL) {
3167 if (isNegative) { 3167 if (isNegative) {
3168 suf = decfmt->getNegativeSuffix(suf); 3168 suf = decfmt->getNegativeSuffix(suf);
3169 } 3169 }
3170 else { 3170 else {
3171 suf = decfmt->getPositiveSuffix(suf); 3171 suf = decfmt->getPositiveSuffix(suf);
3172 } 3172 }
3173 } 3173 }
3174 3174
3175 // check for suffix 3175 // check for suffix
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
3286 pos += U16_LENGTH(c); 3286 pos += U16_LENGTH(c);
3287 } 3287 }
3288 return pos; 3288 return pos;
3289 } 3289 }
3290 3290
3291 U_NAMESPACE_END 3291 U_NAMESPACE_END
3292 3292
3293 #endif /* #if !UCONFIG_NO_FORMATTING */ 3293 #endif /* #if !UCONFIG_NO_FORMATTING */
3294 3294
3295 //eof 3295 //eof
OLDNEW
« no previous file with comments | « third_party/icu/source/i18n/simpletz.cpp ('k') | third_party/icu/source/i18n/tblcoll.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698