Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(282)

Unified Diff: xfa/fxfa/parser/xfa_parser_imp.cpp

Issue 2123133004: Remove IXFA_Parser, cleanup XFA parser code. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Rebase to master Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « xfa/fxfa/parser/xfa_parser_imp.h ('k') | xfa/fxfa/parser/xfa_script_datawindow.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: xfa/fxfa/parser/xfa_parser_imp.cpp
diff --git a/xfa/fxfa/parser/xfa_parser_imp.cpp b/xfa/fxfa/parser/xfa_parser_imp.cpp
index 2ce17372ae8ebe0000a8f203e2c83fd956e23f81..e4387a78380c51eb7d3b5507bb5aed8ba94831e6 100644
--- a/xfa/fxfa/parser/xfa_parser_imp.cpp
+++ b/xfa/fxfa/parser/xfa_parser_imp.cpp
@@ -16,16 +16,11 @@
#include "xfa/fxfa/parser/xfa_document.h"
#include "xfa/fxfa/parser/xfa_localemgr.h"
#include "xfa/fxfa/parser/xfa_object.h"
-#include "xfa/fxfa/parser/xfa_parser.h"
#include "xfa/fxfa/parser/xfa_script.h"
#include "xfa/fxfa/parser/xfa_utils.h"
-IXFA_Parser* IXFA_Parser::Create(CXFA_Document* pFactory,
- FX_BOOL bDocumentParser) {
- return new CXFA_SimpleParser(pFactory, bDocumentParser);
-}
CXFA_SimpleParser::CXFA_SimpleParser(CXFA_Document* pFactory,
- FX_BOOL bDocumentParser)
+ bool bDocumentParser)
: m_pXMLParser(nullptr),
m_pXMLDoc(nullptr),
m_pStream(nullptr),
@@ -34,15 +29,15 @@ CXFA_SimpleParser::CXFA_SimpleParser(CXFA_Document* pFactory,
m_pRootNode(nullptr),
m_ePacketID(XFA_XDPPACKET_UNKNOWN),
m_bDocumentParser(bDocumentParser) {}
+
CXFA_SimpleParser::~CXFA_SimpleParser() {
CloseParser();
}
-void CXFA_SimpleParser::Release() {
- delete this;
-}
+
void CXFA_SimpleParser::SetFactory(CXFA_Document* pFactory) {
m_pFactory = pFactory;
}
+
static CFDE_XMLNode* XFA_FDEExtension_GetDocumentNode(
CFDE_XMLDoc* pXMLDoc,
FX_BOOL bVerifyWellFormness = FALSE) {
@@ -194,10 +189,6 @@ void CXFA_SimpleParser::ConstructXFANode(CXFA_Node* pXFANode,
}
}
-CXFA_Document* CXFA_SimpleParser::GetFactory() const {
- return m_pFactory;
-}
-
CXFA_Node* CXFA_SimpleParser::GetRootNode() const {
return m_pRootNode;
}
@@ -1335,23 +1326,22 @@ void CXFA_SimpleParser::CloseParser() {
CXFA_DocumentParser::CXFA_DocumentParser(CXFA_FFNotify* pNotify)
: m_nodeParser(nullptr, TRUE), m_pNotify(pNotify), m_pDocument(nullptr) {}
+
CXFA_DocumentParser::~CXFA_DocumentParser() {
CloseParser();
}
-void CXFA_DocumentParser::Release() {
- delete this;
-}
int32_t CXFA_DocumentParser::StartParse(IFX_FileRead* pStream,
XFA_XDPPACKET ePacketID) {
CloseParser();
int32_t nRetStatus = m_nodeParser.StartParse(pStream, ePacketID);
if (nRetStatus == XFA_PARSESTATUS_Ready) {
- m_pDocument = new CXFA_Document(this);
- m_nodeParser.SetFactory(m_pDocument);
+ m_pDocument.reset(new CXFA_Document(this));
+ m_nodeParser.SetFactory(m_pDocument.get());
}
return nRetStatus;
}
+
int32_t CXFA_DocumentParser::DoParse(IFX_Pause* pPause) {
int32_t nRetStatus = m_nodeParser.DoParse(pPause);
if (nRetStatus >= XFA_PARSESTATUS_Done) {
@@ -1360,36 +1350,6 @@ int32_t CXFA_DocumentParser::DoParse(IFX_Pause* pPause) {
}
return nRetStatus;
}
-int32_t CXFA_DocumentParser::ParseXMLData(const CFX_WideString& wsXML,
- CFDE_XMLNode*& pXMLNode,
- IFX_Pause* pPause) {
- CloseParser();
- int32_t nRetStatus = m_nodeParser.ParseXMLData(wsXML, pXMLNode, nullptr);
- if (nRetStatus == XFA_PARSESTATUS_Done && pXMLNode) {
- m_pDocument = new CXFA_Document(this);
- m_nodeParser.SetFactory(m_pDocument);
- }
- return nRetStatus;
-}
-void CXFA_DocumentParser::ConstructXFANode(CXFA_Node* pXFANode,
- CFDE_XMLNode* pXMLNode) {
- if (!pXFANode || !pXMLNode) {
- return;
- }
- m_nodeParser.ConstructXFANode(pXFANode, pXMLNode);
- CXFA_Node* pRootNode = m_nodeParser.GetRootNode();
- if (m_pDocument && pRootNode) {
- m_pDocument->SetRoot(pRootNode);
- }
-}
-
-CXFA_Document* CXFA_DocumentParser::GetFactory() const {
- return m_nodeParser.GetFactory();
-}
-
-CXFA_Node* CXFA_DocumentParser::GetRootNode() const {
- return m_nodeParser.GetRootNode();
-}
CFDE_XMLDoc* CXFA_DocumentParser::GetXMLDoc() const {
return m_nodeParser.GetXMLDoc();
@@ -1400,12 +1360,11 @@ CXFA_FFNotify* CXFA_DocumentParser::GetNotify() const {
}
CXFA_Document* CXFA_DocumentParser::GetDocument() const {
- return m_pDocument;
+ return m_pDocument.get();
}
void CXFA_DocumentParser::CloseParser() {
- delete m_pDocument;
- m_pDocument = nullptr;
+ m_pDocument.reset();
m_nodeParser.CloseParser();
}
« no previous file with comments | « xfa/fxfa/parser/xfa_parser_imp.h ('k') | xfa/fxfa/parser/xfa_script_datawindow.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698