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

Side by Side Diff: xfa/fxfa/parser/xfa_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/fxfa/fm2js/xfa_fm2jscontext.cpp ('k') | xfa/fxfa/parser/xfa_object_imp.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 = m_pLocaleData->GetElement("", bsSymbols); 75 CXML_Element* pElement =
76 m_pLocaleData->GetElement("", bsSymbols.AsByteStringC());
76 if (!pElement) { 77 if (!pElement) {
77 return; 78 return;
78 } 79 }
79 GetPattern(pElement, CFX_ByteStringC((const FX_CHAR*)bsSymbols, 80 GetPattern(pElement, CFX_ByteStringC((const FX_CHAR*)bsSymbols,
80 bsSymbols.GetLength() - 1), 81 bsSymbols.GetLength() - 1),
81 wsName, wsNumSymbol); 82 wsName, wsNumSymbol);
82 } 83 }
83 void CXFA_XMLLocale::GetDateTimeSymbols(CFX_WideString& wsDtSymbol) const { 84 void CXFA_XMLLocale::GetDateTimeSymbols(CFX_WideString& wsDtSymbol) const {
84 if (!m_pLocaleData) { 85 if (!m_pLocaleData) {
85 return; 86 return;
86 } 87 }
87 CFX_ByteString bsSpace; 88 CFX_ByteString bsSpace;
88 CXML_Element* pNumberSymbols = 89 CXML_Element* pNumberSymbols =
89 m_pLocaleData->GetElement(bsSpace, "dateTimeSymbols"); 90 m_pLocaleData->GetElement(bsSpace.AsByteStringC(), "dateTimeSymbols");
90 if (!pNumberSymbols) { 91 if (!pNumberSymbols) {
91 return; 92 return;
92 } 93 }
93 wsDtSymbol = pNumberSymbols->GetContent(0); 94 wsDtSymbol = pNumberSymbols->GetContent(0);
94 } 95 }
95 void CXFA_XMLLocale::GetMonthName(int32_t nMonth, 96 void CXFA_XMLLocale::GetMonthName(int32_t nMonth,
96 CFX_WideString& wsMonthName, 97 CFX_WideString& wsMonthName,
97 FX_BOOL bAbbr) const { 98 FX_BOOL bAbbr) const {
98 wsMonthName = GetCalendarSymbol("month", nMonth, bAbbr); 99 wsMonthName = GetCalendarSymbol("month", nMonth, bAbbr);
99 } 100 }
(...skipping 13 matching lines...) Expand all
113 wsEraName = GetCalendarSymbol("era", bAD ? 1 : 0, FALSE); 114 wsEraName = GetCalendarSymbol("era", bAD ? 1 : 0, FALSE);
114 } 115 }
115 CFX_WideString CXFA_XMLLocale::GetCalendarSymbol(const CFX_ByteStringC& symbol, 116 CFX_WideString CXFA_XMLLocale::GetCalendarSymbol(const CFX_ByteStringC& symbol,
116 int index, 117 int index,
117 FX_BOOL bAbbr) const { 118 FX_BOOL bAbbr) const {
118 CFX_ByteString pstrSymbolNames = symbol + "Names"; 119 CFX_ByteString pstrSymbolNames = symbol + "Names";
119 CFX_WideString wsSymbolName = L""; 120 CFX_WideString wsSymbolName = L"";
120 if (m_pLocaleData) { 121 if (m_pLocaleData) {
121 CXML_Element* pChild = m_pLocaleData->GetElement("", "calendarSymbols"); 122 CXML_Element* pChild = m_pLocaleData->GetElement("", "calendarSymbols");
122 if (pChild) { 123 if (pChild) {
123 CXML_Element* pSymbolNames = pChild->GetElement("", pstrSymbolNames); 124 CXML_Element* pSymbolNames =
125 pChild->GetElement("", pstrSymbolNames.AsByteStringC());
124 if (pSymbolNames) { 126 if (pSymbolNames) {
125 if (pSymbolNames->GetAttrInteger("abbr") != bAbbr) { 127 if (pSymbolNames->GetAttrInteger("abbr") != bAbbr) {
126 pSymbolNames = pChild->GetElement("", pstrSymbolNames, 1); 128 pSymbolNames =
129 pChild->GetElement("", pstrSymbolNames.AsByteStringC(), 1);
127 } 130 }
128 if (pSymbolNames && pSymbolNames->GetAttrInteger("abbr") == bAbbr) { 131 if (pSymbolNames && pSymbolNames->GetAttrInteger("abbr") == bAbbr) {
129 CXML_Element* pSymbolName = 132 CXML_Element* pSymbolName =
130 pSymbolNames->GetElement("", symbol, index); 133 pSymbolNames->GetElement("", symbol, index);
131 if (pSymbolName) { 134 if (pSymbolName) {
132 wsSymbolName = pSymbolName->GetContent(0); 135 wsSymbolName = pSymbolName->GetContent(0);
133 } 136 }
134 } 137 }
135 } 138 }
136 } 139 }
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
366 CXFA_Node* pNode = pCalendar->GetFirstChildByClass(eElement); 369 CXFA_Node* pNode = pCalendar->GetFirstChildByClass(eElement);
367 for (; pNode; pNode = pNode->GetNextSameClassSibling(eElement)) { 370 for (; pNode; pNode = pNode->GetNextSameClassSibling(eElement)) {
368 if (pNode->GetBoolean(XFA_ATTRIBUTE_Abbr) == bAbbr) { 371 if (pNode->GetBoolean(XFA_ATTRIBUTE_Abbr) == bAbbr) {
369 CXFA_Node* pSymbol = pNode->GetChild(index, XFA_ELEMENT_UNKNOWN); 372 CXFA_Node* pSymbol = pNode->GetChild(index, XFA_ELEMENT_UNKNOWN);
370 return pSymbol ? pSymbol->GetContent() : CFX_WideString(); 373 return pSymbol ? pSymbol->GetContent() : CFX_WideString();
371 } 374 }
372 } 375 }
373 } 376 }
374 return CFX_WideString(); 377 return CFX_WideString();
375 } 378 }
OLDNEW
« no previous file with comments | « xfa/fxfa/fm2js/xfa_fm2jscontext.cpp ('k') | xfa/fxfa/parser/xfa_object_imp.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698