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 "core/fxcrt/xml/cfx_xmlinstruction.h" 8 9 #include <utility> 10 11 #include "core/fxcrt/fx_extension.h" 12 #include "third_party/base/ptr_util.h" 13 #include "third_party/base/stl_util.h" 14 CFX_XMLInstruction(const WideString & wsTarget)15CFX_XMLInstruction::CFX_XMLInstruction(const WideString& wsTarget) 16 : CFX_XMLAttributeNode(wsTarget) {} 17 ~CFX_XMLInstruction()18CFX_XMLInstruction::~CFX_XMLInstruction() {} 19 GetType() const20FX_XMLNODETYPE CFX_XMLInstruction::GetType() const { 21 return FX_XMLNODE_Instruction; 22 } 23 Clone()24std::unique_ptr<CFX_XMLNode> CFX_XMLInstruction::Clone() { 25 auto pClone = pdfium::MakeUnique<CFX_XMLInstruction>(GetName()); 26 pClone->SetAttributes(GetAttributes()); 27 pClone->m_TargetData = m_TargetData; 28 return std::move(pClone); 29 } 30 AppendData(const WideString & wsData)31void CFX_XMLInstruction::AppendData(const WideString& wsData) { 32 m_TargetData.push_back(wsData); 33 } 34 RemoveData(int32_t index)35void CFX_XMLInstruction::RemoveData(int32_t index) { 36 if (pdfium::IndexInBounds(m_TargetData, index)) 37 m_TargetData.erase(m_TargetData.begin() + index); 38 } 39