1 // Copyright 2017 PDFium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 6 7 #include "fxjs/xfa/cjx_occur.h" 8 9 #include <algorithm> 10 11 #include "fxjs/xfa/cfxjse_value.h" 12 #include "xfa/fxfa/parser/cxfa_occur.h" 13 CJX_Occur(CXFA_Occur * node)14CJX_Occur::CJX_Occur(CXFA_Occur* node) : CJX_Node(node) {} 15 16 CJX_Occur::~CJX_Occur() = default; 17 DynamicTypeIs(TypeTag eType) const18bool CJX_Occur::DynamicTypeIs(TypeTag eType) const { 19 return eType == static_type__ || ParentType__::DynamicTypeIs(eType); 20 } 21 max(CFXJSE_Value * pValue,bool bSetting,XFA_Attribute eAttribute)22void CJX_Occur::max(CFXJSE_Value* pValue, 23 bool bSetting, 24 XFA_Attribute eAttribute) { 25 CXFA_Occur* occur = static_cast<CXFA_Occur*>(GetXFANode()); 26 if (!bSetting) { 27 pValue->SetInteger(occur->GetMax()); 28 return; 29 } 30 occur->SetMax(pValue->ToInteger()); 31 } 32 min(CFXJSE_Value * pValue,bool bSetting,XFA_Attribute eAttribute)33void CJX_Occur::min(CFXJSE_Value* pValue, 34 bool bSetting, 35 XFA_Attribute eAttribute) { 36 CXFA_Occur* occur = static_cast<CXFA_Occur*>(GetXFANode()); 37 if (!bSetting) { 38 pValue->SetInteger(occur->GetMin()); 39 return; 40 } 41 occur->SetMin(pValue->ToInteger()); 42 } 43