OLD | NEW |
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 <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 CFX_WideString& wsDayName, | 96 CFX_WideString& wsDayName, |
97 bool bAbbr) const { | 97 bool bAbbr) const { |
98 wsDayName = GetCalendarSymbol("day", nWeek, bAbbr); | 98 wsDayName = GetCalendarSymbol("day", nWeek, bAbbr); |
99 } | 99 } |
100 | 100 |
101 void CXFA_XMLLocale::GetMeridiemName(CFX_WideString& wsMeridiemName, | 101 void CXFA_XMLLocale::GetMeridiemName(CFX_WideString& wsMeridiemName, |
102 bool bAM) const { | 102 bool bAM) const { |
103 wsMeridiemName = GetCalendarSymbol("meridiem", bAM ? 0 : 1, false); | 103 wsMeridiemName = GetCalendarSymbol("meridiem", bAM ? 0 : 1, false); |
104 } | 104 } |
105 | 105 |
106 void CXFA_XMLLocale::GetTimeZone(FX_TIMEZONE& tz) const { | 106 void CXFA_XMLLocale::GetTimeZone(FX_TIMEZONE* tz) const { |
107 CXFA_TimeZoneProvider::Get()->GetTimeZone(tz); | 107 CXFA_TimeZoneProvider provider; |
| 108 provider.GetTimeZone(tz); |
108 } | 109 } |
109 | 110 |
110 void CXFA_XMLLocale::GetEraName(CFX_WideString& wsEraName, bool bAD) const { | 111 void CXFA_XMLLocale::GetEraName(CFX_WideString& wsEraName, bool bAD) const { |
111 wsEraName = GetCalendarSymbol("era", bAD ? 1 : 0, false); | 112 wsEraName = GetCalendarSymbol("era", bAD ? 1 : 0, false); |
112 } | 113 } |
113 | 114 |
114 CFX_WideString CXFA_XMLLocale::GetCalendarSymbol(const CFX_ByteStringC& symbol, | 115 CFX_WideString CXFA_XMLLocale::GetCalendarSymbol(const CFX_ByteStringC& symbol, |
115 int index, | 116 int index, |
116 bool bAbbr) const { | 117 bool bAbbr) const { |
117 CFX_ByteString pstrSymbolNames = symbol + "Names"; | 118 CFX_ByteString pstrSymbolNames = symbol + "Names"; |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
281 bool bAbbr) const { | 282 bool bAbbr) const { |
282 wsDayName = GetCalendarSymbol(XFA_Element::DayNames, nWeek, bAbbr); | 283 wsDayName = GetCalendarSymbol(XFA_Element::DayNames, nWeek, bAbbr); |
283 } | 284 } |
284 | 285 |
285 void CXFA_NodeLocale::GetMeridiemName(CFX_WideString& wsMeridiemName, | 286 void CXFA_NodeLocale::GetMeridiemName(CFX_WideString& wsMeridiemName, |
286 bool bAM) const { | 287 bool bAM) const { |
287 wsMeridiemName = | 288 wsMeridiemName = |
288 GetCalendarSymbol(XFA_Element::MeridiemNames, bAM ? 0 : 1, false); | 289 GetCalendarSymbol(XFA_Element::MeridiemNames, bAM ? 0 : 1, false); |
289 } | 290 } |
290 | 291 |
291 void CXFA_NodeLocale::GetTimeZone(FX_TIMEZONE& tz) const { | 292 void CXFA_NodeLocale::GetTimeZone(FX_TIMEZONE* tz) const { |
292 CXFA_TimeZoneProvider::Get()->GetTimeZone(tz); | 293 CXFA_TimeZoneProvider provider; |
| 294 provider.GetTimeZone(tz); |
293 } | 295 } |
294 | 296 |
295 void CXFA_NodeLocale::GetEraName(CFX_WideString& wsEraName, bool bAD) const { | 297 void CXFA_NodeLocale::GetEraName(CFX_WideString& wsEraName, bool bAD) const { |
296 wsEraName = GetCalendarSymbol(XFA_Element::EraNames, bAD ? 1 : 0, false); | 298 wsEraName = GetCalendarSymbol(XFA_Element::EraNames, bAD ? 1 : 0, false); |
297 } | 299 } |
298 | 300 |
299 void CXFA_NodeLocale::GetDatePattern(FX_LOCALEDATETIMESUBCATEGORY eType, | 301 void CXFA_NodeLocale::GetDatePattern(FX_LOCALEDATETIMESUBCATEGORY eType, |
300 CFX_WideString& wsPattern) const { | 302 CFX_WideString& wsPattern) const { |
301 switch (eType) { | 303 switch (eType) { |
302 case FX_LOCALEDATETIMESUBCATEGORY_Short: | 304 case FX_LOCALEDATETIMESUBCATEGORY_Short: |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
386 CXFA_Node* pNode = pCalendar->GetFirstChildByClass(eElement); | 388 CXFA_Node* pNode = pCalendar->GetFirstChildByClass(eElement); |
387 for (; pNode; pNode = pNode->GetNextSameClassSibling(eElement)) { | 389 for (; pNode; pNode = pNode->GetNextSameClassSibling(eElement)) { |
388 if (pNode->GetBoolean(XFA_ATTRIBUTE_Abbr) == bAbbr) { | 390 if (pNode->GetBoolean(XFA_ATTRIBUTE_Abbr) == bAbbr) { |
389 CXFA_Node* pSymbol = pNode->GetChild(index, XFA_Element::Unknown); | 391 CXFA_Node* pSymbol = pNode->GetChild(index, XFA_Element::Unknown); |
390 return pSymbol ? pSymbol->GetContent() : CFX_WideString(); | 392 return pSymbol ? pSymbol->GetContent() : CFX_WideString(); |
391 } | 393 } |
392 } | 394 } |
393 } | 395 } |
394 return CFX_WideString(); | 396 return CFX_WideString(); |
395 } | 397 } |
OLD | NEW |