Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(98)

Side by Side Diff: xfa/src/fgas/src/localization/fx_locale.cpp

Issue 1422113003: Fix XFA compilation noise, part 1. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@xfa
Patch Set: Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 PDFium Authors. All rights reserved. 1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 6
7 #include "../../../../../core/include/fxcrt/fx_xml.h" 7 #include "../../../../../core/include/fxcrt/fx_xml.h"
8 #include "../fgas_base.h" 8 #include "../fgas_base.h"
9 #include "fx_localeimp.h" 9 #include "fx_localeimp.h"
10 10
(...skipping 917 matching lines...) Expand 10 before | Expand all | Expand 10 after
928 return TRUE; 928 return TRUE;
929 } 929 }
930 FX_BOOL CFX_FormatString::ParseText(const CFX_WideString& wsSrcText, 930 FX_BOOL CFX_FormatString::ParseText(const CFX_WideString& wsSrcText,
931 const CFX_WideString& wsPattern, 931 const CFX_WideString& wsPattern,
932 CFX_WideString& wsValue) { 932 CFX_WideString& wsValue) {
933 wsValue.Empty(); 933 wsValue.Empty();
934 if (wsSrcText.IsEmpty() || wsPattern.IsEmpty()) { 934 if (wsSrcText.IsEmpty() || wsPattern.IsEmpty()) {
935 return FALSE; 935 return FALSE;
936 } 936 }
937 CFX_WideString wsTextFormat; 937 CFX_WideString wsTextFormat;
938 IFX_Locale* pLocale = 938 GetTextFormat(wsPattern, FX_WSTRC(L"text"), wsTextFormat);
939 GetTextFormat(wsPattern, FX_WSTRC(L"text"), wsTextFormat);
940 if (wsTextFormat.IsEmpty()) { 939 if (wsTextFormat.IsEmpty()) {
941 return FALSE; 940 return FALSE;
942 } 941 }
943 int32_t iText = 0, iPattern = 0; 942 int32_t iText = 0, iPattern = 0;
944 const FX_WCHAR* pStrText = (const FX_WCHAR*)wsSrcText; 943 const FX_WCHAR* pStrText = (const FX_WCHAR*)wsSrcText;
945 int32_t iLenText = wsSrcText.GetLength(); 944 int32_t iLenText = wsSrcText.GetLength();
946 const FX_WCHAR* pStrPattern = (const FX_WCHAR*)wsTextFormat; 945 const FX_WCHAR* pStrPattern = (const FX_WCHAR*)wsTextFormat;
947 int32_t iLenPattern = wsTextFormat.GetLength(); 946 int32_t iLenPattern = wsTextFormat.GetLength();
948 while (iPattern < iLenPattern && iText < iLenText) { 947 while (iPattern < iLenPattern && iText < iLenText) {
949 switch (pStrPattern[iPattern]) { 948 switch (pStrPattern[iPattern]) {
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
1011 FX_DWORD dwFormatStyle = 0; 1010 FX_DWORD dwFormatStyle = 0;
1012 CFX_WideString wsNumFormat; 1011 CFX_WideString wsNumFormat;
1013 IFX_Locale* pLocale = 1012 IFX_Locale* pLocale =
1014 GetNumericFormat(wsPattern, dot_index_f, dwFormatStyle, wsNumFormat); 1013 GetNumericFormat(wsPattern, dot_index_f, dwFormatStyle, wsNumFormat);
1015 if (!pLocale || wsNumFormat.IsEmpty()) { 1014 if (!pLocale || wsNumFormat.IsEmpty()) {
1016 return FALSE; 1015 return FALSE;
1017 } 1016 }
1018 int32_t iExponent = 0; 1017 int32_t iExponent = 0;
1019 CFX_WideString wsDotSymbol; 1018 CFX_WideString wsDotSymbol;
1020 pLocale->GetNumbericSymbol(FX_LOCALENUMSYMBOL_Decimal, wsDotSymbol); 1019 pLocale->GetNumbericSymbol(FX_LOCALENUMSYMBOL_Decimal, wsDotSymbol);
1021 int32_t iDotLen = wsDotSymbol.GetLength();
1022 CFX_WideString wsGroupSymbol; 1020 CFX_WideString wsGroupSymbol;
1023 pLocale->GetNumbericSymbol(FX_LOCALENUMSYMBOL_Grouping, wsGroupSymbol); 1021 pLocale->GetNumbericSymbol(FX_LOCALENUMSYMBOL_Grouping, wsGroupSymbol);
1024 int32_t iGroupLen = wsGroupSymbol.GetLength(); 1022 int32_t iGroupLen = wsGroupSymbol.GetLength();
1025 CFX_WideString wsMinus; 1023 CFX_WideString wsMinus;
1026 pLocale->GetNumbericSymbol(FX_LOCALENUMSYMBOL_Minus, wsMinus); 1024 pLocale->GetNumbericSymbol(FX_LOCALENUMSYMBOL_Minus, wsMinus);
1027 int32_t iMinusLen = wsMinus.GetLength(); 1025 int32_t iMinusLen = wsMinus.GetLength();
1028 int cc = 0, ccf = 0; 1026 int cc = 0, ccf = 0;
1029 const FX_WCHAR* str = (const FX_WCHAR*)wsSrcNum; 1027 const FX_WCHAR* str = (const FX_WCHAR*)wsSrcNum;
1030 int len = wsSrcNum.GetLength(); 1028 int len = wsSrcNum.GetLength();
1031 const FX_WCHAR* strf = (const FX_WCHAR*)wsNumFormat; 1029 const FX_WCHAR* strf = (const FX_WCHAR*)wsNumFormat;
(...skipping 746 matching lines...) Expand 10 before | Expand all | Expand 10 after
1778 FX_DWORD dwFormatStyle = 0; 1776 FX_DWORD dwFormatStyle = 0;
1779 CFX_WideString wsNumFormat; 1777 CFX_WideString wsNumFormat;
1780 IFX_Locale* pLocale = 1778 IFX_Locale* pLocale =
1781 GetNumericFormat(wsPattern, dot_index_f, dwFormatStyle, wsNumFormat); 1779 GetNumericFormat(wsPattern, dot_index_f, dwFormatStyle, wsNumFormat);
1782 if (!pLocale || wsNumFormat.IsEmpty()) { 1780 if (!pLocale || wsNumFormat.IsEmpty()) {
1783 return FALSE; 1781 return FALSE;
1784 } 1782 }
1785 int32_t iExponent = 0; 1783 int32_t iExponent = 0;
1786 CFX_WideString wsDotSymbol; 1784 CFX_WideString wsDotSymbol;
1787 pLocale->GetNumbericSymbol(FX_LOCALENUMSYMBOL_Decimal, wsDotSymbol); 1785 pLocale->GetNumbericSymbol(FX_LOCALENUMSYMBOL_Decimal, wsDotSymbol);
1788 int32_t iDotLen = wsDotSymbol.GetLength();
1789 CFX_WideString wsGroupSymbol; 1786 CFX_WideString wsGroupSymbol;
1790 pLocale->GetNumbericSymbol(FX_LOCALENUMSYMBOL_Grouping, wsGroupSymbol); 1787 pLocale->GetNumbericSymbol(FX_LOCALENUMSYMBOL_Grouping, wsGroupSymbol);
1791 int32_t iGroupLen = wsGroupSymbol.GetLength(); 1788 int32_t iGroupLen = wsGroupSymbol.GetLength();
1792 CFX_WideString wsMinus; 1789 CFX_WideString wsMinus;
1793 pLocale->GetNumbericSymbol(FX_LOCALENUMSYMBOL_Minus, wsMinus); 1790 pLocale->GetNumbericSymbol(FX_LOCALENUMSYMBOL_Minus, wsMinus);
1794 int32_t iMinusLen = wsMinus.GetLength(); 1791 int32_t iMinusLen = wsMinus.GetLength();
1795 int cc = 0, ccf = 0; 1792 int cc = 0, ccf = 0;
1796 const FX_WCHAR* str = (const FX_WCHAR*)wsSrcNum; 1793 const FX_WCHAR* str = (const FX_WCHAR*)wsSrcNum;
1797 int len = wsSrcNum.GetLength(); 1794 int len = wsSrcNum.GetLength();
1798 const FX_WCHAR* strf = (const FX_WCHAR*)wsNumFormat; 1795 const FX_WCHAR* strf = (const FX_WCHAR*)wsNumFormat;
(...skipping 1058 matching lines...) Expand 10 before | Expand all | Expand 10 after
2857 !FX_ParseLocaleTime(wsSrcDateTime, wsTimePattern, pLocale, dtValue, 2854 !FX_ParseLocaleTime(wsSrcDateTime, wsTimePattern, pLocale, dtValue,
2858 iStart)) { 2855 iStart)) {
2859 return FALSE; 2856 return FALSE;
2860 } 2857 }
2861 } 2858 }
2862 return TRUE; 2859 return TRUE;
2863 } 2860 }
2864 FX_BOOL CFX_FormatString::ParseZero(const CFX_WideString& wsSrcText, 2861 FX_BOOL CFX_FormatString::ParseZero(const CFX_WideString& wsSrcText,
2865 const CFX_WideString& wsPattern) { 2862 const CFX_WideString& wsPattern) {
2866 CFX_WideString wsTextFormat; 2863 CFX_WideString wsTextFormat;
2867 IFX_Locale* pLocale = 2864 GetTextFormat(wsPattern, FX_WSTRC(L"zero"), wsTextFormat);
2868 GetTextFormat(wsPattern, FX_WSTRC(L"zero"), wsTextFormat);
2869 int32_t iText = 0, iPattern = 0; 2865 int32_t iText = 0, iPattern = 0;
2870 const FX_WCHAR* pStrText = (const FX_WCHAR*)wsSrcText; 2866 const FX_WCHAR* pStrText = (const FX_WCHAR*)wsSrcText;
2871 int32_t iLenText = wsSrcText.GetLength(); 2867 int32_t iLenText = wsSrcText.GetLength();
2872 const FX_WCHAR* pStrPattern = (const FX_WCHAR*)wsTextFormat; 2868 const FX_WCHAR* pStrPattern = (const FX_WCHAR*)wsTextFormat;
2873 int32_t iLenPattern = wsTextFormat.GetLength(); 2869 int32_t iLenPattern = wsTextFormat.GetLength();
2874 while (iPattern < iLenPattern && iText < iLenText) { 2870 while (iPattern < iLenPattern && iText < iLenText) {
2875 if (pStrPattern[iPattern] == '\'') { 2871 if (pStrPattern[iPattern] == '\'') {
2876 CFX_WideString wsLiteral = 2872 CFX_WideString wsLiteral =
2877 FX_GetLiteralText(pStrPattern, iPattern, iLenPattern); 2873 FX_GetLiteralText(pStrPattern, iPattern, iLenPattern);
2878 int32_t iLiteralLen = wsLiteral.GetLength(); 2874 int32_t iLiteralLen = wsLiteral.GetLength();
(...skipping 10 matching lines...) Expand all
2889 } else { 2885 } else {
2890 iText++; 2886 iText++;
2891 iPattern++; 2887 iPattern++;
2892 } 2888 }
2893 } 2889 }
2894 return iPattern == iLenPattern && iText == iLenText; 2890 return iPattern == iLenPattern && iText == iLenText;
2895 } 2891 }
2896 FX_BOOL CFX_FormatString::ParseNull(const CFX_WideString& wsSrcText, 2892 FX_BOOL CFX_FormatString::ParseNull(const CFX_WideString& wsSrcText,
2897 const CFX_WideString& wsPattern) { 2893 const CFX_WideString& wsPattern) {
2898 CFX_WideString wsTextFormat; 2894 CFX_WideString wsTextFormat;
2899 IFX_Locale* pLocale = 2895 GetTextFormat(wsPattern, FX_WSTRC(L"null"), wsTextFormat);
2900 GetTextFormat(wsPattern, FX_WSTRC(L"null"), wsTextFormat);
2901 int32_t iText = 0, iPattern = 0; 2896 int32_t iText = 0, iPattern = 0;
2902 const FX_WCHAR* pStrText = (const FX_WCHAR*)wsSrcText; 2897 const FX_WCHAR* pStrText = (const FX_WCHAR*)wsSrcText;
2903 int32_t iLenText = wsSrcText.GetLength(); 2898 int32_t iLenText = wsSrcText.GetLength();
2904 const FX_WCHAR* pStrPattern = (const FX_WCHAR*)wsTextFormat; 2899 const FX_WCHAR* pStrPattern = (const FX_WCHAR*)wsTextFormat;
2905 int32_t iLenPattern = wsTextFormat.GetLength(); 2900 int32_t iLenPattern = wsTextFormat.GetLength();
2906 while (iPattern < iLenPattern && iText < iLenText) { 2901 while (iPattern < iLenPattern && iText < iLenText) {
2907 if (pStrPattern[iPattern] == '\'') { 2902 if (pStrPattern[iPattern] == '\'') {
2908 CFX_WideString wsLiteral = 2903 CFX_WideString wsLiteral =
2909 FX_GetLiteralText(pStrPattern, iPattern, iLenPattern); 2904 FX_GetLiteralText(pStrPattern, iPattern, iLenPattern);
2910 int32_t iLiteralLen = wsLiteral.GetLength(); 2905 int32_t iLiteralLen = wsLiteral.GetLength();
(...skipping 18 matching lines...) Expand all
2929 const CFX_WideString& wsPattern, 2924 const CFX_WideString& wsPattern,
2930 CFX_WideString& wsOutput) { 2925 CFX_WideString& wsOutput) {
2931 if (wsPattern.IsEmpty()) { 2926 if (wsPattern.IsEmpty()) {
2932 return FALSE; 2927 return FALSE;
2933 } 2928 }
2934 int32_t iLenText = wsSrcText.GetLength(); 2929 int32_t iLenText = wsSrcText.GetLength();
2935 if (iLenText == 0) { 2930 if (iLenText == 0) {
2936 return FALSE; 2931 return FALSE;
2937 } 2932 }
2938 CFX_WideString wsTextFormat; 2933 CFX_WideString wsTextFormat;
2939 IFX_Locale* pLocale = 2934 GetTextFormat(wsPattern, FX_WSTRC(L"text"), wsTextFormat);
2940 GetTextFormat(wsPattern, FX_WSTRC(L"text"), wsTextFormat);
2941 int32_t iText = 0, iPattern = 0; 2935 int32_t iText = 0, iPattern = 0;
2942 const FX_WCHAR* pStrText = (const FX_WCHAR*)wsSrcText; 2936 const FX_WCHAR* pStrText = (const FX_WCHAR*)wsSrcText;
2943 const FX_WCHAR* pStrPattern = (const FX_WCHAR*)wsTextFormat; 2937 const FX_WCHAR* pStrPattern = (const FX_WCHAR*)wsTextFormat;
2944 int32_t iLenPattern = wsTextFormat.GetLength(); 2938 int32_t iLenPattern = wsTextFormat.GetLength();
2945 while (iPattern < iLenPattern) { 2939 while (iPattern < iLenPattern) {
2946 switch (pStrPattern[iPattern]) { 2940 switch (pStrPattern[iPattern]) {
2947 case '\'': { 2941 case '\'': {
2948 wsOutput += FX_GetLiteralText(pStrPattern, iPattern, iLenPattern); 2942 wsOutput += FX_GetLiteralText(pStrPattern, iPattern, iLenPattern);
2949 iPattern++; 2943 iPattern++;
2950 break; 2944 break;
(...skipping 1483 matching lines...) Expand 10 before | Expand all | Expand 10 after
4434 return FX_FormatDateTime(dt, wsPattern, wsTimePattern, 4428 return FX_FormatDateTime(dt, wsPattern, wsTimePattern,
4435 eCategory != FX_DATETIMETYPE_TimeDate, pLocale, 4429 eCategory != FX_DATETIMETYPE_TimeDate, pLocale,
4436 wsOutput); 4430 wsOutput);
4437 } 4431 }
4438 FX_BOOL CFX_FormatString::FormatZero(const CFX_WideString& wsPattern, 4432 FX_BOOL CFX_FormatString::FormatZero(const CFX_WideString& wsPattern,
4439 CFX_WideString& wsOutput) { 4433 CFX_WideString& wsOutput) {
4440 if (wsPattern.IsEmpty()) { 4434 if (wsPattern.IsEmpty()) {
4441 return FALSE; 4435 return FALSE;
4442 } 4436 }
4443 CFX_WideString wsTextFormat; 4437 CFX_WideString wsTextFormat;
4444 IFX_Locale* pLocale = 4438 GetTextFormat(wsPattern, FX_WSTRC(L"zero"), wsTextFormat);
4445 GetTextFormat(wsPattern, FX_WSTRC(L"zero"), wsTextFormat);
4446 int32_t iPattern = 0; 4439 int32_t iPattern = 0;
4447 const FX_WCHAR* pStrPattern = (const FX_WCHAR*)wsTextFormat; 4440 const FX_WCHAR* pStrPattern = (const FX_WCHAR*)wsTextFormat;
4448 int32_t iLenPattern = wsTextFormat.GetLength(); 4441 int32_t iLenPattern = wsTextFormat.GetLength();
4449 while (iPattern < iLenPattern) { 4442 while (iPattern < iLenPattern) {
4450 if (pStrPattern[iPattern] == '\'') { 4443 if (pStrPattern[iPattern] == '\'') {
4451 wsOutput += FX_GetLiteralText(pStrPattern, iPattern, iLenPattern); 4444 wsOutput += FX_GetLiteralText(pStrPattern, iPattern, iLenPattern);
4452 iPattern++; 4445 iPattern++;
4453 continue; 4446 continue;
4454 } else { 4447 } else {
4455 wsOutput += pStrPattern[iPattern++]; 4448 wsOutput += pStrPattern[iPattern++];
4456 continue; 4449 continue;
4457 } 4450 }
4458 } 4451 }
4459 return TRUE; 4452 return TRUE;
4460 } 4453 }
4461 FX_BOOL CFX_FormatString::FormatNull(const CFX_WideString& wsPattern, 4454 FX_BOOL CFX_FormatString::FormatNull(const CFX_WideString& wsPattern,
4462 CFX_WideString& wsOutput) { 4455 CFX_WideString& wsOutput) {
4463 if (wsPattern.IsEmpty()) { 4456 if (wsPattern.IsEmpty()) {
4464 return FALSE; 4457 return FALSE;
4465 } 4458 }
4466 CFX_WideString wsTextFormat; 4459 CFX_WideString wsTextFormat;
4467 IFX_Locale* pLocale = 4460 GetTextFormat(wsPattern, FX_WSTRC(L"null"), wsTextFormat);
4468 GetTextFormat(wsPattern, FX_WSTRC(L"null"), wsTextFormat);
4469 int32_t iPattern = 0; 4461 int32_t iPattern = 0;
4470 const FX_WCHAR* pStrPattern = (const FX_WCHAR*)wsTextFormat; 4462 const FX_WCHAR* pStrPattern = (const FX_WCHAR*)wsTextFormat;
4471 int32_t iLenPattern = wsTextFormat.GetLength(); 4463 int32_t iLenPattern = wsTextFormat.GetLength();
4472 while (iPattern < iLenPattern) { 4464 while (iPattern < iLenPattern) {
4473 if (pStrPattern[iPattern] == '\'') { 4465 if (pStrPattern[iPattern] == '\'') {
4474 wsOutput += FX_GetLiteralText(pStrPattern, iPattern, iLenPattern); 4466 wsOutput += FX_GetLiteralText(pStrPattern, iPattern, iLenPattern);
4475 iPattern++; 4467 iPattern++;
4476 continue; 4468 continue;
4477 } else { 4469 } else {
4478 wsOutput += pStrPattern[iPattern++]; 4470 wsOutput += pStrPattern[iPattern++];
(...skipping 646 matching lines...) Expand 10 before | Expand all | Expand 10 after
5125 } 5117 }
5126 CFX_Decimal CFX_Decimal::operator*(const CFX_Decimal& val) const { 5118 CFX_Decimal CFX_Decimal::operator*(const CFX_Decimal& val) const {
5127 return Multiply(val); 5119 return Multiply(val);
5128 } 5120 }
5129 CFX_Decimal CFX_Decimal::operator/(const CFX_Decimal& val) const { 5121 CFX_Decimal CFX_Decimal::operator/(const CFX_Decimal& val) const {
5130 return Divide(val); 5122 return Divide(val);
5131 } 5123 }
5132 CFX_Decimal CFX_Decimal::operator%(const CFX_Decimal& val) const { 5124 CFX_Decimal CFX_Decimal::operator%(const CFX_Decimal& val) const {
5133 return Modulus(val); 5125 return Modulus(val);
5134 } 5126 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698