From b929ab0886a2b0ceb701989ef126e5b0cabf6997 Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Wed, 29 Mar 2017 15:18:16 -0400 Subject: Remove fgas/localization directory MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This Cl moves the CFX_DateTime, CFX_Decimal and IFX_Locale files into core/fxcrt and builds only for XFA. The CFX_FormatString code is moved info fgas/crt and renamed CFGAS_FormatString to match the fgas naming. Change-Id: I8d9061195d2225da0389cbc9d018fcbd2e9a3c0c Reviewed-on: https://pdfium-review.googlesource.com/3257 Commit-Queue: dsinclair Reviewed-by: Tom Sepez Reviewed-by: Nicolás Peña --- xfa/fgas/crt/cfgas_formatstring.h | 76 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 xfa/fgas/crt/cfgas_formatstring.h (limited to 'xfa/fgas/crt/cfgas_formatstring.h') diff --git a/xfa/fgas/crt/cfgas_formatstring.h b/xfa/fgas/crt/cfgas_formatstring.h new file mode 100644 index 0000000000..d2d35a3042 --- /dev/null +++ b/xfa/fgas/crt/cfgas_formatstring.h @@ -0,0 +1,76 @@ +// 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_CRT_CFGAS_FORMATSTRING_H_ +#define XFA_FGAS_CRT_CFGAS_FORMATSTRING_H_ + +#include + +#include "core/fxcrt/ifx_locale.h" +#include "xfa/fxfa/parser/cxfa_localemgr.h" + +bool FX_DateFromCanonical(const CFX_WideString& wsDate, CFX_DateTime* datetime); +bool FX_TimeFromCanonical(const CFX_WideStringC& wsTime, + CFX_DateTime* datetime, + IFX_Locale* pLocale); + +class CFGAS_FormatString { + public: + explicit CFGAS_FormatString(CXFA_LocaleMgr* pLocaleMgr); + ~CFGAS_FormatString(); + + void SplitFormatString(const CFX_WideString& wsFormatString, + std::vector& 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_DateTime* 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_CRT_CFGAS_FORMATSTRING_H_ -- cgit v1.2.3