summaryrefslogtreecommitdiff
path: root/xfa/fxfa/parser/cxfa_localevalue.h
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2017-03-28 16:04:41 -0400
committerChromium commit bot <commit-bot@chromium.org>2017-03-28 22:42:05 +0000
commitec1843d2f61a85a7484627b828da317e4dd9c0a4 (patch)
tree78c8a132e1e125c0293a658c6d3e4f9ff32fe8a8 /xfa/fxfa/parser/cxfa_localevalue.h
parentafc8eb3baef519afde8740fa5ef7acd04ae802a5 (diff)
downloadpdfium-ec1843d2f61a85a7484627b828da317e4dd9c0a4.tar.xz
Renaming and splitting in xfa/fxfa/parser.
This Cl renames several of the files in xfa/fxfa/parser to match the name of the contained classes. Files with multiple clasess are split apart when renamed. Change-Id: Ice8a1279072ee13c2f62a81946be7f42f9ba6007 Reviewed-on: https://pdfium-review.googlesource.com/3250 Commit-Queue: Nicolás Peña <npm@chromium.org> Reviewed-by: Nicolás Peña <npm@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'xfa/fxfa/parser/cxfa_localevalue.h')
-rw-r--r--xfa/fxfa/parser/cxfa_localevalue.h112
1 files changed, 112 insertions, 0 deletions
diff --git a/xfa/fxfa/parser/cxfa_localevalue.h b/xfa/fxfa/parser/cxfa_localevalue.h
new file mode 100644
index 0000000000..75687b4281
--- /dev/null
+++ b/xfa/fxfa/parser/cxfa_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_FXFA_PARSER_CXFA_LOCALEVALUE_H_
+#define XFA_FXFA_PARSER_CXFA_LOCALEVALUE_H_
+
+#include "core/fxcrt/fx_string.h"
+#include "core/fxcrt/fx_system.h"
+#include "xfa/fxfa/parser/cxfa_widgetdata.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(uint32_t dwType, CXFA_LocaleMgr* pLocaleMgr);
+ CXFA_LocaleValue(uint32_t dwType,
+ const CFX_WideString& wsValue,
+ CXFA_LocaleMgr* pLocaleMgr);
+ CXFA_LocaleValue(uint32_t dwType,
+ const CFX_WideString& wsValue,
+ const CFX_WideString& wsFormat,
+ IFX_Locale* pLocale,
+ CXFA_LocaleMgr* pLocaleMgr);
+ ~CXFA_LocaleValue();
+ CXFA_LocaleValue& operator=(const CXFA_LocaleValue& value);
+
+ bool ValidateValue(const CFX_WideString& wsValue,
+ const CFX_WideString& wsPattern,
+ IFX_Locale* pLocale,
+ CFX_WideString* pMatchFormat = nullptr);
+ bool FormatPatterns(CFX_WideString& wsResult,
+ const CFX_WideString& wsFormat,
+ IFX_Locale* pLocale,
+ XFA_VALUEPICTURE eValueType) const;
+ bool FormatSinglePattern(CFX_WideString& wsResult,
+ const CFX_WideString& wsFormat,
+ IFX_Locale* pLocale,
+ XFA_VALUEPICTURE eValueType) const;
+ bool ValidateCanonicalValue(const CFX_WideString& wsValue, uint32_t dwVType);
+ bool ValidateCanonicalDate(const CFX_WideString& wsDate, CFX_Unitime* unDate);
+ bool ValidateCanonicalTime(const CFX_WideString& wsTime);
+ bool ValidateCanonicalDateTime(const CFX_WideString& wsDateTime);
+ void GetNumbericFormat(CFX_WideString& wsFormat,
+ int32_t nIntLen,
+ int32_t nDecLen,
+ bool bSign = true);
+ bool ValidateNumericTemp(CFX_WideString& wsNumeric,
+ CFX_WideString& wsFormat,
+ IFX_Locale* pLocale = nullptr,
+ int32_t* pos = nullptr);
+
+ CFX_WideString GetValue() const;
+ uint32_t GetType() const;
+ void SetValue(const CFX_WideString& wsValue, uint32_t dwType);
+ CFX_WideString GetText() const;
+ float GetNum() const;
+ double GetDoubleNum() const;
+ CFX_Unitime GetDate() const;
+ CFX_Unitime GetTime() const;
+ CFX_Unitime GetDateTime() const;
+ bool SetText(const CFX_WideString& wsText);
+ bool SetText(const CFX_WideString& wsText,
+ const CFX_WideString& wsFormat,
+ IFX_Locale* pLocale);
+ bool SetNum(float fNum);
+ bool SetNum(const CFX_WideString& wsNum,
+ const CFX_WideString& wsFormat,
+ IFX_Locale* pLocale);
+ bool SetDate(const CFX_Unitime& d);
+ bool SetDate(const CFX_WideString& wsDate,
+ const CFX_WideString& wsFormat,
+ IFX_Locale* pLocale);
+ bool SetTime(const CFX_Unitime& t);
+ bool SetTime(const CFX_WideString& wsTime,
+ const CFX_WideString& wsFormat,
+ IFX_Locale* pLocale);
+ bool SetDateTime(const CFX_Unitime& dt);
+ bool SetDateTime(const CFX_WideString& wsDateTime,
+ const CFX_WideString& wsFormat,
+ IFX_Locale* pLocale);
+ bool IsNull() const { return m_dwType == XFA_VT_NULL; }
+ bool IsEmpty() const { return m_wsValue.IsEmpty(); }
+ bool IsValid() const { return m_bValid; }
+
+ private:
+ bool ParsePatternValue(const CFX_WideString& wsValue,
+ const CFX_WideString& wsPattern,
+ IFX_Locale* pLocale);
+ CXFA_LocaleMgr* m_pLocaleMgr;
+ CFX_WideString m_wsValue;
+ uint32_t m_dwType;
+ bool m_bValid;
+};
+
+#endif // XFA_FXFA_PARSER_CXFA_LOCALEVALUE_H_