summaryrefslogtreecommitdiff
path: root/core/fxcrt/xml/cfx_xmldoc.cpp
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2018-04-09 17:27:55 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-04-09 17:27:55 +0000
commitd936d2931d86eb029feadd8aefbd3c7e51264a64 (patch)
tree6325dcc800614ef8c69e07b7ba90ccc83a836c0b /core/fxcrt/xml/cfx_xmldoc.cpp
parent6f26db4dcbc64cc3602ffe22d1178a1abca83c96 (diff)
downloadpdfium-d936d2931d86eb029feadd8aefbd3c7e51264a64.tar.xz
Move the CFX_XMLParser out of CXFA_SimpleParser
This CL removes the CFX_XMLParser from CXFA_SimpleParser and constructs it in the CFX_XMLDoc. Change-Id: Id69b396f091892170a4c4654ac1d0fd65d1efbb6 Reviewed-on: https://pdfium-review.googlesource.com/29970 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'core/fxcrt/xml/cfx_xmldoc.cpp')
-rw-r--r--core/fxcrt/xml/cfx_xmldoc.cpp20
1 files changed, 6 insertions, 14 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();
}
-