Changeset 116243 in webkit
- Timestamp:
- May 6, 2012 3:12:51 PM (12 years ago)
- Location:
- trunk/Source
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r116238 r116243 1 2012-05-06 Kent Tamura <tkent@chromium.org> 2 3 Rename ICULocale to LocaleICU, part 2 4 https://bugs.webkit.org/show_bug.cgi?id=85695 5 6 Reviewed by Kentaro Hara. 7 8 No behavior change 9 10 * platform/text/LocaleICU.cpp: Rename ICULocale to LocaleICU. 11 * platform/text/LocaleICU.h: ditto. 12 Also, update obsolete comments. 13 * platform/text/LocalizedDateICU.cpp: Rename ICULocale to LocaleICU. 14 (WebCore::parseLocalizedDate): 15 (WebCore::formatLocalizedDate): 16 (WebCore::localizedDateFormatText): 17 (WebCore::monthLabels): 18 (WebCore::weekDayShortLabels): 19 (WebCore::firstDayOfWeek): 20 * platform/text/LocalizedNumberICU.cpp: ditto. 21 (WebCore::convertToLocalizedNumber): 22 (WebCore::convertFromLocalizedNumber): 23 1 24 2012-05-06 Kevin Ollivier <kevino@theolliviers.com> 2 25 -
trunk/Source/WebCore/platform/text/LocaleICU.cpp
r116204 r116243 43 43 namespace WebCore { 44 44 45 ICULocale::ICULocale(const char* locale)45 LocaleICU::LocaleICU(const char* locale) 46 46 : m_locale(locale) 47 47 , m_numberFormat(0) … … 55 55 } 56 56 57 ICULocale::~ICULocale()57 LocaleICU::~LocaleICU() 58 58 { 59 59 unum_close(m_numberFormat); … … 61 61 } 62 62 63 PassOwnPtr< ICULocale> ICULocale::create(const char* localeString)64 { 65 return adoptPtr(new ICULocale(localeString));66 } 67 68 PassOwnPtr< ICULocale> ICULocale::createForCurrentLocale()69 { 70 return adoptPtr(new ICULocale(0));71 } 72 73 ICULocale* ICULocale::currentLocale()74 { 75 static ICULocale* currentICULocale = ICULocale::createForCurrentLocale().leakPtr();76 return current ICULocale;77 } 78 79 void ICULocale::setDecimalSymbol(unsigned index, UNumberFormatSymbol symbol)63 PassOwnPtr<LocaleICU> LocaleICU::create(const char* localeString) 64 { 65 return adoptPtr(new LocaleICU(localeString)); 66 } 67 68 PassOwnPtr<LocaleICU> LocaleICU::createForCurrentLocale() 69 { 70 return adoptPtr(new LocaleICU(0)); 71 } 72 73 LocaleICU* LocaleICU::currentLocale() 74 { 75 static LocaleICU* currentLocale = LocaleICU::createForCurrentLocale().leakPtr(); 76 return currentLocale; 77 } 78 79 void LocaleICU::setDecimalSymbol(unsigned index, UNumberFormatSymbol symbol) 80 80 { 81 81 UErrorCode status = U_ZERO_ERROR; … … 92 92 } 93 93 94 void ICULocale::setDecimalTextAttribute(String& destination, UNumberFormatTextAttribute tag)94 void LocaleICU::setDecimalTextAttribute(String& destination, UNumberFormatTextAttribute tag) 95 95 { 96 96 UErrorCode status = U_ZERO_ERROR; … … 108 108 } 109 109 110 void ICULocale::initializeDecimalFormat()110 void LocaleICU::initializeDecimalFormat() 111 111 { 112 112 if (m_didCreateDecimalFormat) … … 137 137 } 138 138 139 String ICULocale::convertToLocalizedNumber(const String& input)139 String LocaleICU::convertToLocalizedNumber(const String& input) 140 140 { 141 141 initializeDecimalFormat(); … … 196 196 } 197 197 198 bool ICULocale::detectSignAndGetDigitRange(const String& input, bool& isNegative, unsigned& startIndex, unsigned& endIndex)198 bool LocaleICU::detectSignAndGetDigitRange(const String& input, bool& isNegative, unsigned& startIndex, unsigned& endIndex) 199 199 { 200 200 startIndex = 0; … … 224 224 } 225 225 226 unsigned ICULocale::matchedDecimalSymbolIndex(const String& input, unsigned& position)226 unsigned LocaleICU::matchedDecimalSymbolIndex(const String& input, unsigned& position) 227 227 { 228 228 for (unsigned symbolIndex = 0; symbolIndex < DecimalSymbolsSize; ++symbolIndex) { … … 235 235 } 236 236 237 String ICULocale::convertFromLocalizedNumber(const String& localized)237 String LocaleICU::convertFromLocalizedNumber(const String& localized) 238 238 { 239 239 initializeDecimalFormat(); … … 269 269 } 270 270 271 bool ICULocale::initializeShortDateFormat()271 bool LocaleICU::initializeShortDateFormat() 272 272 { 273 273 if (m_didCreateShortDateFormat) … … 280 280 } 281 281 282 double ICULocale::parseLocalizedDate(const String& input)282 double LocaleICU::parseLocalizedDate(const String& input) 283 283 { 284 284 if (!initializeShortDateFormat()) … … 296 296 } 297 297 298 String ICULocale::formatLocalizedDate(const DateComponents& dateComponents)298 String LocaleICU::formatLocalizedDate(const DateComponents& dateComponents) 299 299 { 300 300 if (!initializeShortDateFormat()) … … 368 368 } 369 369 370 void ICULocale::initializeLocalizedDateFormatText()370 void LocaleICU::initializeLocalizedDateFormatText() 371 371 { 372 372 if (!m_localizedDateFormatText.isNull()) … … 387 387 } 388 388 389 String ICULocale::localizedDateFormatText()389 String LocaleICU::localizedDateFormatText() 390 390 { 391 391 initializeLocalizedDateFormatText(); … … 393 393 } 394 394 395 PassOwnPtr<Vector<String> > ICULocale::createLabelVector(UDateFormatSymbolType type, int32_t startIndex, int32_t size)395 PassOwnPtr<Vector<String> > LocaleICU::createLabelVector(UDateFormatSymbolType type, int32_t startIndex, int32_t size) 396 396 { 397 397 if (!m_shortDateFormat) … … 440 440 } 441 441 442 void ICULocale::initializeCalendar()442 void LocaleICU::initializeCalendar() 443 443 { 444 444 if (m_monthLabels && m_weekDayShortLabels) … … 462 462 } 463 463 464 const Vector<String>& ICULocale::monthLabels()464 const Vector<String>& LocaleICU::monthLabels() 465 465 { 466 466 initializeCalendar(); … … 468 468 } 469 469 470 const Vector<String>& ICULocale::weekDayShortLabels()470 const Vector<String>& LocaleICU::weekDayShortLabels() 471 471 { 472 472 initializeCalendar(); … … 474 474 } 475 475 476 unsigned ICULocale::firstDayOfWeek()476 unsigned LocaleICU::firstDayOfWeek() 477 477 { 478 478 initializeCalendar(); -
trunk/Source/WebCore/platform/text/LocaleICU.h
r116204 r116243 29 29 */ 30 30 31 #ifndef ICULocale_h32 #define ICULocale_h31 #ifndef LocaleICU_h 32 #define LocaleICU_h 33 33 34 34 #include "DateComponents.h" … … 43 43 44 44 // We should use this class only for LocalizedNumberICU.cpp, LocalizedDateICU.cpp, 45 // LocalizedCalendarICU.cpp,and LocalizedNumberICUTest.cpp.46 class ICULocale{45 // and LocalizedNumberICUTest.cpp. 46 class LocaleICU { 47 47 public: 48 static PassOwnPtr< ICULocale> create(const char* localeString);49 static ICULocale* currentLocale();50 ~ ICULocale();48 static PassOwnPtr<LocaleICU> create(const char* localeString); 49 static LocaleICU* currentLocale(); 50 ~LocaleICU(); 51 51 52 52 // For LocalizedNumber … … 60 60 String localizedDateFormatText(); 61 61 62 // For LocalizedCalendar63 62 const Vector<String>& monthLabels(); 64 63 const Vector<String>& weekDayShortLabels(); … … 67 66 68 67 private: 69 static PassOwnPtr< ICULocale> createForCurrentLocale();70 explicit ICULocale(const char*);68 static PassOwnPtr<LocaleICU> createForCurrentLocale(); 69 explicit LocaleICU(const char*); 71 70 void setDecimalSymbol(unsigned index, UNumberFormatSymbol); 72 71 void setDecimalTextAttribute(String&, UNumberFormatTextAttribute); -
trunk/Source/WebCore/platform/text/LocalizedDateICU.cpp
r116204 r116243 43 43 switch (type) { 44 44 case DateComponents::Date: 45 return ICULocale::currentLocale()->parseLocalizedDate(input);45 return LocaleICU::currentLocale()->parseLocalizedDate(input); 46 46 case DateComponents::DateTime: 47 47 case DateComponents::DateTimeLocal: … … 59 59 switch (dateComponents.type()) { 60 60 case DateComponents::Date: 61 return ICULocale::currentLocale()->formatLocalizedDate(dateComponents);61 return LocaleICU::currentLocale()->formatLocalizedDate(dateComponents); 62 62 case DateComponents::DateTime: 63 63 case DateComponents::DateTimeLocal: … … 74 74 String localizedDateFormatText() 75 75 { 76 return ICULocale::currentLocale()->localizedDateFormatText();76 return LocaleICU::currentLocale()->localizedDateFormatText(); 77 77 } 78 78 79 79 const Vector<String>& monthLabels() 80 80 { 81 return ICULocale::currentLocale()->monthLabels();81 return LocaleICU::currentLocale()->monthLabels(); 82 82 } 83 83 84 84 const Vector<String>& weekDayShortLabels() 85 85 { 86 return ICULocale::currentLocale()->weekDayShortLabels();86 return LocaleICU::currentLocale()->weekDayShortLabels(); 87 87 } 88 88 89 89 unsigned firstDayOfWeek() 90 90 { 91 return ICULocale::currentLocale()->firstDayOfWeek();91 return LocaleICU::currentLocale()->firstDayOfWeek(); 92 92 } 93 93 #endif -
trunk/Source/WebCore/platform/text/LocalizedNumberICU.cpp
r116204 r116243 38 38 String convertToLocalizedNumber(const String& canonicalNumberString, unsigned fractionDigits) 39 39 { 40 return ICULocale::currentLocale()->convertToLocalizedNumber(canonicalNumberString);40 return LocaleICU::currentLocale()->convertToLocalizedNumber(canonicalNumberString); 41 41 } 42 42 43 43 String convertFromLocalizedNumber(const String& localizedNumberString) 44 44 { 45 return ICULocale::currentLocale()->convertFromLocalizedNumber(localizedNumberString);45 return LocaleICU::currentLocale()->convertFromLocalizedNumber(localizedNumberString); 46 46 } 47 47 -
trunk/Source/WebKit/chromium/ChangeLog
r116242 r116243 1 2012-05-06 Kent Tamura <tkent@chromium.org> 2 3 Rename ICULocale to LocaleICU, part 2 4 https://bugs.webkit.org/show_bug.cgi?id=85695 5 6 Reviewed by Kentaro Hara. 7 8 * tests/LocalizedNumberICUTest.cpp: 9 (testNumberIsReversible): Rename ICULocale to LocaleICU. 10 1 11 2012-05-06 Adrienne Walker <enne@google.com> 2 12 -
trunk/Source/WebKit/chromium/tests/LocalizedNumberICUTest.cpp
r116204 r116243 39 39 void testNumberIsReversible(const char* localeString, const char* original, const char* shouldHave = 0) 40 40 { 41 OwnPtr< ICULocale> locale = ICULocale::create(localeString);41 OwnPtr<LocaleICU> locale = LocaleICU::create(localeString); 42 42 String localized = locale->convertToLocalizedNumber(original); 43 43 if (shouldHave)
Note: See TracChangeset
for help on using the changeset viewer.