• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 <memory>
11 
12 #include "core/fxcrt/ifx_locale.h"
13 #include "xfa/fxfa/fxfa_basic.h"
14 
15 class CXFA_Node;
16 
17 WideString XFA_PatternToString(FX_LOCALENUMSUBCATEGORY category);
18 
19 class CXFA_NodeLocale : public IFX_Locale {
20  public:
21   explicit CXFA_NodeLocale(CXFA_Node* pLocale);
22   ~CXFA_NodeLocale() override;
23 
24   // IFX_Locale
25   WideString GetName() const override;
26   WideString GetNumbericSymbol(FX_LOCALENUMSYMBOL eType) const override;
27 
28   WideString GetDateTimeSymbols() const override;
29   WideString GetMonthName(int32_t nMonth, bool bAbbr) const override;
30   WideString GetDayName(int32_t nWeek, bool bAbbr) const override;
31   WideString GetMeridiemName(bool bAM) const override;
32   FX_TIMEZONE GetTimeZone() const override;
33   WideString GetEraName(bool bAD) const override;
34 
35   WideString GetDatePattern(FX_LOCALEDATETIMESUBCATEGORY eType) const override;
36   WideString GetTimePattern(FX_LOCALEDATETIMESUBCATEGORY eType) const override;
37   WideString GetNumPattern(FX_LOCALENUMSUBCATEGORY eType) const override;
38 
39  private:
40   CXFA_Node* GetNodeByName(CXFA_Node* pParent,
41                            const WideStringView& wsName) const;
42   WideString GetSymbol(XFA_Element eElement,
43                        const WideStringView& symbol_type) const;
44   WideString GetCalendarSymbol(XFA_Element eElement,
45                                int index,
46                                bool bAbbr) const;
47 
48   UnownedPtr<CXFA_Node> const m_pLocale;
49 };
50 
51 #endif  // XFA_FXFA_PARSER_CXFA_NODELOCALE_H_
52