diff options
author | Dan Sinclair <dsinclair@chromium.org> | 2016-03-08 13:49:22 -0500 |
---|---|---|
committer | Dan Sinclair <dsinclair@chromium.org> | 2016-03-08 13:49:22 -0500 |
commit | 6cdf084fa40a62eb33185171622ad12d95c6009e (patch) | |
tree | daeea24a81365ed27582f280b7f19add0cb7b0d7 /xfa/src/fxfa/parser/xfa_localevalue.h | |
parent | 653e0797debddb4e9aecbc6cde65748d43b18b79 (diff) | |
download | pdfium-6cdf084fa40a62eb33185171622ad12d95c6009e.tar.xz |
Remove xfa/src/fxfa/src/common and xfa/src/fxfa/src
This Cl moves the code in xfa/src/fxfa/src/common to the diretory which
contains the respective implementations and removes the xfa/src/fxfa/src/common
directory. It them moves all of the code in xfa/src/fxfa/src up one level and
removes the xfa/src/fxfa/src
directory.
R=tsepez@chromium.org
Review URL: https://codereview.chromium.org/1770073003 .
Diffstat (limited to 'xfa/src/fxfa/parser/xfa_localevalue.h')
-rw-r--r-- | xfa/src/fxfa/parser/xfa_localevalue.h | 112 |
1 files changed, 112 insertions, 0 deletions
diff --git a/xfa/src/fxfa/parser/xfa_localevalue.h b/xfa/src/fxfa/parser/xfa_localevalue.h new file mode 100644 index 0000000000..bcdf037fcd --- /dev/null +++ b/xfa/src/fxfa/parser/xfa_localevalue.h @@ -0,0 +1,112 @@ +// Copyright 2014 PDFium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com + +#ifndef XFA_SRC_FXFA_PARSER_XFA_LOCALEVALUE_H_ +#define XFA_SRC_FXFA_PARSER_XFA_LOCALEVALUE_H_ + +#include "xfa/include/fxfa/fxfa_objectacc.h" + +class IFX_Locale; +class CFX_Unitime; +class CXFA_LocaleMgr; + +#define XFA_VT_NULL 0 +#define XFA_VT_BOOLEAN 1 +#define XFA_VT_INTEGER 2 +#define XFA_VT_DECIMAL 4 +#define XFA_VT_FLOAT 8 +#define XFA_VT_TEXT 16 +#define XFA_VT_DATE 32 +#define XFA_VT_TIME 64 +#define XFA_VT_DATETIME 128 + +class CXFA_LocaleValue { + public: + CXFA_LocaleValue(); + CXFA_LocaleValue(const CXFA_LocaleValue& value); + CXFA_LocaleValue(FX_DWORD dwType, CXFA_LocaleMgr* pLocaleMgr); + CXFA_LocaleValue(FX_DWORD dwType, + const CFX_WideString& wsValue, + CXFA_LocaleMgr* pLocaleMgr); + CXFA_LocaleValue(FX_DWORD dwType, + const CFX_WideString& wsValue, + const CFX_WideString& wsFormat, + IFX_Locale* pLocale, + CXFA_LocaleMgr* pLocaleMgr); + ~CXFA_LocaleValue(); + CXFA_LocaleValue& operator=(const CXFA_LocaleValue& value); + + FX_BOOL ValidateValue(const CFX_WideString& wsValue, + const CFX_WideString& wsPattern, + IFX_Locale* pLocale, + CFX_WideString* pMatchFormat = NULL); + FX_BOOL FormatPatterns(CFX_WideString& wsResult, + const CFX_WideString& wsFormat, + IFX_Locale* pLocale, + XFA_VALUEPICTURE eValueType) const; + FX_BOOL FormatSinglePattern(CFX_WideString& wsResult, + const CFX_WideString& wsFormat, + IFX_Locale* pLocale, + XFA_VALUEPICTURE eValueType) const; + FX_BOOL ValidateCanonicalValue(const CFX_WideString& wsValue, + FX_DWORD dwVType); + FX_BOOL ValidateCanonicalDate(const CFX_WideString& wsDate, + CFX_Unitime& unDate); + FX_BOOL ValidateCanonicalTime(const CFX_WideString& wsTime); + FX_BOOL ValidateCanonicalDateTime(const CFX_WideString& wsDateTime); + void GetNumbericFormat(CFX_WideString& wsFormat, + int32_t nIntLen, + int32_t nDecLen, + FX_BOOL bSign = TRUE); + FX_BOOL ValidateNumericTemp(CFX_WideString& wsNumeric, + CFX_WideString& wsFormat, + IFX_Locale* pLocale = NULL, + int32_t* pos = NULL); + + CFX_WideString GetValue() const; + FX_DWORD GetType() const; + void SetValue(const CFX_WideString& wsValue, FX_DWORD dwType); + CFX_WideString GetText() const; + FX_FLOAT GetNum() const; + FX_DOUBLE GetDoubleNum() const; + CFX_Unitime GetDate() const; + CFX_Unitime GetTime() const; + CFX_Unitime GetDateTime() const; + FX_BOOL SetText(const CFX_WideString& wsText); + FX_BOOL SetText(const CFX_WideString& wsText, + const CFX_WideString& wsFormat, + IFX_Locale* pLocale); + FX_BOOL SetNum(FX_FLOAT fNum); + FX_BOOL SetNum(const CFX_WideString& wsNum, + const CFX_WideString& wsFormat, + IFX_Locale* pLocale); + FX_BOOL SetDate(const CFX_Unitime& d); + FX_BOOL SetDate(const CFX_WideString& wsDate, + const CFX_WideString& wsFormat, + IFX_Locale* pLocale); + FX_BOOL SetTime(const CFX_Unitime& t); + FX_BOOL SetTime(const CFX_WideString& wsTime, + const CFX_WideString& wsFormat, + IFX_Locale* pLocale); + FX_BOOL SetDateTime(const CFX_Unitime& dt); + FX_BOOL SetDateTime(const CFX_WideString& wsDateTime, + const CFX_WideString& wsFormat, + IFX_Locale* pLocale); + bool IsNull() const { return m_dwType == XFA_VT_NULL; } + FX_BOOL IsEmpty() const { return m_wsValue.IsEmpty(); } + FX_BOOL IsValid() const { return m_bValid; } + + protected: + FX_BOOL ParsePatternValue(const CFX_WideString& wsValue, + const CFX_WideString& wsPattern, + IFX_Locale* pLocale); + CXFA_LocaleMgr* m_pLocaleMgr; + CFX_WideString m_wsValue; + FX_DWORD m_dwType; + FX_BOOL m_bValid; +}; + +#endif // XFA_SRC_FXFA_PARSER_XFA_LOCALEVALUE_H_ |