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

Side by Side Diff: third_party/WebKit/Source/platform/text/PlatformLocale.cpp

Issue 2017053003: Remove StringBuilder::appendLiteral. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase. Created 4 years, 6 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011,2012 Google Inc. All rights reserved. 2 * Copyright (C) 2011,2012 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 { 217 {
218 String templ = queryString(WebLocalizedString::WeekFormatTemplate); 218 String templ = queryString(WebLocalizedString::WeekFormatTemplate);
219 // Converts a string like "Week $2, $1" to an LDML date format pattern like 219 // Converts a string like "Week $2, $1" to an LDML date format pattern like
220 // "'Week 'ww', 'yyyy". 220 // "'Week 'ww', 'yyyy".
221 StringBuilder builder; 221 StringBuilder builder;
222 unsigned literalStart = 0; 222 unsigned literalStart = 0;
223 unsigned length = templ.length(); 223 unsigned length = templ.length();
224 for (unsigned i = 0; i + 1 < length; ++i) { 224 for (unsigned i = 0; i + 1 < length; ++i) {
225 if (templ[i] == '$' && (templ[i + 1] == '1' || templ[i + 1] == '2')) { 225 if (templ[i] == '$' && (templ[i + 1] == '1' || templ[i + 1] == '2')) {
226 if (literalStart < i) 226 if (literalStart < i)
227 DateTimeFormat::quoteAndAppendLiteral(templ.substring(literalSta rt, i - literalStart), builder); 227 DateTimeFormat::quoteAndappend(templ.substring(literalStart, i - literalStart), builder);
228 builder.append(templ[++i] == '1' ? "yyyy" : "ww"); 228 builder.append(templ[++i] == '1' ? "yyyy" : "ww");
229 literalStart = i + 1; 229 literalStart = i + 1;
230 } 230 }
231 } 231 }
232 if (literalStart < length) 232 if (literalStart < length)
233 DateTimeFormat::quoteAndAppendLiteral(templ.substring(literalStart, leng th - literalStart), builder); 233 DateTimeFormat::quoteAndappend(templ.substring(literalStart, length - li teralStart), builder);
234 return builder.toString(); 234 return builder.toString();
235 } 235 }
236 236
237 void Locale::setLocaleData(const Vector<String, DecimalSymbolsSize>& symbols, co nst String& positivePrefix, const String& positiveSuffix, const String& negative Prefix, const String& negativeSuffix) 237 void Locale::setLocaleData(const Vector<String, DecimalSymbolsSize>& symbols, co nst String& positivePrefix, const String& positiveSuffix, const String& negative Prefix, const String& negativeSuffix)
238 { 238 {
239 for (size_t i = 0; i < symbols.size(); ++i) { 239 for (size_t i = 0; i < symbols.size(); ++i) {
240 ASSERT(!symbols[i].isEmpty()); 240 ASSERT(!symbols[i].isEmpty());
241 m_decimalSymbols[i] = symbols[i]; 241 m_decimalSymbols[i] = symbols[i];
242 } 242 }
243 m_positivePrefix = positivePrefix; 243 m_positivePrefix = positivePrefix;
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
443 builder.build(formatType == FormatTypeShort ? dateTimeFormatWithoutSecon ds() : dateTimeFormatWithSeconds()); 443 builder.build(formatType == FormatTypeShort ? dateTimeFormatWithoutSecon ds() : dateTimeFormatWithSeconds());
444 break; 444 break;
445 case DateComponents::Invalid: 445 case DateComponents::Invalid:
446 ASSERT_NOT_REACHED(); 446 ASSERT_NOT_REACHED();
447 break; 447 break;
448 } 448 }
449 return builder.toString(); 449 return builder.toString();
450 } 450 }
451 451
452 } // namespace blink 452 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/platform/text/LocaleWin.cpp ('k') | third_party/WebKit/Source/platform/weborigin/SchemeRegistry.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698