| OLD | NEW |
| 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 15 matching lines...) Expand all Loading... |
| 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 #include "config.h" | 31 #include "config.h" |
| 32 #include "core/platform/text/PlatformLocale.h" | 32 #include "core/platform/text/PlatformLocale.h" |
| 33 | 33 |
| 34 #include "core/platform/LocalizedStrings.h" | 34 #include "core/platform/LocalizedStrings.h" |
| 35 #include "core/platform/text/DateTimeFormat.h" | 35 #include "core/platform/text/DateTimeFormat.h" |
| 36 #include "public/platform/Platform.h" |
| 36 #include "wtf/text/StringBuilder.h" | 37 #include "wtf/text/StringBuilder.h" |
| 37 | 38 |
| 38 namespace WebCore { | 39 namespace WebCore { |
| 39 | 40 |
| 41 using WebKit::Platform; |
| 42 using WebKit::WebLocalizedString; |
| 43 |
| 40 class DateTimeStringBuilder : private DateTimeFormat::TokenHandler { | 44 class DateTimeStringBuilder : private DateTimeFormat::TokenHandler { |
| 41 WTF_MAKE_NONCOPYABLE(DateTimeStringBuilder); | 45 WTF_MAKE_NONCOPYABLE(DateTimeStringBuilder); |
| 42 | 46 |
| 43 public: | 47 public: |
| 44 // The argument objects must be alive until this object dies. | 48 // The argument objects must be alive until this object dies. |
| 45 DateTimeStringBuilder(Locale&, const DateComponents&); | 49 DateTimeStringBuilder(Locale&, const DateComponents&); |
| 46 | 50 |
| 47 bool build(const String&); | 51 bool build(const String&); |
| 48 String toString(); | 52 String toString(); |
| 49 | 53 |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 | 177 |
| 174 String DateTimeStringBuilder::toString() | 178 String DateTimeStringBuilder::toString() |
| 175 { | 179 { |
| 176 return m_builder.toString(); | 180 return m_builder.toString(); |
| 177 } | 181 } |
| 178 | 182 |
| 179 Locale::~Locale() | 183 Locale::~Locale() |
| 180 { | 184 { |
| 181 } | 185 } |
| 182 | 186 |
| 187 String Locale::queryString(WebLocalizedString::Name name) |
| 188 { |
| 189 // FIXME: Returns a string locazlied for this locale. |
| 190 return Platform::current()->queryLocalizedString(name); |
| 191 } |
| 192 |
| 193 String Locale::queryString(WebLocalizedString::Name name, const String& paramete
r) |
| 194 { |
| 195 // FIXME: Returns a string locazlied for this locale. |
| 196 return Platform::current()->queryLocalizedString(name, parameter); |
| 197 } |
| 198 |
| 199 String Locale::queryString(WebLocalizedString::Name name, const String& paramete
r1, const String& parameter2) |
| 200 { |
| 201 // FIXME: Returns a string locazlied for this locale. |
| 202 return Platform::current()->queryLocalizedString(name, parameter1, parameter
2); |
| 203 } |
| 204 |
| 183 void Locale::setLocaleData(const Vector<String, DecimalSymbolsSize>& symbols, co
nst String& positivePrefix, const String& positiveSuffix, const String& negative
Prefix, const String& negativeSuffix) | 205 void Locale::setLocaleData(const Vector<String, DecimalSymbolsSize>& symbols, co
nst String& positivePrefix, const String& positiveSuffix, const String& negative
Prefix, const String& negativeSuffix) |
| 184 { | 206 { |
| 185 for (size_t i = 0; i < symbols.size(); ++i) { | 207 for (size_t i = 0; i < symbols.size(); ++i) { |
| 186 ASSERT(!symbols[i].isEmpty()); | 208 ASSERT(!symbols[i].isEmpty()); |
| 187 m_decimalSymbols[i] = symbols[i]; | 209 m_decimalSymbols[i] = symbols[i]; |
| 188 } | 210 } |
| 189 m_positivePrefix = positivePrefix; | 211 m_positivePrefix = positivePrefix; |
| 190 m_positiveSuffix = positiveSuffix; | 212 m_positiveSuffix = positiveSuffix; |
| 191 m_negativePrefix = negativePrefix; | 213 m_negativePrefix = negativePrefix; |
| 192 m_negativeSuffix = negativeSuffix; | 214 m_negativeSuffix = negativeSuffix; |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 354 builder.build(formatType == FormatTypeShort ? dateTimeFormatWithoutSecon
ds() : dateTimeFormatWithSeconds()); | 376 builder.build(formatType == FormatTypeShort ? dateTimeFormatWithoutSecon
ds() : dateTimeFormatWithSeconds()); |
| 355 break; | 377 break; |
| 356 case DateComponents::Invalid: | 378 case DateComponents::Invalid: |
| 357 ASSERT_NOT_REACHED(); | 379 ASSERT_NOT_REACHED(); |
| 358 break; | 380 break; |
| 359 } | 381 } |
| 360 return builder.toString(); | 382 return builder.toString(); |
| 361 } | 383 } |
| 362 | 384 |
| 363 } | 385 } |
| OLD | NEW |