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

Side by Side Diff: xfa/fxfa/parser/xfa_locale.cpp

Issue 1862123003: Rename both As{Byte,Wide}StringC() helpers to AsStringC(). (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Rebase, fix new usage. 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/fxfa/parser/xfa_layout_pagemgr_new.cpp ('k') | xfa/fxfa/parser/xfa_localemgr.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 "xfa/fxfa/parser/xfa_locale.h" 7 #include "xfa/fxfa/parser/xfa_locale.h"
8 8
9 #include "core/fxcrt/include/fx_xml.h" 9 #include "core/fxcrt/include/fx_xml.h"
10 #include "xfa/fxfa/fm2js/xfa_fm2jsapi.h" 10 #include "xfa/fxfa/fm2js/xfa_fm2jsapi.h"
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 bsSymbols = "currencySymbols"; 65 bsSymbols = "currencySymbols";
66 wsName = FX_WSTRC(L"symbol"); 66 wsName = FX_WSTRC(L"symbol");
67 break; 67 break;
68 case FX_LOCALENUMSYMBOL_CurrencyName: 68 case FX_LOCALENUMSYMBOL_CurrencyName:
69 bsSymbols = "currencySymbols"; 69 bsSymbols = "currencySymbols";
70 wsName = FX_WSTRC(L"isoname"); 70 wsName = FX_WSTRC(L"isoname");
71 break; 71 break;
72 default: 72 default:
73 return; 73 return;
74 } 74 }
75 CXML_Element* pElement = 75 CXML_Element* pElement = m_pLocaleData->GetElement("", bsSymbols.AsStringC());
76 m_pLocaleData->GetElement("", bsSymbols.AsByteStringC());
77 if (!pElement) { 76 if (!pElement) {
78 return; 77 return;
79 } 78 }
80 GetPattern(pElement, CFX_ByteStringC((const FX_CHAR*)bsSymbols, 79 GetPattern(pElement, CFX_ByteStringC((const FX_CHAR*)bsSymbols,
81 bsSymbols.GetLength() - 1), 80 bsSymbols.GetLength() - 1),
82 wsName.AsWideStringC(), wsNumSymbol); 81 wsName.AsStringC(), wsNumSymbol);
83 } 82 }
84 void CXFA_XMLLocale::GetDateTimeSymbols(CFX_WideString& wsDtSymbol) const { 83 void CXFA_XMLLocale::GetDateTimeSymbols(CFX_WideString& wsDtSymbol) const {
85 if (!m_pLocaleData) { 84 if (!m_pLocaleData) {
86 return; 85 return;
87 } 86 }
88 CFX_ByteString bsSpace; 87 CFX_ByteString bsSpace;
89 CXML_Element* pNumberSymbols = 88 CXML_Element* pNumberSymbols =
90 m_pLocaleData->GetElement(bsSpace.AsByteStringC(), "dateTimeSymbols"); 89 m_pLocaleData->GetElement(bsSpace.AsStringC(), "dateTimeSymbols");
91 if (!pNumberSymbols) { 90 if (!pNumberSymbols) {
92 return; 91 return;
93 } 92 }
94 wsDtSymbol = pNumberSymbols->GetContent(0); 93 wsDtSymbol = pNumberSymbols->GetContent(0);
95 } 94 }
96 void CXFA_XMLLocale::GetMonthName(int32_t nMonth, 95 void CXFA_XMLLocale::GetMonthName(int32_t nMonth,
97 CFX_WideString& wsMonthName, 96 CFX_WideString& wsMonthName,
98 FX_BOOL bAbbr) const { 97 FX_BOOL bAbbr) const {
99 wsMonthName = GetCalendarSymbol("month", nMonth, bAbbr); 98 wsMonthName = GetCalendarSymbol("month", nMonth, bAbbr);
100 } 99 }
(...skipping 14 matching lines...) Expand all
115 } 114 }
116 CFX_WideString CXFA_XMLLocale::GetCalendarSymbol(const CFX_ByteStringC& symbol, 115 CFX_WideString CXFA_XMLLocale::GetCalendarSymbol(const CFX_ByteStringC& symbol,
117 int index, 116 int index,
118 FX_BOOL bAbbr) const { 117 FX_BOOL bAbbr) const {
119 CFX_ByteString pstrSymbolNames = symbol + "Names"; 118 CFX_ByteString pstrSymbolNames = symbol + "Names";
120 CFX_WideString wsSymbolName = L""; 119 CFX_WideString wsSymbolName = L"";
121 if (m_pLocaleData) { 120 if (m_pLocaleData) {
122 CXML_Element* pChild = m_pLocaleData->GetElement("", "calendarSymbols"); 121 CXML_Element* pChild = m_pLocaleData->GetElement("", "calendarSymbols");
123 if (pChild) { 122 if (pChild) {
124 CXML_Element* pSymbolNames = 123 CXML_Element* pSymbolNames =
125 pChild->GetElement("", pstrSymbolNames.AsByteStringC()); 124 pChild->GetElement("", pstrSymbolNames.AsStringC());
126 if (pSymbolNames) { 125 if (pSymbolNames) {
127 if (pSymbolNames->GetAttrInteger("abbr") != bAbbr) { 126 if (pSymbolNames->GetAttrInteger("abbr") != bAbbr) {
128 pSymbolNames = 127 pSymbolNames = pChild->GetElement("", pstrSymbolNames.AsStringC(), 1);
129 pChild->GetElement("", pstrSymbolNames.AsByteStringC(), 1);
130 } 128 }
131 if (pSymbolNames && pSymbolNames->GetAttrInteger("abbr") == bAbbr) { 129 if (pSymbolNames && pSymbolNames->GetAttrInteger("abbr") == bAbbr) {
132 CXML_Element* pSymbolName = 130 CXML_Element* pSymbolName =
133 pSymbolNames->GetElement("", symbol, index); 131 pSymbolNames->GetElement("", symbol, index);
134 if (pSymbolName) { 132 if (pSymbolName) {
135 wsSymbolName = pSymbolName->GetContent(0); 133 wsSymbolName = pSymbolName->GetContent(0);
136 } 134 }
137 } 135 }
138 } 136 }
139 } 137 }
(...skipping 15 matching lines...) Expand all
155 case FX_LOCALEDATETIMESUBCATEGORY_Medium: 153 case FX_LOCALEDATETIMESUBCATEGORY_Medium:
156 wsName = L"med"; 154 wsName = L"med";
157 break; 155 break;
158 case FX_LOCALEDATETIMESUBCATEGORY_Full: 156 case FX_LOCALEDATETIMESUBCATEGORY_Full:
159 wsName = L"full"; 157 wsName = L"full";
160 break; 158 break;
161 case FX_LOCALEDATETIMESUBCATEGORY_Long: 159 case FX_LOCALEDATETIMESUBCATEGORY_Long:
162 wsName = L"long"; 160 wsName = L"long";
163 break; 161 break;
164 } 162 }
165 GetPattern(pElement, "datePattern", wsName.AsWideStringC(), wsPattern); 163 GetPattern(pElement, "datePattern", wsName.AsStringC(), wsPattern);
166 } 164 }
167 void CXFA_XMLLocale::GetTimePattern(FX_LOCALEDATETIMESUBCATEGORY eType, 165 void CXFA_XMLLocale::GetTimePattern(FX_LOCALEDATETIMESUBCATEGORY eType,
168 CFX_WideString& wsPattern) const { 166 CFX_WideString& wsPattern) const {
169 CXML_Element* pElement = m_pLocaleData->GetElement("", "timePatterns"); 167 CXML_Element* pElement = m_pLocaleData->GetElement("", "timePatterns");
170 if (pElement == NULL) { 168 if (pElement == NULL) {
171 return; 169 return;
172 } 170 }
173 CFX_WideString wsName; 171 CFX_WideString wsName;
174 switch (eType) { 172 switch (eType) {
175 case FX_LOCALEDATETIMESUBCATEGORY_Short: 173 case FX_LOCALEDATETIMESUBCATEGORY_Short:
176 wsName = L"short"; 174 wsName = L"short";
177 break; 175 break;
178 case FX_LOCALEDATETIMESUBCATEGORY_Default: 176 case FX_LOCALEDATETIMESUBCATEGORY_Default:
179 case FX_LOCALEDATETIMESUBCATEGORY_Medium: 177 case FX_LOCALEDATETIMESUBCATEGORY_Medium:
180 wsName = L"med"; 178 wsName = L"med";
181 break; 179 break;
182 case FX_LOCALEDATETIMESUBCATEGORY_Full: 180 case FX_LOCALEDATETIMESUBCATEGORY_Full:
183 wsName = L"full"; 181 wsName = L"full";
184 break; 182 break;
185 case FX_LOCALEDATETIMESUBCATEGORY_Long: 183 case FX_LOCALEDATETIMESUBCATEGORY_Long:
186 wsName = L"long"; 184 wsName = L"long";
187 break; 185 break;
188 } 186 }
189 GetPattern(pElement, "timePattern", wsName.AsWideStringC(), wsPattern); 187 GetPattern(pElement, "timePattern", wsName.AsStringC(), wsPattern);
190 } 188 }
191 void CXFA_XMLLocale::GetNumPattern(FX_LOCALENUMSUBCATEGORY eType, 189 void CXFA_XMLLocale::GetNumPattern(FX_LOCALENUMSUBCATEGORY eType,
192 CFX_WideString& wsPattern) const { 190 CFX_WideString& wsPattern) const {
193 CXML_Element* pElement = m_pLocaleData->GetElement("", "numberPatterns"); 191 CXML_Element* pElement = m_pLocaleData->GetElement("", "numberPatterns");
194 if (pElement == NULL) { 192 if (pElement == NULL) {
195 return; 193 return;
196 } 194 }
197 switch (eType) { 195 switch (eType) {
198 case FX_LOCALENUMPATTERN_Percent: 196 case FX_LOCALENUMPATTERN_Percent:
199 wsPattern = g_FX_Percent; 197 wsPattern = g_FX_Percent;
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
369 CXFA_Node* pNode = pCalendar->GetFirstChildByClass(eElement); 367 CXFA_Node* pNode = pCalendar->GetFirstChildByClass(eElement);
370 for (; pNode; pNode = pNode->GetNextSameClassSibling(eElement)) { 368 for (; pNode; pNode = pNode->GetNextSameClassSibling(eElement)) {
371 if (pNode->GetBoolean(XFA_ATTRIBUTE_Abbr) == bAbbr) { 369 if (pNode->GetBoolean(XFA_ATTRIBUTE_Abbr) == bAbbr) {
372 CXFA_Node* pSymbol = pNode->GetChild(index, XFA_ELEMENT_UNKNOWN); 370 CXFA_Node* pSymbol = pNode->GetChild(index, XFA_ELEMENT_UNKNOWN);
373 return pSymbol ? pSymbol->GetContent() : CFX_WideString(); 371 return pSymbol ? pSymbol->GetContent() : CFX_WideString();
374 } 372 }
375 } 373 }
376 } 374 }
377 return CFX_WideString(); 375 return CFX_WideString();
378 } 376 }
OLDNEW
« no previous file with comments | « xfa/fxfa/parser/xfa_layout_pagemgr_new.cpp ('k') | xfa/fxfa/parser/xfa_localemgr.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698