Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(574)

Side by Side Diff: xfa/fxfa/parser/xfa_localemgr.h

Issue 2241863002: Clean up XFA locale and locale manager (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: small fix Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « xfa/fxfa/parser/xfa_locale.cpp ('k') | xfa/fxfa/parser/xfa_localemgr.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 PDFium Authors. All rights reserved. 1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 6
7 #ifndef XFA_FXFA_PARSER_XFA_LOCALEMGR_H_ 7 #ifndef XFA_FXFA_PARSER_XFA_LOCALEMGR_H_
8 #define XFA_FXFA_PARSER_XFA_LOCALEMGR_H_ 8 #define XFA_FXFA_PARSER_XFA_LOCALEMGR_H_
9 9
10 #include <memory>
11 #include <vector>
12
10 #include "xfa/fgas/localization/fgas_datetime.h" 13 #include "xfa/fgas/localization/fgas_datetime.h"
11 #include "xfa/fgas/localization/fgas_locale.h" 14 #include "xfa/fgas/localization/fgas_locale.h"
12 #include "xfa/fxfa/parser/xfa_localemgr.h" 15 #include "xfa/fxfa/parser/xfa_localemgr.h"
13 16
14 class CXFA_Node; 17 class CXFA_Node;
15 class IFX_Locale; 18 class IFX_Locale;
16 19
17 #define XFA_LANGID_zh_CN 0x0804 20 #define XFA_LANGID_zh_CN 0x0804
18 #define XFA_LANGID_zh_TW 0x0404 21 #define XFA_LANGID_zh_TW 0x0404
19 #define XFA_LANGID_zh_HK 0x0c04 22 #define XFA_LANGID_zh_HK 0x0c04
20 #define XFA_LANGID_ja_JP 0x0411 23 #define XFA_LANGID_ja_JP 0x0411
21 #define XFA_LANGID_ko_KR 0x0412 24 #define XFA_LANGID_ko_KR 0x0412
22 #define XFA_LANGID_en_US 0x0409 25 #define XFA_LANGID_en_US 0x0409
23 #define XFA_LANGID_en_GB 0x0809 26 #define XFA_LANGID_en_GB 0x0809
24 #define XFA_LANGID_es_ES 0x0c0a 27 #define XFA_LANGID_es_ES 0x0c0a
25 #define XFA_LANGID_es_LA 0x080a 28 #define XFA_LANGID_es_LA 0x080a
26 #define XFA_LANGID_de_DE 0x0407 29 #define XFA_LANGID_de_DE 0x0407
27 #define XFA_LANGID_fr_FR 0x040c 30 #define XFA_LANGID_fr_FR 0x040c
28 #define XFA_LANGID_it_IT 0x0410 31 #define XFA_LANGID_it_IT 0x0410
29 #define XFA_LANGID_pt_BR 0x0416 32 #define XFA_LANGID_pt_BR 0x0416
30 #define XFA_LANGID_nl_NL 0x0413 33 #define XFA_LANGID_nl_NL 0x0413
31 #define XFA_LANGID_ru_RU 0x0419 34 #define XFA_LANGID_ru_RU 0x0419
32 35
33 class CXFA_LocaleMgr : public IFX_LocaleMgr { 36 class CXFA_LocaleMgr : public IFX_LocaleMgr {
34 public: 37 public:
35 CXFA_LocaleMgr(CXFA_Node* pLocaleSet, CFX_WideString wsDeflcid); 38 CXFA_LocaleMgr(CXFA_Node* pLocaleSet, CFX_WideString wsDeflcid);
36 ~CXFA_LocaleMgr() override; 39 ~CXFA_LocaleMgr() override;
37 40
38 // IFX_LocaleMgr 41 // IFX_LocaleMgr
39 void Release() override; 42 uint16_t GetDefLocaleID() const override;
40 uint16_t GetDefLocaleID() override;
41 IFX_Locale* GetDefLocale() override; 43 IFX_Locale* GetDefLocale() override;
42 IFX_Locale* GetLocale(uint16_t lcid) override;
43 IFX_Locale* GetLocaleByName(const CFX_WideString& wsLocaleName) override; 44 IFX_Locale* GetLocaleByName(const CFX_WideString& wsLocaleName) override;
44 45
45 void SetDefLocale(IFX_Locale* pLocale); 46 void SetDefLocale(IFX_Locale* pLocale);
46 CFX_WideStringC GetConfigLocaleName(CXFA_Node* pConfig); 47 CFX_WideStringC GetConfigLocaleName(CXFA_Node* pConfig);
47 48
48 protected: 49 protected:
49 CFX_ArrayTemplate<IFX_Locale*> m_LocaleArray; 50 std::unique_ptr<IFX_Locale> GetLocale(uint16_t lcid) override;
50 CFX_ArrayTemplate<IFX_Locale*> m_XMLLocaleArray; 51
51 IFX_Locale* m_pDefLocale; 52 std::vector<std::unique_ptr<IFX_Locale>> m_LocaleArray;
53 std::vector<std::unique_ptr<IFX_Locale>> m_XMLLocaleArray;
54 IFX_Locale* m_pDefLocale; // owned by m_LocaleArray or m_XMLLocaleArray.
52 CFX_WideString m_wsConfigLocale; 55 CFX_WideString m_wsConfigLocale;
53 uint16_t m_dwDeflcid; 56 uint16_t m_dwDeflcid;
54 uint16_t m_dwLocaleFlags; 57 uint16_t m_dwLocaleFlags;
55 }; 58 };
56 59
57 class CXFA_TimeZoneProvider { 60 class CXFA_TimeZoneProvider {
58 public: 61 public:
59 CXFA_TimeZoneProvider(); 62 CXFA_TimeZoneProvider();
60 ~CXFA_TimeZoneProvider(); 63 ~CXFA_TimeZoneProvider();
61 64
62 static CXFA_TimeZoneProvider* Create(); 65 static CXFA_TimeZoneProvider* Create();
63 static CXFA_TimeZoneProvider* Get(); 66 static CXFA_TimeZoneProvider* Get();
64 static void Destroy(); 67 static void Destroy();
65 68
66 void SetTimeZone(FX_TIMEZONE& tz); 69 void SetTimeZone(FX_TIMEZONE& tz);
67 void GetTimeZone(FX_TIMEZONE& tz); 70 void GetTimeZone(FX_TIMEZONE& tz);
68 71
69 private: 72 private:
70 FX_TIMEZONE m_tz; 73 FX_TIMEZONE m_tz;
71 }; 74 };
72 75
73 #endif // XFA_FXFA_PARSER_XFA_LOCALEMGR_H_ 76 #endif // XFA_FXFA_PARSER_XFA_LOCALEMGR_H_
OLDNEW
« no previous file with comments | « xfa/fxfa/parser/xfa_locale.cpp ('k') | xfa/fxfa/parser/xfa_localemgr.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698