1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 
7 #ifndef XFA_FXFA_PARSER_CXFA_NODELOCALE_H_
8 #define XFA_FXFA_PARSER_CXFA_NODELOCALE_H_
9 
10 #include "xfa/fgas/crt/locale_iface.h"
11 #include "xfa/fxfa/fxfa_basic.h"
12 
13 class CXFA_Node;
14 
15 WideString XFA_PatternToString(FX_LOCALENUMSUBCATEGORY category);
16 
17 class CXFA_NodeLocale final : public LocaleIface {
18  public:
19   explicit CXFA_NodeLocale(CXFA_Node* pLocale);
20   ~CXFA_NodeLocale() override;
21 
22   // LocaleIface
23   WideString GetName() const override;
24   WideString GetDecimalSymbol() const override;
25   WideString GetGroupingSymbol() const override;
26   WideString GetPercentSymbol() const override;
27   WideString GetMinusSymbol() const override;
28   WideString GetCurrencySymbol() const override;
29   WideString GetDateTimeSymbols() const override;
30   WideString GetMonthName(int32_t nMonth, bool bAbbr) const override;
31   WideString GetDayName(int32_t nWeek, bool bAbbr) const override;
32   WideString GetMeridiemName(bool bAM) const override;
33   FX_TIMEZONE GetTimeZone() const override;
34   WideString GetEraName(bool bAD) const override;
35 
36   WideString GetDatePattern(FX_LOCALEDATETIMESUBCATEGORY eType) const override;
37   WideString GetTimePattern(FX_LOCALEDATETIMESUBCATEGORY eType) const override;
38   WideString GetNumPattern(FX_LOCALENUMSUBCATEGORY eType) const override;
39 
40  private:
41   CXFA_Node* GetNodeByName(CXFA_Node* pParent, WideStringView wsName) const;
42   WideString GetSymbol(XFA_Element eElement, WideStringView symbol_type) const;
43   WideString GetCalendarSymbol(XFA_Element eElement,
44                                int index,
45                                bool bAbbr) const;
46 
47   UnownedPtr<CXFA_Node> const m_pLocale;
48 };
49 
50 #endif  // XFA_FXFA_PARSER_CXFA_NODELOCALE_H_
51