OLD | NEW |
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_LOCALEVALUE_H_ | 7 #ifndef XFA_FXFA_PARSER_XFA_LOCALEVALUE_H_ |
8 #define XFA_FXFA_PARSER_XFA_LOCALEVALUE_H_ | 8 #define XFA_FXFA_PARSER_XFA_LOCALEVALUE_H_ |
9 | 9 |
10 #include "core/fxcrt/fx_string.h" | 10 #include "core/fxcrt/fx_string.h" |
(...skipping 23 matching lines...) Expand all Loading... |
34 const CFX_WideString& wsValue, | 34 const CFX_WideString& wsValue, |
35 CXFA_LocaleMgr* pLocaleMgr); | 35 CXFA_LocaleMgr* pLocaleMgr); |
36 CXFA_LocaleValue(uint32_t dwType, | 36 CXFA_LocaleValue(uint32_t dwType, |
37 const CFX_WideString& wsValue, | 37 const CFX_WideString& wsValue, |
38 const CFX_WideString& wsFormat, | 38 const CFX_WideString& wsFormat, |
39 IFX_Locale* pLocale, | 39 IFX_Locale* pLocale, |
40 CXFA_LocaleMgr* pLocaleMgr); | 40 CXFA_LocaleMgr* pLocaleMgr); |
41 ~CXFA_LocaleValue(); | 41 ~CXFA_LocaleValue(); |
42 CXFA_LocaleValue& operator=(const CXFA_LocaleValue& value); | 42 CXFA_LocaleValue& operator=(const CXFA_LocaleValue& value); |
43 | 43 |
44 FX_BOOL ValidateValue(const CFX_WideString& wsValue, | 44 bool ValidateValue(const CFX_WideString& wsValue, |
45 const CFX_WideString& wsPattern, | 45 const CFX_WideString& wsPattern, |
46 IFX_Locale* pLocale, | 46 IFX_Locale* pLocale, |
47 CFX_WideString* pMatchFormat = nullptr); | 47 CFX_WideString* pMatchFormat = nullptr); |
48 FX_BOOL FormatPatterns(CFX_WideString& wsResult, | 48 bool FormatPatterns(CFX_WideString& wsResult, |
49 const CFX_WideString& wsFormat, | 49 const CFX_WideString& wsFormat, |
50 IFX_Locale* pLocale, | 50 IFX_Locale* pLocale, |
51 XFA_VALUEPICTURE eValueType) const; | 51 XFA_VALUEPICTURE eValueType) const; |
52 FX_BOOL FormatSinglePattern(CFX_WideString& wsResult, | 52 bool FormatSinglePattern(CFX_WideString& wsResult, |
53 const CFX_WideString& wsFormat, | 53 const CFX_WideString& wsFormat, |
54 IFX_Locale* pLocale, | 54 IFX_Locale* pLocale, |
55 XFA_VALUEPICTURE eValueType) const; | 55 XFA_VALUEPICTURE eValueType) const; |
56 FX_BOOL ValidateCanonicalValue(const CFX_WideString& wsValue, | 56 bool ValidateCanonicalValue(const CFX_WideString& wsValue, uint32_t dwVType); |
57 uint32_t dwVType); | 57 bool ValidateCanonicalDate(const CFX_WideString& wsDate, CFX_Unitime& unDate); |
58 FX_BOOL ValidateCanonicalDate(const CFX_WideString& wsDate, | 58 bool ValidateCanonicalTime(const CFX_WideString& wsTime); |
59 CFX_Unitime& unDate); | 59 bool ValidateCanonicalDateTime(const CFX_WideString& wsDateTime); |
60 FX_BOOL ValidateCanonicalTime(const CFX_WideString& wsTime); | |
61 FX_BOOL ValidateCanonicalDateTime(const CFX_WideString& wsDateTime); | |
62 void GetNumbericFormat(CFX_WideString& wsFormat, | 60 void GetNumbericFormat(CFX_WideString& wsFormat, |
63 int32_t nIntLen, | 61 int32_t nIntLen, |
64 int32_t nDecLen, | 62 int32_t nDecLen, |
65 FX_BOOL bSign = TRUE); | 63 bool bSign = true); |
66 FX_BOOL ValidateNumericTemp(CFX_WideString& wsNumeric, | 64 bool ValidateNumericTemp(CFX_WideString& wsNumeric, |
67 CFX_WideString& wsFormat, | 65 CFX_WideString& wsFormat, |
68 IFX_Locale* pLocale = nullptr, | 66 IFX_Locale* pLocale = nullptr, |
69 int32_t* pos = nullptr); | 67 int32_t* pos = nullptr); |
70 | 68 |
71 CFX_WideString GetValue() const; | 69 CFX_WideString GetValue() const; |
72 uint32_t GetType() const; | 70 uint32_t GetType() const; |
73 void SetValue(const CFX_WideString& wsValue, uint32_t dwType); | 71 void SetValue(const CFX_WideString& wsValue, uint32_t dwType); |
74 CFX_WideString GetText() const; | 72 CFX_WideString GetText() const; |
75 FX_FLOAT GetNum() const; | 73 FX_FLOAT GetNum() const; |
76 FX_DOUBLE GetDoubleNum() const; | 74 FX_DOUBLE GetDoubleNum() const; |
77 CFX_Unitime GetDate() const; | 75 CFX_Unitime GetDate() const; |
78 CFX_Unitime GetTime() const; | 76 CFX_Unitime GetTime() const; |
79 CFX_Unitime GetDateTime() const; | 77 CFX_Unitime GetDateTime() const; |
80 FX_BOOL SetText(const CFX_WideString& wsText); | 78 bool SetText(const CFX_WideString& wsText); |
81 FX_BOOL SetText(const CFX_WideString& wsText, | 79 bool SetText(const CFX_WideString& wsText, |
82 const CFX_WideString& wsFormat, | 80 const CFX_WideString& wsFormat, |
83 IFX_Locale* pLocale); | 81 IFX_Locale* pLocale); |
84 FX_BOOL SetNum(FX_FLOAT fNum); | 82 bool SetNum(FX_FLOAT fNum); |
85 FX_BOOL SetNum(const CFX_WideString& wsNum, | 83 bool SetNum(const CFX_WideString& wsNum, |
86 const CFX_WideString& wsFormat, | 84 const CFX_WideString& wsFormat, |
87 IFX_Locale* pLocale); | 85 IFX_Locale* pLocale); |
88 FX_BOOL SetDate(const CFX_Unitime& d); | 86 bool SetDate(const CFX_Unitime& d); |
89 FX_BOOL SetDate(const CFX_WideString& wsDate, | 87 bool SetDate(const CFX_WideString& wsDate, |
90 const CFX_WideString& wsFormat, | 88 const CFX_WideString& wsFormat, |
91 IFX_Locale* pLocale); | 89 IFX_Locale* pLocale); |
92 FX_BOOL SetTime(const CFX_Unitime& t); | 90 bool SetTime(const CFX_Unitime& t); |
93 FX_BOOL SetTime(const CFX_WideString& wsTime, | 91 bool SetTime(const CFX_WideString& wsTime, |
94 const CFX_WideString& wsFormat, | 92 const CFX_WideString& wsFormat, |
95 IFX_Locale* pLocale); | 93 IFX_Locale* pLocale); |
96 FX_BOOL SetDateTime(const CFX_Unitime& dt); | 94 bool SetDateTime(const CFX_Unitime& dt); |
97 FX_BOOL SetDateTime(const CFX_WideString& wsDateTime, | 95 bool SetDateTime(const CFX_WideString& wsDateTime, |
98 const CFX_WideString& wsFormat, | 96 const CFX_WideString& wsFormat, |
99 IFX_Locale* pLocale); | 97 IFX_Locale* pLocale); |
100 bool IsNull() const { return m_dwType == XFA_VT_NULL; } | 98 bool IsNull() const { return m_dwType == XFA_VT_NULL; } |
101 FX_BOOL IsEmpty() const { return m_wsValue.IsEmpty(); } | 99 bool IsEmpty() const { return m_wsValue.IsEmpty(); } |
102 FX_BOOL IsValid() const { return m_bValid; } | 100 bool IsValid() const { return m_bValid; } |
103 | 101 |
104 protected: | 102 protected: |
105 FX_BOOL ParsePatternValue(const CFX_WideString& wsValue, | 103 bool ParsePatternValue(const CFX_WideString& wsValue, |
106 const CFX_WideString& wsPattern, | 104 const CFX_WideString& wsPattern, |
107 IFX_Locale* pLocale); | 105 IFX_Locale* pLocale); |
108 CXFA_LocaleMgr* m_pLocaleMgr; | 106 CXFA_LocaleMgr* m_pLocaleMgr; |
109 CFX_WideString m_wsValue; | 107 CFX_WideString m_wsValue; |
110 uint32_t m_dwType; | 108 uint32_t m_dwType; |
111 FX_BOOL m_bValid; | 109 bool m_bValid; |
112 }; | 110 }; |
113 | 111 |
114 #endif // XFA_FXFA_PARSER_XFA_LOCALEVALUE_H_ | 112 #endif // XFA_FXFA_PARSER_XFA_LOCALEVALUE_H_ |
OLD | NEW |