summaryrefslogtreecommitdiff
path: root/core/fxcrt/xml
diff options
context:
space:
mode:
Diffstat (limited to 'core/fxcrt/xml')
-rw-r--r--core/fxcrt/xml/cfx_xmldoc.cpp20
-rw-r--r--core/fxcrt/xml/cfx_xmldoc.h5
2 files changed, 8 insertions, 17 deletions
diff --git a/core/fxcrt/xml/cfx_xmldoc.cpp b/core/fxcrt/xml/cfx_xmldoc.cpp
index 236ab05c37..64ed5a98d0 100644
--- a/core/fxcrt/xml/cfx_xmldoc.cpp
+++ b/core/fxcrt/xml/cfx_xmldoc.cpp
@@ -18,24 +18,17 @@
#include "third_party/base/ptr_util.h"
#include "third_party/base/stl_util.h"
-CFX_XMLDoc::CFX_XMLDoc()
- : m_iStatus(0), m_pRoot(pdfium::MakeUnique<CFX_XMLNode>()) {
+CFX_XMLDoc::CFX_XMLDoc(const RetainPtr<CFX_SeekableStreamProxy>& pStream)
+ : m_iStatus(0),
+ m_pRoot(pdfium::MakeUnique<CFX_XMLNode>()),
+ m_pXMLParser(pdfium::MakeUnique<CFX_XMLParser>(m_pRoot.get(), pStream)) {
+ ASSERT(pStream);
+
m_pRoot->AppendChild(new CFX_XMLInstruction(L"xml"));
}
CFX_XMLDoc::~CFX_XMLDoc() {}
-bool CFX_XMLDoc::LoadXML(std::unique_ptr<CFX_XMLParser> pXMLParser) {
- if (!pXMLParser)
- return false;
-
- m_iStatus = 0;
- m_pStream.Reset();
- m_pRoot->DeleteChildren();
- m_pXMLParser = std::move(pXMLParser);
- return true;
-}
-
int32_t CFX_XMLDoc::DoLoad() {
if (m_iStatus < 100)
m_iStatus = m_pXMLParser->DoParser();
@@ -46,4 +39,3 @@ int32_t CFX_XMLDoc::DoLoad() {
void CFX_XMLDoc::CloseXML() {
m_pXMLParser.reset();
}
-
diff --git a/core/fxcrt/xml/cfx_xmldoc.h b/core/fxcrt/xml/cfx_xmldoc.h
index 8ab6b8fea4..07be2d4e84 100644
--- a/core/fxcrt/xml/cfx_xmldoc.h
+++ b/core/fxcrt/xml/cfx_xmldoc.h
@@ -16,20 +16,19 @@
class CFX_XMLDoc {
public:
- CFX_XMLDoc();
+ explicit CFX_XMLDoc(const RetainPtr<CFX_SeekableStreamProxy>& pStream);
~CFX_XMLDoc();
- bool LoadXML(std::unique_ptr<CFX_XMLParser> pXMLParser);
int32_t DoLoad();
void CloseXML();
CFX_XMLNode* GetRoot() const { return m_pRoot.get(); }
+ CFX_XMLParser* GetParser() const { return m_pXMLParser.get(); }
private:
int32_t m_iStatus;
std::unique_ptr<CFX_XMLNode> m_pRoot;
std::unique_ptr<CFX_XMLParser> m_pXMLParser;
- RetainPtr<CFX_SeekableStreamProxy> m_pStream;
};
#endif // CORE_FXCRT_XML_CFX_XMLDOC_H_