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