| OLD | NEW |
| (Empty) |
| 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_SRC_FXFA_PARSER_XFA_LOCALEVALUE_H_ | |
| 8 #define XFA_SRC_FXFA_PARSER_XFA_LOCALEVALUE_H_ | |
| 9 | |
| 10 #include "xfa/include/fxfa/fxfa_objectacc.h" | |
| 11 | |
| 12 class IFX_Locale; | |
| 13 class CFX_Unitime; | |
| 14 class CXFA_LocaleMgr; | |
| 15 | |
| 16 #define XFA_VT_NULL 0 | |
| 17 #define XFA_VT_BOOLEAN 1 | |
| 18 #define XFA_VT_INTEGER 2 | |
| 19 #define XFA_VT_DECIMAL 4 | |
| 20 #define XFA_VT_FLOAT 8 | |
| 21 #define XFA_VT_TEXT 16 | |
| 22 #define XFA_VT_DATE 32 | |
| 23 #define XFA_VT_TIME 64 | |
| 24 #define XFA_VT_DATETIME 128 | |
| 25 | |
| 26 class CXFA_LocaleValue { | |
| 27 public: | |
| 28 CXFA_LocaleValue(); | |
| 29 CXFA_LocaleValue(const CXFA_LocaleValue& value); | |
| 30 CXFA_LocaleValue(FX_DWORD dwType, CXFA_LocaleMgr* pLocaleMgr); | |
| 31 CXFA_LocaleValue(FX_DWORD dwType, | |
| 32 const CFX_WideString& wsValue, | |
| 33 CXFA_LocaleMgr* pLocaleMgr); | |
| 34 CXFA_LocaleValue(FX_DWORD dwType, | |
| 35 const CFX_WideString& wsValue, | |
| 36 const CFX_WideString& wsFormat, | |
| 37 IFX_Locale* pLocale, | |
| 38 CXFA_LocaleMgr* pLocaleMgr); | |
| 39 ~CXFA_LocaleValue(); | |
| 40 CXFA_LocaleValue& operator=(const CXFA_LocaleValue& value); | |
| 41 | |
| 42 FX_BOOL ValidateValue(const CFX_WideString& wsValue, | |
| 43 const CFX_WideString& wsPattern, | |
| 44 IFX_Locale* pLocale, | |
| 45 CFX_WideString* pMatchFormat = NULL); | |
| 46 FX_BOOL FormatPatterns(CFX_WideString& wsResult, | |
| 47 const CFX_WideString& wsFormat, | |
| 48 IFX_Locale* pLocale, | |
| 49 XFA_VALUEPICTURE eValueType) const; | |
| 50 FX_BOOL FormatSinglePattern(CFX_WideString& wsResult, | |
| 51 const CFX_WideString& wsFormat, | |
| 52 IFX_Locale* pLocale, | |
| 53 XFA_VALUEPICTURE eValueType) const; | |
| 54 FX_BOOL ValidateCanonicalValue(const CFX_WideString& wsValue, | |
| 55 FX_DWORD dwVType); | |
| 56 FX_BOOL ValidateCanonicalDate(const CFX_WideString& wsDate, | |
| 57 CFX_Unitime& unDate); | |
| 58 FX_BOOL ValidateCanonicalTime(const CFX_WideString& wsTime); | |
| 59 FX_BOOL ValidateCanonicalDateTime(const CFX_WideString& wsDateTime); | |
| 60 void GetNumbericFormat(CFX_WideString& wsFormat, | |
| 61 int32_t nIntLen, | |
| 62 int32_t nDecLen, | |
| 63 FX_BOOL bSign = TRUE); | |
| 64 FX_BOOL ValidateNumericTemp(CFX_WideString& wsNumeric, | |
| 65 CFX_WideString& wsFormat, | |
| 66 IFX_Locale* pLocale = NULL, | |
| 67 int32_t* pos = NULL); | |
| 68 | |
| 69 CFX_WideString GetValue() const; | |
| 70 FX_DWORD GetType() const; | |
| 71 void SetValue(const CFX_WideString& wsValue, FX_DWORD dwType); | |
| 72 CFX_WideString GetText() const; | |
| 73 FX_FLOAT GetNum() const; | |
| 74 FX_DOUBLE GetDoubleNum() const; | |
| 75 CFX_Unitime GetDate() const; | |
| 76 CFX_Unitime GetTime() const; | |
| 77 CFX_Unitime GetDateTime() const; | |
| 78 FX_BOOL SetText(const CFX_WideString& wsText); | |
| 79 FX_BOOL SetText(const CFX_WideString& wsText, | |
| 80 const CFX_WideString& wsFormat, | |
| 81 IFX_Locale* pLocale); | |
| 82 FX_BOOL SetNum(FX_FLOAT fNum); | |
| 83 FX_BOOL SetNum(const CFX_WideString& wsNum, | |
| 84 const CFX_WideString& wsFormat, | |
| 85 IFX_Locale* pLocale); | |
| 86 FX_BOOL SetDate(const CFX_Unitime& d); | |
| 87 FX_BOOL SetDate(const CFX_WideString& wsDate, | |
| 88 const CFX_WideString& wsFormat, | |
| 89 IFX_Locale* pLocale); | |
| 90 FX_BOOL SetTime(const CFX_Unitime& t); | |
| 91 FX_BOOL SetTime(const CFX_WideString& wsTime, | |
| 92 const CFX_WideString& wsFormat, | |
| 93 IFX_Locale* pLocale); | |
| 94 FX_BOOL SetDateTime(const CFX_Unitime& dt); | |
| 95 FX_BOOL SetDateTime(const CFX_WideString& wsDateTime, | |
| 96 const CFX_WideString& wsFormat, | |
| 97 IFX_Locale* pLocale); | |
| 98 bool IsNull() const { return m_dwType == XFA_VT_NULL; } | |
| 99 FX_BOOL IsEmpty() const { return m_wsValue.IsEmpty(); } | |
| 100 FX_BOOL IsValid() const { return m_bValid; } | |
| 101 | |
| 102 protected: | |
| 103 FX_BOOL ParsePatternValue(const CFX_WideString& wsValue, | |
| 104 const CFX_WideString& wsPattern, | |
| 105 IFX_Locale* pLocale); | |
| 106 CXFA_LocaleMgr* m_pLocaleMgr; | |
| 107 CFX_WideString m_wsValue; | |
| 108 FX_DWORD m_dwType; | |
| 109 FX_BOOL m_bValid; | |
| 110 }; | |
| 111 | |
| 112 #endif // XFA_SRC_FXFA_PARSER_XFA_LOCALEVALUE_H_ | |
| OLD | NEW |