File: cxfa_document_parser.cpp

package info (click to toggle)
texmaker 6.0.1%2Bdfsg-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 72,964 kB
  • sloc: cpp: 417,556; ansic: 102,526; python: 1,935; xml: 1,739; sh: 42; makefile: 36
file content (50 lines) | stat: -rw-r--r-- 1,488 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
// 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 "xfa/fxfa/fxfa.h"
#include "xfa/fxfa/parser/cxfa_document.h"

CXFA_DocumentParser::CXFA_DocumentParser(CXFA_FFNotify* pNotify)
    : m_nodeParser(nullptr, true), m_pNotify(pNotify) {}

CXFA_DocumentParser::~CXFA_DocumentParser() {
}

int32_t CXFA_DocumentParser::StartParse(IFX_SeekableReadStream* pStream,
                                        XFA_XDPPACKET ePacketID) {
  m_pDocument.reset();
  m_nodeParser.CloseParser();

  int32_t nRetStatus = m_nodeParser.StartParse(pStream, ePacketID);
  if (nRetStatus == XFA_PARSESTATUS_Ready) {
    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) {
    ASSERT(m_pDocument);
    m_pDocument->SetRoot(m_nodeParser.GetRootNode());
  }
  return nRetStatus;
}

CFDE_XMLDoc* CXFA_DocumentParser::GetXMLDoc() const {
  return m_nodeParser.GetXMLDoc();
}

CXFA_FFNotify* CXFA_DocumentParser::GetNotify() const {
  return m_pNotify;
}

CXFA_Document* CXFA_DocumentParser::GetDocument() const {
  return m_pDocument.get();
}