summaryrefslogtreecommitdiff
path: root/xfa/fxfa/parser/cxfa_occurdata.cpp
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2018-01-03 11:25:05 -0500
committerChromium commit bot <commit-bot@chromium.org>2018-01-03 18:16:30 +0000
commit9647614a5dcd00d50aacf4e000fd23a5ebb13931 (patch)
tree2b05d094e17bde6a1464e92850dd67ef50e949f6 /xfa/fxfa/parser/cxfa_occurdata.cpp
parentcbd4410908e2a4898fdd5e0d6d17591fc2c71f54 (diff)
downloadpdfium-9647614a5dcd00d50aacf4e000fd23a5ebb13931.tar.xz
Fold CXFA_OccurData into CXFA_Occur
This CL folds the CXFA_OccurData wrapper into CXFA_Occur. Change-Id: I52e237e4f6b76f6915c397e924037562fd9eda6a Reviewed-on: https://pdfium-review.googlesource.com/22130 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'xfa/fxfa/parser/cxfa_occurdata.cpp')
-rw-r--r--xfa/fxfa/parser/cxfa_occurdata.cpp62
1 files changed, 0 insertions, 62 deletions
diff --git a/xfa/fxfa/parser/cxfa_occurdata.cpp b/xfa/fxfa/parser/cxfa_occurdata.cpp
deleted file mode 100644
index 195dce719a..0000000000
--- a/xfa/fxfa/parser/cxfa_occurdata.cpp
+++ /dev/null
@@ -1,62 +0,0 @@
-// Copyright 2016 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
-
-#include "xfa/fxfa/parser/cxfa_occurdata.h"
-
-#include "xfa/fxfa/parser/cxfa_node.h"
-
-CXFA_OccurData::CXFA_OccurData(CXFA_Node* pNode) : CXFA_DataData(pNode) {}
-
-int32_t CXFA_OccurData::GetMax() const {
- if (!m_pNode)
- return 1;
-
- pdfium::Optional<int32_t> max =
- m_pNode->JSObject()->TryInteger(XFA_Attribute::Max, true);
- return max ? *max : GetMin();
-}
-
-int32_t CXFA_OccurData::GetMin() const {
- if (!m_pNode)
- return 1;
-
- pdfium::Optional<int32_t> min =
- m_pNode->JSObject()->TryInteger(XFA_Attribute::Min, true);
- return min && *min >= 0 ? *min : 1;
-}
-
-std::tuple<int32_t, int32_t, int32_t> CXFA_OccurData::GetOccurInfo() const {
- ASSERT(m_pNode);
-
- int32_t iMin = GetMin();
- int32_t iMax = GetMax();
-
- pdfium::Optional<int32_t> init =
- m_pNode->JSObject()->TryInteger(XFA_Attribute::Initial, false);
- return {iMin, iMax, init && *init >= iMin ? *init : iMin};
-}
-
-void CXFA_OccurData::SetMax(int32_t iMax) {
- iMax = (iMax != -1 && iMax < 1) ? 1 : iMax;
- m_pNode->JSObject()->SetInteger(XFA_Attribute::Max, iMax, false);
-
- int32_t iMin = GetMin();
- if (iMax != -1 && iMax < iMin) {
- iMin = iMax;
- m_pNode->JSObject()->SetInteger(XFA_Attribute::Min, iMin, false);
- }
-}
-
-void CXFA_OccurData::SetMin(int32_t iMin) {
- iMin = (iMin < 0) ? 1 : iMin;
- m_pNode->JSObject()->SetInteger(XFA_Attribute::Min, iMin, false);
-
- int32_t iMax = GetMax();
- if (iMax > 0 && iMax < iMin) {
- iMax = iMin;
- m_pNode->JSObject()->SetInteger(XFA_Attribute::Max, iMax, false);
- }
-}