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 #ifndef CORE_FXCRT_XML_CFX_XMLINSTRUCTION_H_ 8 #define CORE_FXCRT_XML_CFX_XMLINSTRUCTION_H_ 9 10 #include <vector> 11 12 #include "core/fxcrt/fx_string.h" 13 #include "core/fxcrt/xml/cfx_xmlnode.h" 14 15 class CFX_XMLDocument; 16 17 class CFX_XMLInstruction final : public CFX_XMLNode { 18 public: 19 explicit CFX_XMLInstruction(const WideString& wsTarget); 20 ~CFX_XMLInstruction() override; 21 22 // CFX_XMLNode 23 Type GetType() const override; 24 CFX_XMLNode* Clone(CFX_XMLDocument* doc) override; 25 void Save(const RetainPtr<IFX_SeekableWriteStream>& pXMLStream) override; 26 27 bool IsOriginalXFAVersion() const; 28 bool IsAcrobat() const; 29 GetTargetData()30 const std::vector<WideString>& GetTargetData() const { return target_data_; } 31 void AppendData(const WideString& wsData); 32 33 private: 34 const WideString name_; 35 std::vector<WideString> target_data_; 36 }; 37 ToXMLInstruction(CFX_XMLNode * pNode)38inline CFX_XMLInstruction* ToXMLInstruction(CFX_XMLNode* pNode) { 39 return pNode && pNode->GetType() == CFX_XMLNode::Type::kInstruction 40 ? static_cast<CFX_XMLInstruction*>(pNode) 41 : nullptr; 42 } 43 44 #endif // CORE_FXCRT_XML_CFX_XMLINSTRUCTION_H_ 45