diff options
author | Dan Sinclair <dsinclair@chromium.org> | 2018-04-12 13:39:28 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2018-04-12 13:39:28 +0000 |
commit | 876efaa771afe7ebd7a97dc748abdbb5b266a99b (patch) | |
tree | 2ecab1920b8dc3ca752bca79ceb6bc5108f47293 /xfa/fxfa/parser/cxfa_document_parser.h | |
parent | 0cad1163af80cfcc987a3d431fbd05fa3e09151b (diff) | |
download | pdfium-876efaa771afe7ebd7a97dc748abdbb5b266a99b.tar.xz |
Rename CXFA_SimpleParser to CXFA_DocumentParser
The CXFA_SimpleParser is handling the XFA document parsing. This CL
renames the class to make it clearer that this is the XFA document
parser.
Change-Id: Ia290df2671fba9efa221ae997156ee4846749b02
Reviewed-on: https://pdfium-review.googlesource.com/30231
Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'xfa/fxfa/parser/cxfa_document_parser.h')
-rw-r--r-- | xfa/fxfa/parser/cxfa_document_parser.h | 83 |
1 files changed, 83 insertions, 0 deletions
diff --git a/xfa/fxfa/parser/cxfa_document_parser.h b/xfa/fxfa/parser/cxfa_document_parser.h new file mode 100644 index 0000000000..e41bf7bf07 --- /dev/null +++ b/xfa/fxfa/parser/cxfa_document_parser.h @@ -0,0 +1,83 @@ +// Copyright 2014 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 <utility> + +#include "core/fxcrt/xml/cfx_xmlnode.h" +#include "xfa/fxfa/fxfa_basic.h" + +class CXFA_Document; +class CXFA_Node; +class CFX_XMLDoc; +class CFX_XMLInstruction; +class IFX_SeekableStream; +class CFX_SeekableStreamProxy; + +class CXFA_DocumentParser { + public: + CXFA_DocumentParser(); + explicit CXFA_DocumentParser(CXFA_Document* pFactory); + ~CXFA_DocumentParser(); + + bool Parse(const RetainPtr<IFX_SeekableStream>& pStream, + XFA_PacketType ePacketID); + + CFX_XMLNode* ParseXMLData(const ByteString& wsXML); + void ConstructXFANode(CXFA_Node* pXFANode, CFX_XMLNode* pXMLNode); + + std::unique_ptr<CFX_XMLNode> GetXMLRoot() { return std::move(m_pNodeTree); } + CXFA_Node* GetRootNode() const; + + // Called later for the ctor with no parameters. + void SetFactory(CXFA_Document* pFactory); + + private: + CXFA_Node* ParseAsXDPPacket(CFX_XMLNode* pXMLDocumentNode, + XFA_PacketType ePacketID); + CXFA_Node* ParseAsXDPPacket_XDP(CFX_XMLNode* pXMLDocumentNode); + CXFA_Node* ParseAsXDPPacket_Config(CFX_XMLNode* pXMLDocumentNode); + CXFA_Node* ParseAsXDPPacket_Template(CFX_XMLNode* pXMLDocumentNode); + CXFA_Node* ParseAsXDPPacket_Form(CFX_XMLNode* pXMLDocumentNode); + CXFA_Node* ParseAsXDPPacket_Data(CFX_XMLNode* pXMLDocumentNode); + CXFA_Node* ParseAsXDPPacket_LocaleConnectionSourceSet( + CFX_XMLNode* pXMLDocumentNode, + XFA_PacketType packet_type, + XFA_Element element); + CXFA_Node* ParseAsXDPPacket_Xdc(CFX_XMLNode* pXMLDocumentNode); + CXFA_Node* ParseAsXDPPacket_User(CFX_XMLNode* pXMLDocumentNode); + CXFA_Node* NormalLoader(CXFA_Node* pXFANode, + CFX_XMLNode* pXMLDoc, + XFA_PacketType ePacketID, + bool bUseAttribute); + CXFA_Node* DataLoader(CXFA_Node* pXFANode, + CFX_XMLNode* pXMLDoc, + bool bDoTransform); + CXFA_Node* UserPacketLoader(CXFA_Node* pXFANode, CFX_XMLNode* pXMLDoc); + void ParseContentNode(CXFA_Node* pXFANode, + CFX_XMLNode* pXMLNode, + XFA_PacketType ePacketID); + void ParseDataValue(CXFA_Node* pXFANode, + CFX_XMLNode* pXMLNode, + XFA_PacketType ePacketID); + void ParseDataGroup(CXFA_Node* pXFANode, + CFX_XMLNode* pXMLNode, + XFA_PacketType ePacketID); + void ParseInstruction(CXFA_Node* pXFANode, + CFX_XMLInstruction* pXMLInstruction, + XFA_PacketType ePacketID); + + UnownedPtr<CXFA_Document> m_pFactory; + std::unique_ptr<CFX_XMLNode> m_pNodeTree; + // TODO(dsinclair): Figure out who owns this. + CXFA_Node* m_pRootNode = nullptr; + const bool m_bDocumentParser; +}; + +#endif // XFA_FXFA_PARSER_CXFA_DOCUMENT_PARSER_H_ |