Add parseDateTime, formatDateTime, and dateFormatText to Localizer
authortkent@chromium.org <tkent@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 28 Sep 2012 16:46:05 +0000 (16:46 +0000)
committertkent@chromium.org <tkent@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 28 Sep 2012 16:46:05 +0000 (16:46 +0000)
commitba273a0546cad46866fad8ff7dc3abbbc9d748e7
treeb391169ff8251133ca3dfe4ff52dae3695a6979e
parent85135ba8bd6a596440fdb3d22f6895e1f320a5e8
Add parseDateTime, formatDateTime, and dateFormatText to Localizer
https://bugs.webkit.org/show_bug.cgi?id=97885

Reviewed by Kentaro Hara.

Source/WebCore:

This is a preparation to remove LocalizedData.h.

Add the following pure virtual member functions to Localizer.
  parseDateTime
  formatDateTime
  dateFormatText.

We rename existing parse/format functions for type=date in Locale*
classes, and extend their functionality so that they support other
date/time types. They override the new functions of Localizer.

No new tests. This should not change any behavior.

* platform/text/Localizer.h:
(Localizer): Add parseDateTime, formatDateTime, and dateFormatText.

* platform/text/LocaleICU.h:
(LocaleICU):
- Rename parseLocalizedDate to parseDateTime
- Add type argument to parseDateTime
- Rename formatLocalizedDate to formatDateTime
- Rename localizedDateFormatText to dateFormatText
- Make parseDateTime/formatDateTime/dateFormatText virtual.
* platform/text/LocaleICU.cpp:
(WebCore::LocaleICU::parseDateTime):
Renamed. Reject non-date types.
(WebCore::LocaleICU::formatDateTime): ditto.
(WebCore::LocaleICU::dateFormatText): Renamed.
* platform/text/LocalizedDateICU.cpp: Moved some code to LocaleICU.cpp.
(WebCore::parseLocalizedDate):
(WebCore::formatLocalizedDate):

* platform/text/LocaleNone.cpp:
Add empty implementations of parseDateTime, formatDateTime, and
dateFormatText.
(LocaleNone):
(WebCore::LocaleNone::parseDateTime):
(WebCore::LocaleNone::formatDateTime):
(WebCore::LocaleNone::dateFormatText):

* platform/text/LocaleWin.h:
(LocaleWin):
- Rename parseDate to parseDateTime
- Add type argument to parseDateTime
- Rename formatDate to formatDateTime
- Make parseDateTime/formatDateTime/dateFormatText virtual.
* platform/text/LocaleWin.cpp:
(WebCore::LocaleWin::parseDateTime):
Renamed. Reject non-date types.
(WebCore::LocaleWin::formatDateTime): ditto.
* platform/text/LocalizedDateWin.cpp: Moved some code to LocaleWin.cpp.
(WebCore::parseLocalizedDate):
(WebCore::formatLocalizedDate):

* platform/text/mac/LocaleMac.h:
(LocaleMac):
- Rename parseDate to parseDateTime
- Add type argument to parseDateTime
- Rename formatDate to formatDateTime
- Make parseDateTime/formatDateTime/dateFormatText virtual.
* platform/text/mac/LocaleMac.mm:
(WebCore::LocaleMac::parseDateTime):
Renamed. Reject non-date types.
(WebCore::LocaleMac::formatDateTime): ditto.
* platform/text/mac/LocalizedDateMac.cpp: Moved some code to LocaleMac.mm.
(WebCore::parseLocalizedDate):
(WebCore::formatLocalizedDate):

Source/WebKit/chromium:

* tests/LocaleMacTest.cpp: Follow renaming of LocaleMac functions.
(LocaleMacTest::formatDate):
(LocaleMacTest::parseDate):
* tests/LocaleWinTest.cpp: Follow renaming of LocaleWin functions.
(LocaleWinTest::formatDate):
(LocaleWinTest::parseDate):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@129912 268f45cc-cd09-0410-ab3c-d52691b4dbfc
15 files changed:
Source/WebCore/ChangeLog
Source/WebCore/platform/text/LocaleICU.cpp
Source/WebCore/platform/text/LocaleICU.h
Source/WebCore/platform/text/LocaleNone.cpp
Source/WebCore/platform/text/LocaleWin.cpp
Source/WebCore/platform/text/LocaleWin.h
Source/WebCore/platform/text/LocalizedDateICU.cpp
Source/WebCore/platform/text/LocalizedDateWin.cpp
Source/WebCore/platform/text/Localizer.h
Source/WebCore/platform/text/mac/LocaleMac.h
Source/WebCore/platform/text/mac/LocaleMac.mm
Source/WebCore/platform/text/mac/LocalizedDateMac.cpp
Source/WebKit/chromium/ChangeLog
Source/WebKit/chromium/tests/LocaleMacTest.cpp
Source/WebKit/chromium/tests/LocaleWinTest.cpp