diff options
author | Dan Sinclair <dsinclair@chromium.org> | 2017-03-29 14:50:40 -0400 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-03-29 19:42:25 +0000 |
commit | 0cf642f763b1ab8cdb3c52db80cf38e380c82a19 (patch) | |
tree | 7ae693182eb52787bf7357d4b36d882811904453 /xfa/fgas | |
parent | efcae5d85f829618749461617521a076881cc493 (diff) | |
download | pdfium-0cf642f763b1ab8cdb3c52db80cf38e380c82a19.tar.xz |
Rename CFX_Unitime to CFX_DateTime
The name Unitime did not give any indication of what the class
contained. This Cl renames to DateTime to more accurately refect the
class holds a date and time.
Change-Id: I95f96224822f46a7da46ae39c71d2e23fc16f7d5
Reviewed-on: https://pdfium-review.googlesource.com/3255
Commit-Queue: dsinclair <dsinclair@chromium.org>
Reviewed-by: Nicolás Peña <npm@chromium.org>
Diffstat (limited to 'xfa/fgas')
-rw-r--r-- | xfa/fgas/localization/cfx_datetime.cpp (renamed from xfa/fgas/localization/fgas_datetime.cpp) | 6 | ||||
-rw-r--r-- | xfa/fgas/localization/cfx_datetime.h (renamed from xfa/fgas/localization/fgas_datetime.h) | 27 | ||||
-rw-r--r-- | xfa/fgas/localization/cfx_formatstring.h | 2 | ||||
-rw-r--r-- | xfa/fgas/localization/fgas_locale.cpp | 19 | ||||
-rw-r--r-- | xfa/fgas/localization/fgas_locale.h | 8 |
5 files changed, 29 insertions, 33 deletions
diff --git a/xfa/fgas/localization/fgas_datetime.cpp b/xfa/fgas/localization/cfx_datetime.cpp index 973fb3b5e3..eb804eed7a 100644 --- a/xfa/fgas/localization/fgas_datetime.cpp +++ b/xfa/fgas/localization/cfx_datetime.cpp @@ -5,7 +5,7 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com #include "core/fxcrt/fx_system.h" -#include "xfa/fgas/localization/fgas_datetime.h" +#include "xfa/fgas/localization/cfx_datetime.h" #if _FX_OS_ == _FX_LINUX_DESKTOP_ || _FX_OS_ == _FX_ANDROID_ || \ _FX_OS_ == _FX_MACOSX_ || _FX_OS_ == _FX_IOS_ @@ -90,7 +90,7 @@ bool FX_IsLeapYear(int32_t iYear) { return ((iYear % 4) == 0 && (iYear % 100) != 0) || (iYear % 400) == 0; } -void CFX_Unitime::Now() { +void CFX_DateTime::Now() { FXUT_SYSTEMTIME utLocal; #if _FX_OS_ == _FX_WIN32_DESKTOP_ || _FX_OS_ == _FX_WIN32_MOBILE_ || \ _FX_OS_ == _FX_WIN64_ @@ -121,7 +121,7 @@ void CFX_Unitime::Now() { millisecond_ = static_cast<uint16_t>(utLocal.wMillisecond); } -int32_t CFX_Unitime::GetDayOfWeek() const { +int32_t CFX_DateTime::GetDayOfWeek() const { int32_t v = static_cast<int32_t>(DateToDays(year_, month_, day_, true) % 7); if (v < 0) v += 7; diff --git a/xfa/fgas/localization/fgas_datetime.h b/xfa/fgas/localization/cfx_datetime.h index 9225dccaaa..d7bfa8d53a 100644 --- a/xfa/fgas/localization/fgas_datetime.h +++ b/xfa/fgas/localization/cfx_datetime.h @@ -4,20 +4,17 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com -#ifndef XFA_FGAS_LOCALIZATION_FGAS_DATETIME_H_ -#define XFA_FGAS_LOCALIZATION_FGAS_DATETIME_H_ +#ifndef XFA_FGAS_LOCALIZATION_CFX_DATETIME_H_ +#define XFA_FGAS_LOCALIZATION_CFX_DATETIME_H_ #include "core/fxcrt/fx_system.h" -class CFX_Unitime; -class CFX_DateTime; - bool FX_IsLeapYear(int32_t iYear); uint8_t FX_DaysInMonth(int32_t iYear, uint8_t iMonth); -class CFX_Unitime { +class CFX_DateTime { public: - CFX_Unitime() + CFX_DateTime() : year_(0), month_(0), day_(0), @@ -25,13 +22,13 @@ class CFX_Unitime { minute_(0), second_(0), millisecond_(0) {} - CFX_Unitime(int32_t year, - uint8_t month, - uint8_t day, - uint8_t hour, - uint8_t minute, - uint8_t second, - uint16_t millisecond) + CFX_DateTime(int32_t year, + uint8_t month, + uint8_t day, + uint8_t hour, + uint8_t minute, + uint8_t second, + uint16_t millisecond) : year_(year), month_(month), day_(day), @@ -103,4 +100,4 @@ struct FX_TIMEZONE { #pragma pack(pop) #endif -#endif // XFA_FGAS_LOCALIZATION_FGAS_DATETIME_H_ +#endif // XFA_FGAS_LOCALIZATION_CFX_DATETIME_H_ diff --git a/xfa/fgas/localization/cfx_formatstring.h b/xfa/fgas/localization/cfx_formatstring.h index 39319964aa..5fd60aac97 100644 --- a/xfa/fgas/localization/cfx_formatstring.h +++ b/xfa/fgas/localization/cfx_formatstring.h @@ -30,7 +30,7 @@ class CFX_FormatString { bool ParseDateTime(const CFX_WideString& wsSrcDateTime, const CFX_WideString& wsPattern, FX_DATETIMETYPE eDateTimeType, - CFX_Unitime* dtValue); + CFX_DateTime* dtValue); bool ParseZero(const CFX_WideString& wsSrcText, const CFX_WideString& wsPattern); bool ParseNull(const CFX_WideString& wsSrcText, diff --git a/xfa/fgas/localization/fgas_locale.cpp b/xfa/fgas/localization/fgas_locale.cpp index 17aae595dc..4747aafcf5 100644 --- a/xfa/fgas/localization/fgas_locale.cpp +++ b/xfa/fgas/localization/fgas_locale.cpp @@ -205,7 +205,7 @@ bool GetNumericDotIndex(const CFX_WideString& wsNum, bool ParseLocaleDate(const CFX_WideString& wsDate, const CFX_WideString& wsDatePattern, IFX_Locale* pLocale, - CFX_Unitime* datetime, + CFX_DateTime* datetime, int32_t& cc) { int32_t year = 1900; int32_t month = 1; @@ -416,7 +416,7 @@ void ResolveZone(uint8_t& wHour, bool ParseLocaleTime(const CFX_WideString& wsTime, const CFX_WideString& wsTimePattern, IFX_Locale* pLocale, - CFX_Unitime* datetime, + CFX_DateTime* datetime, int32_t& cc) { uint8_t hour = 0; uint8_t minute = 0; @@ -669,7 +669,7 @@ uint16_t GetWeekOfYear(uint16_t year, uint16_t month, uint16_t day) { bool DateFormat(const CFX_WideString& wsDatePattern, IFX_Locale* pLocale, - const CFX_Unitime& datetime, + const CFX_DateTime& datetime, CFX_WideString& wsResult) { bool bRet = true; int32_t year = datetime.GetYear(); @@ -777,7 +777,7 @@ bool DateFormat(const CFX_WideString& wsDatePattern, bool TimeFormat(const CFX_WideString& wsTimePattern, IFX_Locale* pLocale, - const CFX_Unitime& datetime, + const CFX_DateTime& datetime, CFX_WideString& wsResult) { bool bGMT = false; bool bRet = true; @@ -902,7 +902,7 @@ bool TimeFormat(const CFX_WideString& wsTimePattern, return bRet; } -bool FormatDateTimeInternal(const CFX_Unitime& dt, +bool FormatDateTimeInternal(const CFX_DateTime& dt, const CFX_WideString& wsDatePattern, const CFX_WideString& wsTimePattern, bool bDateFirst, @@ -921,7 +921,8 @@ bool FormatDateTimeInternal(const CFX_Unitime& dt, } // namespace -bool FX_DateFromCanonical(const CFX_WideString& wsDate, CFX_Unitime* datetime) { +bool FX_DateFromCanonical(const CFX_WideString& wsDate, + CFX_DateTime* datetime) { int32_t year = 1900; int32_t month = 1; int32_t day = 1; @@ -999,7 +1000,7 @@ bool FX_DateFromCanonical(const CFX_WideString& wsDate, CFX_Unitime* datetime) { } bool FX_TimeFromCanonical(const CFX_WideStringC& wsTime, - CFX_Unitime* datetime, + CFX_DateTime* datetime, IFX_Locale* pLocale) { if (wsTime.GetLength() == 0) return false; @@ -2038,7 +2039,7 @@ FX_DATETIMETYPE CFX_FormatString::GetDateTimeFormat( bool CFX_FormatString::ParseDateTime(const CFX_WideString& wsSrcDateTime, const CFX_WideString& wsPattern, FX_DATETIMETYPE eDateTimeType, - CFX_Unitime* dtValue) { + CFX_DateTime* dtValue) { dtValue->Reset(); if (wsSrcDateTime.IsEmpty() || wsPattern.IsEmpty()) { @@ -2658,7 +2659,7 @@ bool CFX_FormatString::FormatDateTime(const CFX_WideString& wsSrcDateTime, if (eCategory == FX_DATETIMETYPE_Unknown) { return false; } - CFX_Unitime dt; + CFX_DateTime dt; int32_t iT = wsSrcDateTime.Find(L"T"); if (iT < 0) { if (eCategory == FX_DATETIMETYPE_Date && diff --git a/xfa/fgas/localization/fgas_locale.h b/xfa/fgas/localization/fgas_locale.h index 5d8ddc0b52..aecd4d62d4 100644 --- a/xfa/fgas/localization/fgas_locale.h +++ b/xfa/fgas/localization/fgas_locale.h @@ -10,9 +10,7 @@ #include <memory> #include "core/fxcrt/fx_xml.h" -#include "xfa/fgas/localization/fgas_datetime.h" - -class CFX_Unitime; +#include "xfa/fgas/localization/cfx_datetime.h" enum FX_LOCALENUMSYMBOL { FX_LOCALENUMSYMBOL_Decimal, @@ -73,9 +71,9 @@ class IFX_Locale { virtual CFX_WideString GetNumPattern(FX_LOCALENUMSUBCATEGORY eType) const = 0; }; -bool FX_DateFromCanonical(const CFX_WideString& wsDate, CFX_Unitime* datetime); +bool FX_DateFromCanonical(const CFX_WideString& wsDate, CFX_DateTime* datetime); bool FX_TimeFromCanonical(const CFX_WideStringC& wsTime, - CFX_Unitime* datetime, + CFX_DateTime* datetime, IFX_Locale* pLocale); class CFX_Decimal { public: |