Changeset 116243 in webkit


Ignore:
Timestamp:
May 6, 2012 3:12:51 PM (12 years ago)
Author:
tkent@chromium.org
Message:

Rename ICULocale to LocaleICU, part 2
https://bugs.webkit.org/show_bug.cgi?id=85695

Reviewed by Kentaro Hara.

Source/WebCore:

No behavior change

  • platform/text/LocaleICU.cpp: Rename ICULocale to LocaleICU.
  • platform/text/LocaleICU.h: ditto.

Also, update obsolete comments.

  • platform/text/LocalizedDateICU.cpp: Rename ICULocale to LocaleICU.

(WebCore::parseLocalizedDate):
(WebCore::formatLocalizedDate):
(WebCore::localizedDateFormatText):
(WebCore::monthLabels):
(WebCore::weekDayShortLabels):
(WebCore::firstDayOfWeek):

  • platform/text/LocalizedNumberICU.cpp: ditto.

(WebCore::convertToLocalizedNumber):
(WebCore::convertFromLocalizedNumber):

Source/WebKit/chromium:

  • tests/LocalizedNumberICUTest.cpp:

(testNumberIsReversible): Rename ICULocale to LocaleICU.

Location:
trunk/Source
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r116238 r116243  
     12012-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
    1242012-05-06  Kevin Ollivier  <kevino@theolliviers.com>
    225
  • trunk/Source/WebCore/platform/text/LocaleICU.cpp

    r116204 r116243  
    4343namespace WebCore {
    4444
    45 ICULocale::ICULocale(const char* locale)
     45LocaleICU::LocaleICU(const char* locale)
    4646    : m_locale(locale)
    4747    , m_numberFormat(0)
     
    5555}
    5656
    57 ICULocale::~ICULocale()
     57LocaleICU::~LocaleICU()
    5858{
    5959    unum_close(m_numberFormat);
     
    6161}
    6262
    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 currentICULocale;
    77 }
    78 
    79 void ICULocale::setDecimalSymbol(unsigned index, UNumberFormatSymbol symbol)
     63PassOwnPtr<LocaleICU> LocaleICU::create(const char* localeString)
     64{
     65    return adoptPtr(new LocaleICU(localeString));
     66}
     67
     68PassOwnPtr<LocaleICU> LocaleICU::createForCurrentLocale()
     69{
     70    return adoptPtr(new LocaleICU(0));
     71}
     72
     73LocaleICU* LocaleICU::currentLocale()
     74{
     75    static LocaleICU* currentLocale = LocaleICU::createForCurrentLocale().leakPtr();
     76    return currentLocale;
     77}
     78
     79void LocaleICU::setDecimalSymbol(unsigned index, UNumberFormatSymbol symbol)
    8080{
    8181    UErrorCode status = U_ZERO_ERROR;
     
    9292}
    9393
    94 void ICULocale::setDecimalTextAttribute(String& destination, UNumberFormatTextAttribute tag)
     94void LocaleICU::setDecimalTextAttribute(String& destination, UNumberFormatTextAttribute tag)
    9595{
    9696    UErrorCode status = U_ZERO_ERROR;
     
    108108}
    109109
    110 void ICULocale::initializeDecimalFormat()
     110void LocaleICU::initializeDecimalFormat()
    111111{
    112112    if (m_didCreateDecimalFormat)
     
    137137}
    138138
    139 String ICULocale::convertToLocalizedNumber(const String& input)
     139String LocaleICU::convertToLocalizedNumber(const String& input)
    140140{
    141141    initializeDecimalFormat();
     
    196196}
    197197
    198 bool ICULocale::detectSignAndGetDigitRange(const String& input, bool& isNegative, unsigned& startIndex, unsigned& endIndex)
     198bool LocaleICU::detectSignAndGetDigitRange(const String& input, bool& isNegative, unsigned& startIndex, unsigned& endIndex)
    199199{
    200200    startIndex = 0;
     
    224224}
    225225
    226 unsigned ICULocale::matchedDecimalSymbolIndex(const String& input, unsigned& position)
     226unsigned LocaleICU::matchedDecimalSymbolIndex(const String& input, unsigned& position)
    227227{
    228228    for (unsigned symbolIndex = 0; symbolIndex < DecimalSymbolsSize; ++symbolIndex) {
     
    235235}
    236236
    237 String ICULocale::convertFromLocalizedNumber(const String& localized)
     237String LocaleICU::convertFromLocalizedNumber(const String& localized)
    238238{
    239239    initializeDecimalFormat();
     
    269269}
    270270
    271 bool ICULocale::initializeShortDateFormat()
     271bool LocaleICU::initializeShortDateFormat()
    272272{
    273273    if (m_didCreateShortDateFormat)
     
    280280}
    281281
    282 double ICULocale::parseLocalizedDate(const String& input)
     282double LocaleICU::parseLocalizedDate(const String& input)
    283283{
    284284    if (!initializeShortDateFormat())
     
    296296}
    297297
    298 String ICULocale::formatLocalizedDate(const DateComponents& dateComponents)
     298String LocaleICU::formatLocalizedDate(const DateComponents& dateComponents)
    299299{
    300300    if (!initializeShortDateFormat())
     
    368368}
    369369
    370 void ICULocale::initializeLocalizedDateFormatText()
     370void LocaleICU::initializeLocalizedDateFormatText()
    371371{
    372372    if (!m_localizedDateFormatText.isNull())
     
    387387}
    388388
    389 String ICULocale::localizedDateFormatText()
     389String LocaleICU::localizedDateFormatText()
    390390{
    391391    initializeLocalizedDateFormatText();
     
    393393}
    394394
    395 PassOwnPtr<Vector<String> > ICULocale::createLabelVector(UDateFormatSymbolType type, int32_t startIndex, int32_t size)
     395PassOwnPtr<Vector<String> > LocaleICU::createLabelVector(UDateFormatSymbolType type, int32_t startIndex, int32_t size)
    396396{
    397397    if (!m_shortDateFormat)
     
    440440}
    441441
    442 void ICULocale::initializeCalendar()
     442void LocaleICU::initializeCalendar()
    443443{
    444444    if (m_monthLabels && m_weekDayShortLabels)
     
    462462}
    463463
    464 const Vector<String>& ICULocale::monthLabels()
     464const Vector<String>& LocaleICU::monthLabels()
    465465{
    466466    initializeCalendar();
     
    468468}
    469469
    470 const Vector<String>& ICULocale::weekDayShortLabels()
     470const Vector<String>& LocaleICU::weekDayShortLabels()
    471471{
    472472    initializeCalendar();
     
    474474}
    475475
    476 unsigned ICULocale::firstDayOfWeek()
     476unsigned LocaleICU::firstDayOfWeek()
    477477{
    478478    initializeCalendar();
  • trunk/Source/WebCore/platform/text/LocaleICU.h

    r116204 r116243  
    2929 */
    3030
    31 #ifndef ICULocale_h
    32 #define ICULocale_h
     31#ifndef LocaleICU_h
     32#define LocaleICU_h
    3333
    3434#include "DateComponents.h"
     
    4343
    4444// We should use this class only for LocalizedNumberICU.cpp, LocalizedDateICU.cpp,
    45 // LocalizedCalendarICU.cpp, and LocalizedNumberICUTest.cpp.
    46 class ICULocale {
     45// and LocalizedNumberICUTest.cpp.
     46class LocaleICU {
    4747public:
    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();
    5151
    5252    // For LocalizedNumber
     
    6060    String localizedDateFormatText();
    6161
    62     // For LocalizedCalendar
    6362    const Vector<String>& monthLabels();
    6463    const Vector<String>& weekDayShortLabels();
     
    6766
    6867private:
    69     static PassOwnPtr<ICULocale> createForCurrentLocale();
    70     explicit ICULocale(const char*);
     68    static PassOwnPtr<LocaleICU> createForCurrentLocale();
     69    explicit LocaleICU(const char*);
    7170    void setDecimalSymbol(unsigned index, UNumberFormatSymbol);
    7271    void setDecimalTextAttribute(String&, UNumberFormatTextAttribute);
  • trunk/Source/WebCore/platform/text/LocalizedDateICU.cpp

    r116204 r116243  
    4343    switch (type) {
    4444    case DateComponents::Date:
    45         return ICULocale::currentLocale()->parseLocalizedDate(input);
     45        return LocaleICU::currentLocale()->parseLocalizedDate(input);
    4646    case DateComponents::DateTime:
    4747    case DateComponents::DateTimeLocal:
     
    5959    switch (dateComponents.type()) {
    6060    case DateComponents::Date:
    61         return ICULocale::currentLocale()->formatLocalizedDate(dateComponents);
     61        return LocaleICU::currentLocale()->formatLocalizedDate(dateComponents);
    6262    case DateComponents::DateTime:
    6363    case DateComponents::DateTimeLocal:
     
    7474String localizedDateFormatText()
    7575{
    76     return ICULocale::currentLocale()->localizedDateFormatText();
     76    return LocaleICU::currentLocale()->localizedDateFormatText();
    7777}
    7878
    7979const Vector<String>& monthLabels()
    8080{
    81     return ICULocale::currentLocale()->monthLabels();
     81    return LocaleICU::currentLocale()->monthLabels();
    8282}
    8383
    8484const Vector<String>& weekDayShortLabels()
    8585{
    86     return ICULocale::currentLocale()->weekDayShortLabels();
     86    return LocaleICU::currentLocale()->weekDayShortLabels();
    8787}
    8888
    8989unsigned firstDayOfWeek()
    9090{
    91     return ICULocale::currentLocale()->firstDayOfWeek();
     91    return LocaleICU::currentLocale()->firstDayOfWeek();
    9292}
    9393#endif
  • trunk/Source/WebCore/platform/text/LocalizedNumberICU.cpp

    r116204 r116243  
    3838String convertToLocalizedNumber(const String& canonicalNumberString, unsigned fractionDigits)
    3939{
    40     return ICULocale::currentLocale()->convertToLocalizedNumber(canonicalNumberString);
     40    return LocaleICU::currentLocale()->convertToLocalizedNumber(canonicalNumberString);
    4141}
    4242
    4343String convertFromLocalizedNumber(const String& localizedNumberString)
    4444{
    45     return ICULocale::currentLocale()->convertFromLocalizedNumber(localizedNumberString);
     45    return LocaleICU::currentLocale()->convertFromLocalizedNumber(localizedNumberString);
    4646}
    4747
  • trunk/Source/WebKit/chromium/ChangeLog

    r116242 r116243  
     12012-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
    1112012-05-06  Adrienne Walker  <enne@google.com>
    212
  • trunk/Source/WebKit/chromium/tests/LocalizedNumberICUTest.cpp

    r116204 r116243  
    3939void testNumberIsReversible(const char* localeString, const char* original, const char* shouldHave = 0)
    4040{
    41     OwnPtr<ICULocale> locale = ICULocale::create(localeString);
     41    OwnPtr<LocaleICU> locale = LocaleICU::create(localeString);
    4242    String localized = locale->convertToLocalizedNumber(original);
    4343    if (shouldHave)
Note: See TracChangeset for help on using the changeset viewer.