xref: /aosp_15_r20/external/pdfium/core/fxcrt/xml/cfx_xmlnode.h (revision 3ac0a46f773bac49fa9476ec2b1cf3f8da5ec3a4)
1 // Copyright 2017 The PDFium Authors
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_XMLNODE_H_
8 #define CORE_FXCRT_XML_CFX_XMLNODE_H_
9 
10 #include "core/fxcrt/fx_stream.h"
11 #include "core/fxcrt/retain_ptr.h"
12 #include "core/fxcrt/tree_node.h"
13 
14 class CFX_XMLDocument;
15 
16 class CFX_XMLNode : public TreeNode<CFX_XMLNode> {
17  public:
18   enum class Type {
19     kInstruction = 0,
20     kElement,
21     kText,
22     kCharData,
23   };
24 
25   CFX_XMLNode();
26   ~CFX_XMLNode() override;
27 
28   virtual Type GetType() const = 0;
29   virtual CFX_XMLNode* Clone(CFX_XMLDocument* doc) = 0;
30   virtual void Save(const RetainPtr<IFX_RetainableWriteStream>& pXMLStream) = 0;
31 
32   CFX_XMLNode* GetRoot();
33   void InsertChildNode(CFX_XMLNode* pNode, int32_t index);
34 };
35 
36 #endif  // CORE_FXCRT_XML_CFX_XMLNODE_H_
37