summaryrefslogtreecommitdiff
path: root/xfa/fxfa/parser
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2017-06-01 09:20:41 -0400
committerChromium commit bot <commit-bot@chromium.org>2017-06-01 16:20:51 +0000
commita64cd6c86438636b031e1204057b27a8b9673296 (patch)
tree2f8bdbe658b866d417fd71f2d3fe532802968377 /xfa/fxfa/parser
parentfb7021ce035587c460c0ed91584ca05999e60ddd (diff)
downloadpdfium-a64cd6c86438636b031e1204057b27a8b9673296.tar.xz
Remove unused Locale code
This CL removes unused code from CFGAS_FormatString and CXFA_LocaleValue. Change-Id: I87a996231b3ad3770508be362456c435034b229c Reviewed-on: https://pdfium-review.googlesource.com/6177 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'xfa/fxfa/parser')
-rw-r--r--xfa/fxfa/parser/cxfa_localevalue.cpp167
-rw-r--r--xfa/fxfa/parser/cxfa_localevalue.h24
2 files changed, 0 insertions, 191 deletions
diff --git a/xfa/fxfa/parser/cxfa_localevalue.cpp b/xfa/fxfa/parser/cxfa_localevalue.cpp
index d2e526eb95..c563f44082 100644
--- a/xfa/fxfa/parser/cxfa_localevalue.cpp
+++ b/xfa/fxfa/parser/cxfa_localevalue.cpp
@@ -182,93 +182,6 @@ CFX_WideString CXFA_LocaleValue::GetValue() const {
uint32_t CXFA_LocaleValue::GetType() const {
return m_dwType;
}
-void CXFA_LocaleValue::SetValue(const CFX_WideString& wsValue,
- uint32_t dwType) {
- m_wsValue = wsValue;
- m_dwType = dwType;
-}
-CFX_WideString CXFA_LocaleValue::GetText() const {
- if (m_bValid && m_dwType == XFA_VT_TEXT) {
- return m_wsValue;
- }
- return CFX_WideString();
-}
-float CXFA_LocaleValue::GetNum() const {
- if (m_bValid && (m_dwType == XFA_VT_BOOLEAN || m_dwType == XFA_VT_INTEGER ||
- m_dwType == XFA_VT_DECIMAL || m_dwType == XFA_VT_FLOAT)) {
- int64_t nIntegral = 0;
- uint32_t dwFractional = 0;
- int32_t nExponent = 0;
- int cc = 0;
- bool bNegative = false, bExpSign = false;
- const wchar_t* str = m_wsValue.c_str();
- int len = m_wsValue.GetLength();
- while (FXSYS_iswspace(str[cc]) && cc < len) {
- cc++;
- }
- if (cc >= len) {
- return 0;
- }
- if (str[0] == '+') {
- cc++;
- } else if (str[0] == '-') {
- bNegative = true;
- cc++;
- }
- int nIntegralLen = 0;
- while (cc < len) {
- if (str[cc] == '.' || !FXSYS_isDecimalDigit(str[cc]) ||
- nIntegralLen > 17) {
- break;
- }
- nIntegral = nIntegral * 10 + str[cc] - '0';
- cc++;
- nIntegralLen++;
- }
- nIntegral = bNegative ? -nIntegral : nIntegral;
- int scale = 0;
- double fraction = 0.0;
- if (cc < len && str[cc] == '.') {
- cc++;
- while (cc < len) {
- fraction += XFA_GetFractionalScale(scale) * (str[cc] - '0');
- scale++;
- cc++;
- if (scale == XFA_GetMaxFractionalScale() ||
- !FXSYS_isDecimalDigit(str[cc])) {
- break;
- }
- }
- dwFractional = (uint32_t)(fraction * 4294967296.0);
- }
- if (cc < len && (str[cc] == 'E' || str[cc] == 'e')) {
- cc++;
- if (cc < len) {
- if (str[cc] == '+') {
- cc++;
- } else if (str[cc] == '-') {
- bExpSign = true;
- cc++;
- }
- }
- while (cc < len) {
- if (str[cc] == '.' || !FXSYS_isDecimalDigit(str[cc])) {
- break;
- }
- nExponent = nExponent * 10 + str[cc] - '0';
- cc++;
- }
- nExponent = bExpSign ? -nExponent : nExponent;
- }
- float fValue = (float)(dwFractional / 4294967296.0);
- fValue = nIntegral + (nIntegral >= 0 ? fValue : -fValue);
- if (nExponent != 0) {
- fValue *= FXSYS_pow(10, (float)nExponent);
- }
- return fValue;
- }
- return 0;
-}
double CXFA_LocaleValue::GetDoubleNum() const {
if (m_bValid && (m_dwType == XFA_VT_BOOLEAN || m_dwType == XFA_VT_INTEGER ||
m_dwType == XFA_VT_DECIMAL || m_dwType == XFA_VT_FLOAT)) {
@@ -368,59 +281,12 @@ CFX_DateTime CXFA_LocaleValue::GetTime() const {
return CFX_DateTime();
}
-CFX_DateTime CXFA_LocaleValue::GetDateTime() const {
- if (m_bValid && m_dwType == XFA_VT_DATETIME) {
- int32_t index = m_wsValue.Find('T');
- CFX_DateTime dt;
- FX_DateFromCanonical(m_wsValue.Left(index), &dt);
- ASSERT(m_pLocaleMgr);
- FX_TimeFromCanonical(
- m_wsValue.Right(m_wsValue.GetLength() - index - 1).AsStringC(), &dt,
- m_pLocaleMgr->GetDefLocale());
- return dt;
- }
- return CFX_DateTime();
-}
-
-bool CXFA_LocaleValue::SetText(const CFX_WideString& wsText) {
- m_dwType = XFA_VT_TEXT;
- m_wsValue = wsText;
- return true;
-}
-
-bool CXFA_LocaleValue::SetText(const CFX_WideString& wsText,
- const CFX_WideString& wsFormat,
- IFX_Locale* pLocale) {
- m_dwType = XFA_VT_TEXT;
- return m_bValid = ParsePatternValue(wsText, wsFormat, pLocale);
-}
-
-bool CXFA_LocaleValue::SetNum(float fNum) {
- m_dwType = XFA_VT_FLOAT;
- m_wsValue.Format(L"%.8g", static_cast<double>(fNum));
- return true;
-}
-
-bool CXFA_LocaleValue::SetNum(const CFX_WideString& wsNum,
- const CFX_WideString& wsFormat,
- IFX_Locale* pLocale) {
- m_dwType = XFA_VT_FLOAT;
- return m_bValid = ParsePatternValue(wsNum, wsFormat, pLocale);
-}
-
bool CXFA_LocaleValue::SetDate(const CFX_DateTime& d) {
m_dwType = XFA_VT_DATE;
m_wsValue.Format(L"%04d-%02d-%02d", d.GetYear(), d.GetMonth(), d.GetDay());
return true;
}
-bool CXFA_LocaleValue::SetDate(const CFX_WideString& wsDate,
- const CFX_WideString& wsFormat,
- IFX_Locale* pLocale) {
- m_dwType = XFA_VT_DATE;
- return m_bValid = ParsePatternValue(wsDate, wsFormat, pLocale);
-}
-
bool CXFA_LocaleValue::SetTime(const CFX_DateTime& t) {
m_dwType = XFA_VT_TIME;
m_wsValue.Format(L"%02d:%02d:%02d", t.GetHour(), t.GetMinute(),
@@ -433,13 +299,6 @@ bool CXFA_LocaleValue::SetTime(const CFX_DateTime& t) {
return true;
}
-bool CXFA_LocaleValue::SetTime(const CFX_WideString& wsTime,
- const CFX_WideString& wsFormat,
- IFX_Locale* pLocale) {
- m_dwType = XFA_VT_TIME;
- return m_bValid = ParsePatternValue(wsTime, wsFormat, pLocale);
-}
-
bool CXFA_LocaleValue::SetDateTime(const CFX_DateTime& dt) {
m_dwType = XFA_VT_DATETIME;
m_wsValue.Format(L"%04d-%02d-%02dT%02d:%02d:%02d", dt.GetYear(),
@@ -453,13 +312,6 @@ bool CXFA_LocaleValue::SetDateTime(const CFX_DateTime& dt) {
return true;
}
-bool CXFA_LocaleValue::SetDateTime(const CFX_WideString& wsDateTime,
- const CFX_WideString& wsFormat,
- IFX_Locale* pLocale) {
- m_dwType = XFA_VT_DATETIME;
- return m_bValid = ParsePatternValue(wsDateTime, wsFormat, pLocale);
-}
-
bool CXFA_LocaleValue::FormatPatterns(CFX_WideString& wsResult,
const CFX_WideString& wsFormat,
IFX_Locale* pLocale,
@@ -769,25 +621,6 @@ bool CXFA_LocaleValue::ValidateCanonicalTime(const CFX_WideString& wsTime) {
wFraction <= 999;
}
-bool CXFA_LocaleValue::ValidateCanonicalDateTime(
- const CFX_WideString& wsDateTime) {
- CFX_WideString wsDate, wsTime;
- if (wsDateTime.IsEmpty())
- return false;
-
- int nSplitIndex = -1;
- nSplitIndex = wsDateTime.Find('T');
- if (nSplitIndex < 0)
- nSplitIndex = wsDateTime.Find(' ');
- if (nSplitIndex < 0)
- return false;
-
- wsDate = wsDateTime.Left(nSplitIndex);
- wsTime = wsDateTime.Right(wsDateTime.GetLength() - nSplitIndex - 1);
- CFX_DateTime dt;
- return ValidateCanonicalDate(wsDate, &dt) && ValidateCanonicalTime(wsTime);
-}
-
bool CXFA_LocaleValue::ParsePatternValue(const CFX_WideString& wsValue,
const CFX_WideString& wsPattern,
IFX_Locale* pLocale) {
diff --git a/xfa/fxfa/parser/cxfa_localevalue.h b/xfa/fxfa/parser/cxfa_localevalue.h
index cb30d37792..d263dba476 100644
--- a/xfa/fxfa/parser/cxfa_localevalue.h
+++ b/xfa/fxfa/parser/cxfa_localevalue.h
@@ -57,7 +57,6 @@ class CXFA_LocaleValue {
bool ValidateCanonicalDate(const CFX_WideString& wsDate,
CFX_DateTime* unDate);
bool ValidateCanonicalTime(const CFX_WideString& wsTime);
- bool ValidateCanonicalDateTime(const CFX_WideString& wsDateTime);
void GetNumbericFormat(CFX_WideString& wsFormat,
int32_t nIntLen,
int32_t nDecLen,
@@ -69,35 +68,12 @@ class CXFA_LocaleValue {
CFX_WideString GetValue() const;
uint32_t GetType() const;
- void SetValue(const CFX_WideString& wsValue, uint32_t dwType);
- CFX_WideString GetText() const;
- float GetNum() const;
double GetDoubleNum() const;
CFX_DateTime GetDate() const;
CFX_DateTime GetTime() const;
- CFX_DateTime GetDateTime() const;
- bool SetText(const CFX_WideString& wsText);
- bool SetText(const CFX_WideString& wsText,
- const CFX_WideString& wsFormat,
- IFX_Locale* pLocale);
- bool SetNum(float fNum);
- bool SetNum(const CFX_WideString& wsNum,
- const CFX_WideString& wsFormat,
- IFX_Locale* pLocale);
bool SetDate(const CFX_DateTime& d);
- bool SetDate(const CFX_WideString& wsDate,
- const CFX_WideString& wsFormat,
- IFX_Locale* pLocale);
bool SetTime(const CFX_DateTime& t);
- bool SetTime(const CFX_WideString& wsTime,
- const CFX_WideString& wsFormat,
- IFX_Locale* pLocale);
bool SetDateTime(const CFX_DateTime& dt);
- bool SetDateTime(const CFX_WideString& wsDateTime,
- const CFX_WideString& wsFormat,
- IFX_Locale* pLocale);
- bool IsNull() const { return m_dwType == XFA_VT_NULL; }
- bool IsEmpty() const { return m_wsValue.IsEmpty(); }
bool IsValid() const { return m_bValid; }
private: