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_XMLDOC_H_
8#define CORE_FXCRT_XML_CFX_XMLDOC_H_
9
10#include <memory>
11
12#include "core/fxcrt/cfx_seekablestreamproxy.h"
13#include "core/fxcrt/retain_ptr.h"
14#include "core/fxcrt/xml/cfx_xmlnode.h"
15#include "core/fxcrt/xml/cfx_xmlparser.h"
16
17class CFX_XMLDoc {
18 public:
19  CFX_XMLDoc();
20  ~CFX_XMLDoc();
21
22  bool LoadXML(std::unique_ptr<CFX_XMLParser> pXMLParser);
23  int32_t DoLoad();
24  void CloseXML();
25
26  CFX_XMLNode* GetRoot() const { return m_pRoot.get(); }
27  void SaveXMLNode(const RetainPtr<CFX_SeekableStreamProxy>& pXMLStream,
28                   CFX_XMLNode* pNode);
29
30 private:
31  int32_t m_iStatus;
32  std::unique_ptr<CFX_XMLNode> m_pRoot;
33  std::unique_ptr<CFX_XMLParser> m_pXMLParser;
34  RetainPtr<CFX_SeekableStreamProxy> m_pStream;
35};
36
37#endif  // CORE_FXCRT_XML_CFX_XMLDOC_H_
38