Home | History | Annotate | Download | only in parser
      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/cfx_datetime.h"
     14 #include "core/fxcrt/ifx_locale.h"
     15 #include "xfa/fxfa/parser/cxfa_localemgr.h"
     16 
     17 class CXFA_Node;
     18 class IFX_Locale;
     19 
     20 class CXFA_LocaleMgr {
     21  public:
     22   CXFA_LocaleMgr(CXFA_Node* pLocaleSet, WideString wsDeflcid);
     23   ~CXFA_LocaleMgr();
     24 
     25   uint16_t GetDefLocaleID() const;
     26   IFX_Locale* GetDefLocale();
     27   IFX_Locale* GetLocaleByName(const WideString& wsLocaleName);
     28 
     29   void SetDefLocale(IFX_Locale* pLocale);
     30   WideStringView GetConfigLocaleName(CXFA_Node* pConfig);
     31 
     32  private:
     33   std::unique_ptr<IFX_Locale> GetLocale(uint16_t lcid);
     34 
     35   std::vector<std::unique_ptr<IFX_Locale>> m_LocaleArray;
     36   std::vector<std::unique_ptr<IFX_Locale>> m_XMLLocaleArray;
     37   IFX_Locale* m_pDefLocale;  // owned by m_LocaleArray or m_XMLLocaleArray.
     38   WideString m_wsConfigLocale;
     39   uint16_t m_dwDeflcid;
     40   uint16_t m_dwLocaleFlags;
     41 };
     42 
     43 #endif  // XFA_FXFA_PARSER_CXFA_LOCALEMGR_H_
     44