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

Side by Side Diff: xfa/fgas/localization/fgas_locale.cpp

Issue 1853233002: Make down-conversion explicit from CFX_ByteString to CFX_ByteStringC. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Fix CPDF_Name::GetConstString() Created 4 years, 8 months 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
« no previous file with comments | « xfa/fee/fde_txtedtengine.cpp ('k') | xfa/fwl/basewidget/fwl_editimp.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <algorithm> 7 #include <algorithm>
8 8
9 #include "core/fxcrt/include/fx_ext.h" 9 #include "core/fxcrt/include/fx_ext.h"
10 #include "core/fxcrt/include/fx_xml.h" 10 #include "core/fxcrt/include/fx_xml.h"
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 return L""; 104 return L"";
105 } 105 }
106 void CFX_Locale::GetNumbericSymbol(FX_LOCALENUMSYMBOL eType, 106 void CFX_Locale::GetNumbericSymbol(FX_LOCALENUMSYMBOL eType,
107 CFX_WideString& wsNumSymbol) const { 107 CFX_WideString& wsNumSymbol) const {
108 if (!m_pElement) { 108 if (!m_pElement) {
109 return; 109 return;
110 } 110 }
111 CFX_ByteString bsSpace; 111 CFX_ByteString bsSpace;
112 CFX_WideString wsName = gs_LocalNumberSymbols[eType]; 112 CFX_WideString wsName = gs_LocalNumberSymbols[eType];
113 CXML_Element* pNumberSymbols = 113 CXML_Element* pNumberSymbols =
114 m_pElement->GetElement(bsSpace, "numberSymbols"); 114 m_pElement->GetElement(bsSpace.AsByteStringC(), "numberSymbols");
115 if (!pNumberSymbols) { 115 if (!pNumberSymbols) {
116 return; 116 return;
117 } 117 }
118 wsNumSymbol = 118 wsNumSymbol = FX_GetXMLContent(bsSpace.AsByteStringC(), pNumberSymbols,
119 FX_GetXMLContent(bsSpace, pNumberSymbols, "numberSymbol", wsName); 119 "numberSymbol", wsName);
120 } 120 }
121 void CFX_Locale::GetDateTimeSymbols(CFX_WideString& wsDtSymbol) const { 121 void CFX_Locale::GetDateTimeSymbols(CFX_WideString& wsDtSymbol) const {
122 if (!m_pElement) { 122 if (!m_pElement) {
123 return; 123 return;
124 } 124 }
125 CFX_ByteString bsSpace; 125 CFX_ByteString bsSpace;
126 CXML_Element* pNumberSymbols = 126 CXML_Element* pNumberSymbols =
127 m_pElement->GetElement(bsSpace, "dateTimeSymbols"); 127 m_pElement->GetElement(bsSpace.AsByteStringC(), "dateTimeSymbols");
128 if (!pNumberSymbols) { 128 if (!pNumberSymbols) {
129 return; 129 return;
130 } 130 }
131 wsDtSymbol = pNumberSymbols->GetContent(0); 131 wsDtSymbol = pNumberSymbols->GetContent(0);
132 } 132 }
133 static void FX_GetCalendarSymbol(CXML_Element* pXmlElement, 133 static void FX_GetCalendarSymbol(CXML_Element* pXmlElement,
134 const CFX_ByteString& symbol_type, 134 const CFX_ByteString& symbol_type,
135 int32_t index, 135 int32_t index,
136 FX_BOOL bAbbr, 136 FX_BOOL bAbbr,
137 CFX_WideString& wsName) { 137 CFX_WideString& wsName) {
138 CFX_ByteString bsSpace; 138 CFX_ByteString bsSpace;
139 CFX_ByteString pstrSymbolNames = symbol_type + "Names"; 139 CFX_ByteString pstrSymbolNames = symbol_type + "Names";
140 CXML_Element* pChild = pXmlElement->GetElement(bsSpace, "calendarSymbols"); 140 CXML_Element* pChild =
141 pXmlElement->GetElement(bsSpace.AsByteStringC(), "calendarSymbols");
141 if (!pChild) { 142 if (!pChild) {
142 return; 143 return;
143 } 144 }
144 CXML_Element* pSymbolNames = pChild->GetElement(bsSpace, pstrSymbolNames); 145 CXML_Element* pSymbolNames = pChild->GetElement(
146 bsSpace.AsByteStringC(), pstrSymbolNames.AsByteStringC());
145 if (!pSymbolNames) { 147 if (!pSymbolNames) {
146 return; 148 return;
147 } 149 }
148 if (pSymbolNames->GetAttrInteger("abbr") != bAbbr) { 150 if (pSymbolNames->GetAttrInteger("abbr") != bAbbr) {
149 pSymbolNames = pChild->GetElement(bsSpace, pstrSymbolNames, 1); 151 pSymbolNames = pChild->GetElement(bsSpace.AsByteStringC(),
152 pstrSymbolNames.AsByteStringC(), 1);
150 } 153 }
151 if (pSymbolNames && pSymbolNames->GetAttrInteger("abbr") == bAbbr) { 154 if (pSymbolNames && pSymbolNames->GetAttrInteger("abbr") == bAbbr) {
152 CXML_Element* pSymbolName = 155 CXML_Element* pSymbolName = pSymbolNames->GetElement(
153 pSymbolNames->GetElement(bsSpace, symbol_type, index); 156 bsSpace.AsByteStringC(), symbol_type.AsByteStringC(), index);
154 if (pSymbolName) { 157 if (pSymbolName) {
155 wsName = pSymbolName->GetContent(0); 158 wsName = pSymbolName->GetContent(0);
156 } 159 }
157 } 160 }
158 } 161 }
159 void CFX_Locale::GetMonthName(int32_t nMonth, 162 void CFX_Locale::GetMonthName(int32_t nMonth,
160 CFX_WideString& wsMonthName, 163 CFX_WideString& wsMonthName,
161 FX_BOOL bAbbr) const { 164 FX_BOOL bAbbr) const {
162 if (!m_pElement) { 165 if (!m_pElement) {
163 return; 166 return;
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 if (!m_pElement) { 224 if (!m_pElement) {
222 return; 225 return;
223 } 226 }
224 FX_GetCalendarSymbol(m_pElement, "era", bAD ? 0 : 1, FALSE, wsEraName); 227 FX_GetCalendarSymbol(m_pElement, "era", bAD ? 0 : 1, FALSE, wsEraName);
225 } 228 }
226 static void FX_GetPattern(CXML_Element* pXmlElement, 229 static void FX_GetPattern(CXML_Element* pXmlElement,
227 const CFX_ByteString& bsCategory, 230 const CFX_ByteString& bsCategory,
228 const CFX_WideString& wsSubCategory, 231 const CFX_WideString& wsSubCategory,
229 CFX_WideString& wsPattern) { 232 CFX_WideString& wsPattern) {
230 CFX_ByteString bsSpace; 233 CFX_ByteString bsSpace;
231 CXML_Element* pDatePatterns = 234 CXML_Element* pDatePatterns = pXmlElement->GetElement(
232 pXmlElement->GetElement(bsSpace, bsCategory + "s"); 235 bsSpace.AsByteStringC(), (bsCategory + "s").AsByteStringC());
233 if (!pDatePatterns) { 236 if (!pDatePatterns) {
234 return; 237 return;
235 } 238 }
236 wsPattern = 239 wsPattern = FX_GetXMLContent(bsSpace.AsByteStringC(), pDatePatterns,
237 FX_GetXMLContent(bsSpace, pDatePatterns, bsCategory, wsSubCategory); 240 bsCategory.AsByteStringC(), wsSubCategory);
238 } 241 }
239 static void FX_GetDateTimePattern(CXML_Element* pXmlElement, 242 static void FX_GetDateTimePattern(CXML_Element* pXmlElement,
240 const CFX_ByteString& bsCategory, 243 const CFX_ByteString& bsCategory,
241 FX_LOCALEDATETIMESUBCATEGORY eType, 244 FX_LOCALEDATETIMESUBCATEGORY eType,
242 CFX_WideString& wsPattern) { 245 CFX_WideString& wsPattern) {
243 CFX_WideString wsType = g_FXLocaleDateTimeSubCatData[eType].pName; 246 CFX_WideString wsType = g_FXLocaleDateTimeSubCatData[eType].pName;
244 FX_GetPattern(pXmlElement, bsCategory, wsType, wsPattern); 247 FX_GetPattern(pXmlElement, bsCategory, wsType, wsPattern);
245 } 248 }
246 void CFX_Locale::GetDatePattern(FX_LOCALEDATETIMESUBCATEGORY eType, 249 void CFX_Locale::GetDatePattern(FX_LOCALEDATETIMESUBCATEGORY eType,
247 CFX_WideString& wsPattern) const { 250 CFX_WideString& wsPattern) const {
(...skipping 4772 matching lines...) Expand 10 before | Expand all | Expand 10 after
5020 } 5023 }
5021 CFX_Decimal CFX_Decimal::operator*(const CFX_Decimal& val) const { 5024 CFX_Decimal CFX_Decimal::operator*(const CFX_Decimal& val) const {
5022 return Multiply(val); 5025 return Multiply(val);
5023 } 5026 }
5024 CFX_Decimal CFX_Decimal::operator/(const CFX_Decimal& val) const { 5027 CFX_Decimal CFX_Decimal::operator/(const CFX_Decimal& val) const {
5025 return Divide(val); 5028 return Divide(val);
5026 } 5029 }
5027 CFX_Decimal CFX_Decimal::operator%(const CFX_Decimal& val) const { 5030 CFX_Decimal CFX_Decimal::operator%(const CFX_Decimal& val) const {
5028 return Modulus(val); 5031 return Modulus(val);
5029 } 5032 }
OLDNEW
« no previous file with comments | « xfa/fee/fde_txtedtengine.cpp ('k') | xfa/fwl/basewidget/fwl_editimp.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698