• 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_LOCALEMGR_H_
8 #define XFA_FXFA_PARSER_CXFA_LOCALEMGR_H_
9 
10 #include <memory>
11 #include <vector>
12 
13 #include "core/fxcrt/unowned_ptr.h"
14 #include "core/fxcrt/widestring.h"
15 #include "xfa/fgas/crt/locale_mgr_iface.h"
16 
17 class CXFA_Node;
18 class LocaleIface;
19 
20 class CXFA_LocaleMgr : public LocaleMgrIface {
21  public:
22   CXFA_LocaleMgr(CXFA_Node* pLocaleSet, WideString wsDeflcid);
23   ~CXFA_LocaleMgr() override;
24 
25   LocaleIface* GetDefLocale() override;
26   LocaleIface* GetLocaleByName(const WideString& wsLocaleName) override;
27 
28   void SetDefLocale(LocaleIface* pLocale);
29   WideString GetConfigLocaleName(CXFA_Node* pConfig);
30 
31  private:
32   std::unique_ptr<LocaleIface> GetLocale(uint16_t lcid);
33 
34   std::vector<std::unique_ptr<LocaleIface>> m_LocaleArray;
35   std::vector<std::unique_ptr<LocaleIface>> m_XMLLocaleArray;
36 
37   // Owned by m_LocaleArray or m_XMLLocaleArray.
38   UnownedPtr<LocaleIface> m_pDefLocale;
39 
40   WideString m_wsConfigLocale;
41   uint16_t m_dwDeflcid;
42   bool m_hasSetLocaleName = false;
43 };
44 
45 #endif  // XFA_FXFA_PARSER_CXFA_LOCALEMGR_H_
46