OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2014 PDFium Authors. All rights reserved. | |
Wei Li
2016/07/07 21:34:13
2016?
dsinclair
2016/07/11 13:36:06
Done.
| |
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 #include "xfa/fxfa/parser/cxfa_document_parser.h" | |
8 | |
9 #include "xfa/fxfa/include/fxfa.h" | |
10 #include "xfa/fxfa/parser/xfa_document.h" | |
11 | |
12 CXFA_DocumentParser::CXFA_DocumentParser(CXFA_FFNotify* pNotify) | |
13 : m_nodeParser(nullptr, TRUE), m_pNotify(pNotify), m_pDocument(nullptr) {} | |
Wei Li
2016/07/07 21:34:13
no need to init m_pDocument
dsinclair
2016/07/11 13:36:06
Done.
| |
14 | |
15 CXFA_DocumentParser::~CXFA_DocumentParser() { | |
16 CloseParser(); | |
17 } | |
18 | |
19 int32_t CXFA_DocumentParser::StartParse(IFX_FileRead* pStream, | |
20 XFA_XDPPACKET ePacketID) { | |
21 CloseParser(); | |
22 int32_t nRetStatus = m_nodeParser.StartParse(pStream, ePacketID); | |
23 if (nRetStatus == XFA_PARSESTATUS_Ready) { | |
24 m_pDocument.reset(new CXFA_Document(this)); | |
25 m_nodeParser.SetFactory(m_pDocument.get()); | |
26 } | |
27 return nRetStatus; | |
28 } | |
29 | |
30 int32_t CXFA_DocumentParser::DoParse(IFX_Pause* pPause) { | |
31 int32_t nRetStatus = m_nodeParser.DoParse(pPause); | |
32 if (nRetStatus >= XFA_PARSESTATUS_Done) { | |
33 ASSERT(m_pDocument); | |
34 m_pDocument->SetRoot(m_nodeParser.GetRootNode()); | |
35 } | |
36 return nRetStatus; | |
37 } | |
38 | |
39 CFDE_XMLDoc* CXFA_DocumentParser::GetXMLDoc() const { | |
40 return m_nodeParser.GetXMLDoc(); | |
41 } | |
42 | |
43 CXFA_FFNotify* CXFA_DocumentParser::GetNotify() const { | |
44 return m_pNotify; | |
45 } | |
46 | |
47 CXFA_Document* CXFA_DocumentParser::GetDocument() const { | |
48 return m_pDocument.get(); | |
49 } | |
50 | |
51 void CXFA_DocumentParser::CloseParser() { | |
52 m_pDocument.reset(); | |
53 m_nodeParser.CloseParser(); | |
54 } | |
OLD | NEW |