diff options
author | dsinclair <dsinclair@chromium.org> | 2016-05-19 10:51:56 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-05-19 10:51:56 -0700 |
commit | bc9164115e8aeefcc06f5bf08684a4733b25e085 (patch) | |
tree | 5cba0c100b9a89809923a42e6668d71f6d0a3ff2 /xfa/fgas/localization/fgas_locale.cpp | |
parent | d89fcb8f68162eef6111ce35133c80b2f7db0414 (diff) | |
download | pdfium-bc9164115e8aeefcc06f5bf08684a4733b25e085.tar.xz |
Cleanup unused fgas/ code.
Purely code removal.
Review-Url: https://codereview.chromium.org/1991143003
Diffstat (limited to 'xfa/fgas/localization/fgas_locale.cpp')
-rw-r--r-- | xfa/fgas/localization/fgas_locale.cpp | 215 |
1 files changed, 2 insertions, 213 deletions
diff --git a/xfa/fgas/localization/fgas_locale.cpp b/xfa/fgas/localization/fgas_locale.cpp index bb4fe93ba3..6eed202643 100644 --- a/xfa/fgas/localization/fgas_locale.cpp +++ b/xfa/fgas/localization/fgas_locale.cpp @@ -65,114 +65,6 @@ static const FX_WCHAR* const gs_LocalNumberSymbols[] = { L"zero", L"currencySymbol", L"currencyName", }; -IFX_Locale* IFX_Locale::Create(CXML_Element* pLocaleData) { - return new CFX_Locale(pLocaleData); -} -CFX_Locale::CFX_Locale(CXML_Element* pLocaleData) { - m_pElement = pLocaleData; -} -CFX_Locale::~CFX_Locale() {} -CFX_WideString CFX_Locale::GetName() { - return CFX_WideString(); -} -static CFX_WideString FX_GetXMLContent(const CFX_ByteStringC& bsSpace, - CXML_Element* pxmlElement, - const CFX_ByteStringC& bsTag, - const CFX_WideStringC& wsName) { - CXML_Element* pDatePattern = NULL; - int32_t nCount = pxmlElement->CountElements(bsSpace, bsTag); - int32_t i = 0; - for (; i < nCount; i++) { - pDatePattern = pxmlElement->GetElement(bsSpace, bsTag, i); - if (pDatePattern->GetAttrValue("name") == wsName) { - break; - } - } - if (i < nCount && pDatePattern) { - return pDatePattern->GetContent(0); - } - return L""; -} -void CFX_Locale::GetNumbericSymbol(FX_LOCALENUMSYMBOL eType, - CFX_WideString& wsNumSymbol) const { - if (!m_pElement) { - return; - } - CFX_ByteString bsSpace; - CFX_WideString wsName = gs_LocalNumberSymbols[eType]; - CXML_Element* pNumberSymbols = - m_pElement->GetElement(bsSpace.AsStringC(), "numberSymbols"); - if (!pNumberSymbols) { - return; - } - wsNumSymbol = FX_GetXMLContent(bsSpace.AsStringC(), pNumberSymbols, - "numberSymbol", wsName.AsStringC()); -} -void CFX_Locale::GetDateTimeSymbols(CFX_WideString& wsDtSymbol) const { - if (!m_pElement) { - return; - } - CFX_ByteString bsSpace; - CXML_Element* pNumberSymbols = - m_pElement->GetElement(bsSpace.AsStringC(), "dateTimeSymbols"); - if (!pNumberSymbols) { - return; - } - wsDtSymbol = pNumberSymbols->GetContent(0); -} -static void FX_GetCalendarSymbol(CXML_Element* pXmlElement, - const CFX_ByteString& symbol_type, - int32_t index, - FX_BOOL bAbbr, - CFX_WideString& wsName) { - CFX_ByteString bsSpace; - CFX_ByteString pstrSymbolNames = symbol_type + "Names"; - CXML_Element* pChild = - pXmlElement->GetElement(bsSpace.AsStringC(), "calendarSymbols"); - if (!pChild) { - return; - } - CXML_Element* pSymbolNames = - pChild->GetElement(bsSpace.AsStringC(), pstrSymbolNames.AsStringC()); - if (!pSymbolNames) { - return; - } - if (pSymbolNames->GetAttrInteger("abbr") != bAbbr) { - pSymbolNames = - pChild->GetElement(bsSpace.AsStringC(), pstrSymbolNames.AsStringC(), 1); - } - if (pSymbolNames && pSymbolNames->GetAttrInteger("abbr") == bAbbr) { - CXML_Element* pSymbolName = pSymbolNames->GetElement( - bsSpace.AsStringC(), symbol_type.AsStringC(), index); - if (pSymbolName) { - wsName = pSymbolName->GetContent(0); - } - } -} -void CFX_Locale::GetMonthName(int32_t nMonth, - CFX_WideString& wsMonthName, - FX_BOOL bAbbr) const { - if (!m_pElement) { - return; - } - FX_GetCalendarSymbol(m_pElement, "month", nMonth, bAbbr, wsMonthName); -} -void CFX_Locale::GetDayName(int32_t nWeek, - CFX_WideString& wsDayName, - FX_BOOL bAbbr) const { - if (!m_pElement) { - return; - } - FX_GetCalendarSymbol(m_pElement, "day", nWeek, bAbbr, wsDayName); -} -void CFX_Locale::GetMeridiemName(CFX_WideString& wsMeridiemName, - FX_BOOL bAM) const { - if (!m_pElement) { - return; - } - FX_GetCalendarSymbol(m_pElement, "meridiem", bAM ? 0 : 1, FALSE, - wsMeridiemName); -} static int32_t FX_ParseTimeZone(const FX_WCHAR* pStr, int32_t iLen, FX_TIMEZONE& tz) { @@ -198,64 +90,7 @@ static int32_t FX_ParseTimeZone(const FX_WCHAR* pStr, } return iStart; } -void CFX_Locale::GetTimeZone(FX_TIMEZONE& tz) const { - tz.tzHour = 0; - tz.tzMinute = 0; - if (!m_pElement) { - return; - } - CXML_Element* pxmlTimeZone = m_pElement->GetElement("", "timeZone"); - if (pxmlTimeZone) { - CFX_WideString wsTimeZone = pxmlTimeZone->GetContent(0); - FX_ParseTimeZone(wsTimeZone.c_str(), wsTimeZone.GetLength(), tz); - } -} -void CFX_Locale::GetEraName(CFX_WideString& wsEraName, FX_BOOL bAD) const { - if (!m_pElement) { - return; - } - FX_GetCalendarSymbol(m_pElement, "era", bAD ? 0 : 1, FALSE, wsEraName); -} -static void FX_GetPattern(CXML_Element* pXmlElement, - const CFX_ByteString& bsCategory, - const CFX_WideString& wsSubCategory, - CFX_WideString& wsPattern) { - CFX_ByteString bsSpace; - CXML_Element* pDatePatterns = pXmlElement->GetElement( - bsSpace.AsStringC(), (bsCategory + "s").AsStringC()); - if (!pDatePatterns) { - return; - } - wsPattern = - FX_GetXMLContent(bsSpace.AsStringC(), pDatePatterns, - bsCategory.AsStringC(), wsSubCategory.AsStringC()); -} -static void FX_GetDateTimePattern(CXML_Element* pXmlElement, - const CFX_ByteString& bsCategory, - FX_LOCALEDATETIMESUBCATEGORY eType, - CFX_WideString& wsPattern) { - CFX_WideString wsType = g_FXLocaleDateTimeSubCatData[eType].pName; - FX_GetPattern(pXmlElement, bsCategory, wsType, wsPattern); -} -void CFX_Locale::GetDatePattern(FX_LOCALEDATETIMESUBCATEGORY eType, - CFX_WideString& wsPattern) const { - if (!m_pElement) { - return; - } - FX_GetDateTimePattern(m_pElement, "datePattern", eType, wsPattern); -} -void CFX_Locale::GetTimePattern(FX_LOCALEDATETIMESUBCATEGORY eType, - CFX_WideString& wsPattern) const { - if (!m_pElement) { - return; - } - FX_GetDateTimePattern(m_pElement, "timePattern", eType, wsPattern); -} -void CFX_Locale::GetNumPattern(FX_LOCALENUMSUBCATEGORY eType, - CFX_WideString& wsPattern) const { - CFX_WideString wsType = g_FXLocaleNumSubCatData[eType].pName; - FX_GetPattern(m_pElement, "numberPattern", wsType, wsPattern); -} + static FX_BOOL FX_IsDigit(FX_WCHAR c) { return c >= '0' && c <= '9'; } @@ -1605,53 +1440,7 @@ FX_BOOL CFX_FormatString::ParseNum(const CFX_WideString& wsSrcNum, fValue = (FX_FLOAT)dbRetValue; return TRUE; } -void FX_ParseNumString(const CFX_WideString& wsNum, CFX_WideString& wsResult) { - int32_t iCount = wsNum.GetLength(); - const FX_WCHAR* pStr = wsNum.c_str(); - FX_WCHAR* pDst = wsResult.GetBuffer(iCount); - int32_t nIndex = 0; - FX_BOOL bMinus = FALSE; - int32_t i = 0; - for (i = 0; i < iCount; i++) { - FX_WCHAR wc = pStr[i]; - if (wc == '.') { - break; - } - if ((wc == L'0' || wc == L' ' || wc == '+') && nIndex == 0) { - continue; - } - if (wc == '-') { - pDst[nIndex++] = wc; - bMinus = TRUE; - continue; - } - if (wc == L'0' && nIndex == 1 && bMinus) { - continue; - } - pDst[nIndex++] = wc; - } - if (bMinus && nIndex == 1) { - pDst[nIndex++] = '0'; - } - if (nIndex == 0) { - wsResult.ReleaseBuffer(0); - pDst = wsResult.GetBuffer(iCount + 1); - pDst[nIndex++] = '0'; - } - int32_t j = 0; - for (j = iCount - 1; j > i; j--) { - FX_WCHAR wc = pStr[j]; - if (wc != L'0' && wc != L' ') { - break; - } - } - if (j > i) { - pDst[nIndex++] = '.'; - FXSYS_wcsncpy(pDst + nIndex, pStr + i + 1, j - i); - nIndex += j - i; - } - wsResult.ReleaseBuffer(nIndex); -} + FX_BOOL CFX_FormatString::ParseNum(const CFX_WideString& wsSrcNum, const CFX_WideString& wsPattern, CFX_WideString& wsValue) { |