diff options
author | Dan Sinclair <dsinclair@chromium.org> | 2018-04-12 13:23:08 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2018-04-12 13:23:08 +0000 |
commit | 0cad1163af80cfcc987a3d431fbd05fa3e09151b (patch) | |
tree | ef67e8051351985ed66e467683084e8f88b8e24f /xfa/fxfa/parser | |
parent | 2efb11c89ee200473f5675ba3d3a946d5606e813 (diff) | |
download | pdfium-0cad1163af80cfcc987a3d431fbd05fa3e09151b.tar.xz |
Fold CXFA_DocumentParser into CXFA_FFDoc
The CXFA_DocumentParser is a thin wrapper around CXFA_SimpleParser. This
CL folds CXFA_DocumentParser into a ParseDoc method of CXFA_FFDoc.
Change-Id: I7e7073899436f0435c4ebfd548241ae842a2a276
Reviewed-on: https://pdfium-review.googlesource.com/30213
Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'xfa/fxfa/parser')
-rw-r--r-- | xfa/fxfa/parser/cxfa_document.cpp | 1 | ||||
-rw-r--r-- | xfa/fxfa/parser/cxfa_document_parser.cpp | 45 | ||||
-rw-r--r-- | xfa/fxfa/parser/cxfa_document_parser.h | 37 |
3 files changed, 0 insertions, 83 deletions
diff --git a/xfa/fxfa/parser/cxfa_document.cpp b/xfa/fxfa/parser/cxfa_document.cpp index d23e2bc2ce..cdfb7b45a6 100644 --- a/xfa/fxfa/parser/cxfa_document.cpp +++ b/xfa/fxfa/parser/cxfa_document.cpp @@ -20,7 +20,6 @@ #include "xfa/fxfa/parser/cscript_signaturepseudomodel.h" #include "xfa/fxfa/parser/cxfa_bind.h" #include "xfa/fxfa/parser/cxfa_datagroup.h" -#include "xfa/fxfa/parser/cxfa_document_parser.h" #include "xfa/fxfa/parser/cxfa_exdata.h" #include "xfa/fxfa/parser/cxfa_form.h" #include "xfa/fxfa/parser/cxfa_image.h" diff --git a/xfa/fxfa/parser/cxfa_document_parser.cpp b/xfa/fxfa/parser/cxfa_document_parser.cpp deleted file mode 100644 index 52b5e333c0..0000000000 --- a/xfa/fxfa/parser/cxfa_document_parser.cpp +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2016 PDFium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com - -#include "xfa/fxfa/parser/cxfa_document_parser.h" - -#include "core/fxcrt/xml/cfx_xmldoc.h" -#include "third_party/base/ptr_util.h" -#include "xfa/fxfa/fxfa.h" -#include "xfa/fxfa/parser/cxfa_document.h" - -CXFA_DocumentParser::CXFA_DocumentParser(CXFA_FFNotify* pNotify) - : m_pNotify(pNotify) {} - -CXFA_DocumentParser::~CXFA_DocumentParser() { - m_pDocument->ReleaseXMLNodesIfNeeded(); -} - -bool CXFA_DocumentParser::Parse(const RetainPtr<IFX_SeekableStream>& pStream, - XFA_PacketType ePacketID) { - m_pDocument = pdfium::MakeUnique<CXFA_Document>(GetNotify()); - - // Note, we don't pass the document into the constructor as currently that - // triggers different behaviour in the parser. - CXFA_SimpleParser parser; - parser.SetFactory(m_pDocument.get()); - - if (!parser.Parse(pStream, ePacketID)) - return false; - - m_pXMLRoot = parser.GetXMLRoot(); - - m_pDocument->SetRoot(parser.GetRootNode()); - return true; -} - -CXFA_FFNotify* CXFA_DocumentParser::GetNotify() const { - return m_pNotify.Get(); -} - -CXFA_Document* CXFA_DocumentParser::GetDocument() const { - return m_pDocument.get(); -} diff --git a/xfa/fxfa/parser/cxfa_document_parser.h b/xfa/fxfa/parser/cxfa_document_parser.h deleted file mode 100644 index 1075f48ef4..0000000000 --- a/xfa/fxfa/parser/cxfa_document_parser.h +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright 2016 PDFium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com - -#ifndef XFA_FXFA_PARSER_CXFA_DOCUMENT_PARSER_H_ -#define XFA_FXFA_PARSER_CXFA_DOCUMENT_PARSER_H_ - -#include <memory> - -#include "xfa/fxfa/parser/cxfa_simple_parser.h" - -class CFX_XMLDoc; -class CXFA_Document; -class CXFA_FFNotify; -class CXFA_Notify; -class IFX_SeekableStream; - -class CXFA_DocumentParser { - public: - explicit CXFA_DocumentParser(CXFA_FFNotify* pNotify); - ~CXFA_DocumentParser(); - - bool Parse(const RetainPtr<IFX_SeekableStream>& pStream, - XFA_PacketType ePacketID); - - CXFA_FFNotify* GetNotify() const; - CXFA_Document* GetDocument() const; - - private: - UnownedPtr<CXFA_FFNotify> const m_pNotify; - std::unique_ptr<CFX_XMLNode> m_pXMLRoot; - std::unique_ptr<CXFA_Document> m_pDocument; -}; - -#endif // XFA_FXFA_PARSER_CXFA_DOCUMENT_PARSER_H_ |