xref: /aosp_15_r20/external/pdfium/xfa/fxfa/parser/cxfa_nodelocale.h (revision 3ac0a46f773bac49fa9476ec2b1cf3f8da5ec3a4)
1 // Copyright 2014 The PDFium Authors
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 "fxjs/gc/heap.h"
11 #include "v8/include/cppgc/garbage-collected.h"
12 #include "v8/include/cppgc/member.h"
13 #include "xfa/fxfa/fxfa_basic.h"
14 #include "xfa/fxfa/parser/gced_locale_iface.h"
15 
16 class CXFA_Node;
17 
18 WideString XFA_PatternToString(LocaleIface::NumSubcategory category);
19 
20 class CXFA_NodeLocale final : public GCedLocaleIface {
21  public:
22   CONSTRUCT_VIA_MAKE_GARBAGE_COLLECTED;
23   ~CXFA_NodeLocale() override;
24 
25   // GCedLocaleIface:
26   void Trace(cppgc::Visitor* visitor) const override;
27   WideString GetName() const override;
28   WideString GetDecimalSymbol() const override;
29   WideString GetGroupingSymbol() const override;
30   WideString GetPercentSymbol() const override;
31   WideString GetMinusSymbol() const override;
32   WideString GetCurrencySymbol() const override;
33   WideString GetDateTimeSymbols() const override;
34   WideString GetMonthName(int32_t nMonth, bool bAbbr) const override;
35   WideString GetDayName(int32_t nWeek, bool bAbbr) const override;
36   WideString GetMeridiemName(bool bAM) const override;
37   int GetTimeZoneInMinutes() const override;
38   WideString GetEraName(bool bAD) const override;
39 
40   WideString GetDatePattern(DateTimeSubcategory eType) const override;
41   WideString GetTimePattern(DateTimeSubcategory eType) const override;
42   WideString GetNumPattern(NumSubcategory eType) const override;
43 
44  private:
45   explicit CXFA_NodeLocale(CXFA_Node* pNode);
46 
47   CXFA_Node* GetNodeByName(CXFA_Node* pParent, WideStringView wsName) const;
48   WideString GetSymbol(XFA_Element eElement, WideStringView symbol_type) const;
49   WideString GetCalendarSymbol(XFA_Element eElement,
50                                int index,
51                                bool bAbbr) const;
52 
53   cppgc::Member<CXFA_Node> const m_pNode;
54 };
55 
56 #endif  // XFA_FXFA_PARSER_CXFA_NODELOCALE_H_
57