summaryrefslogtreecommitdiff
path: root/core/fxcrt/cfx_decimal.h
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2017-03-29 15:18:16 -0400
committerChromium commit bot <commit-bot@chromium.org>2017-03-29 21:00:18 +0000
commitb929ab0886a2b0ceb701989ef126e5b0cabf6997 (patch)
treeea8dd8ea021c45a1fa95181d56316430740e150b /core/fxcrt/cfx_decimal.h
parentf761a3aa4a001736249e1d7c3dce3b9dc8436a8d (diff)
downloadpdfium-b929ab0886a2b0ceb701989ef126e5b0cabf6997.tar.xz
Remove fgas/localization directory
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 <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org> Reviewed-by: Nicolás Peña <npm@chromium.org>
Diffstat (limited to 'core/fxcrt/cfx_decimal.h')
-rw-r--r--core/fxcrt/cfx_decimal.h42
1 files changed, 42 insertions, 0 deletions
diff --git a/core/fxcrt/cfx_decimal.h b/core/fxcrt/cfx_decimal.h
new file mode 100644
index 0000000000..544280444a
--- /dev/null
+++ b/core/fxcrt/cfx_decimal.h
@@ -0,0 +1,42 @@
+// 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 CORE_FXCRT_CFX_DECIMAL_H_
+#define CORE_FXCRT_CFX_DECIMAL_H_
+
+#include "core/fxcrt/fx_string.h"
+
+class CFX_Decimal {
+ public:
+ CFX_Decimal();
+ explicit CFX_Decimal(uint32_t val);
+ explicit CFX_Decimal(uint64_t val);
+ explicit CFX_Decimal(int32_t val);
+ CFX_Decimal(float val, uint8_t scale);
+ explicit CFX_Decimal(const CFX_WideStringC& str);
+
+ operator CFX_WideString() const;
+ operator double() const;
+
+ CFX_Decimal operator*(const CFX_Decimal& val) const;
+ CFX_Decimal operator/(const CFX_Decimal& val) const;
+
+ void SetScale(uint8_t newScale);
+ uint8_t GetScale();
+ void SetNegate();
+
+ private:
+ CFX_Decimal(uint32_t hi, uint32_t mid, uint32_t lo, bool neg, uint8_t scale);
+ bool IsNotZero() const { return m_uHi || m_uMid || m_uLo; }
+ void Swap(CFX_Decimal& val);
+
+ uint32_t m_uHi;
+ uint32_t m_uLo;
+ uint32_t m_uMid;
+ uint32_t m_uFlags;
+};
+
+#endif // CORE_FXCRT_CFX_DECIMAL_H_