summaryrefslogtreecommitdiff
path: root/xfa/fgas/localization/cfx_formatstring.h
diff options
context:
space:
mode:
Diffstat (limited to 'xfa/fgas/localization/cfx_formatstring.h')
-rw-r--r--xfa/fgas/localization/cfx_formatstring.h71
1 files changed, 71 insertions, 0 deletions
diff --git a/xfa/fgas/localization/cfx_formatstring.h b/xfa/fgas/localization/cfx_formatstring.h
new file mode 100644
index 0000000000..19764da85c
--- /dev/null
+++ b/xfa/fgas/localization/cfx_formatstring.h
@@ -0,0 +1,71 @@
+// Copyright 2017 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_FGAS_LOCALIZATION_CFX_FORMATSTRING_H_
+#define XFA_FGAS_LOCALIZATION_CFX_FORMATSTRING_H_
+
+#include <vector>
+
+#include "xfa/fgas/localization/fgas_locale.h"
+#include "xfa/fxfa/parser/xfa_localemgr.h"
+
+class CFX_FormatString {
+ public:
+ explicit CFX_FormatString(CXFA_LocaleMgr* pLocaleMgr);
+ ~CFX_FormatString();
+
+ void SplitFormatString(const CFX_WideString& wsFormatString,
+ std::vector<CFX_WideString>& wsPatterns);
+ FX_LOCALECATEGORY GetCategory(const CFX_WideString& wsPattern);
+ CFX_WideString GetLocaleName(const CFX_WideString& wsPattern);
+ bool ParseText(const CFX_WideString& wsSrcText,
+ const CFX_WideString& wsPattern,
+ CFX_WideString& wsValue);
+ bool ParseNum(const CFX_WideString& wsSrcNum,
+ const CFX_WideString& wsPattern,
+ CFX_WideString& wsValue);
+ bool ParseDateTime(const CFX_WideString& wsSrcDateTime,
+ const CFX_WideString& wsPattern,
+ FX_DATETIMETYPE eDateTimeType,
+ CFX_Unitime& dtValue);
+ bool ParseZero(const CFX_WideString& wsSrcText,
+ const CFX_WideString& wsPattern);
+ bool ParseNull(const CFX_WideString& wsSrcText,
+ const CFX_WideString& wsPattern);
+ bool FormatText(const CFX_WideString& wsSrcText,
+ const CFX_WideString& wsPattern,
+ CFX_WideString& wsOutput);
+ bool FormatNum(const CFX_WideString& wsSrcNum,
+ const CFX_WideString& wsPattern,
+ CFX_WideString& wsOutput);
+ bool FormatDateTime(const CFX_WideString& wsSrcDateTime,
+ const CFX_WideString& wsPattern,
+ CFX_WideString& wsOutput,
+ FX_DATETIMETYPE eDateTimeType);
+ bool FormatZero(const CFX_WideString& wsPattern, CFX_WideString& wsOutput);
+ bool FormatNull(const CFX_WideString& wsPattern, CFX_WideString& wsOutput);
+
+ private:
+ IFX_Locale* GetTextFormat(const CFX_WideString& wsPattern,
+ const CFX_WideStringC& wsCategory,
+ CFX_WideString& wsPurgePattern);
+ IFX_Locale* GetNumericFormat(const CFX_WideString& wsPattern,
+ int32_t& iDotIndex,
+ uint32_t& dwStyle,
+ CFX_WideString& wsPurgePattern);
+ bool FormatStrNum(const CFX_WideStringC& wsInputNum,
+ const CFX_WideString& wsPattern,
+ CFX_WideString& wsOutput);
+ FX_DATETIMETYPE GetDateTimeFormat(const CFX_WideString& wsPattern,
+ IFX_Locale*& pLocale,
+ CFX_WideString& wsDatePattern,
+ CFX_WideString& wsTimePattern);
+ IFX_Locale* GetPatternLocale(const CFX_WideString& wsLocale);
+
+ CXFA_LocaleMgr* m_pLocaleMgr;
+};
+
+#endif // XFA_FGAS_LOCALIZATION_CFX_FORMATSTRING_H_