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 | |
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')
-rw-r--r-- | xfa/fxfa/cxfa_ffdoc.cpp | 4 | ||||
-rw-r--r-- | xfa/fxfa/parser/cxfa_dataimporter.cpp | 4 | ||||
-rw-r--r-- | xfa/fxfa/parser/cxfa_document_parser.cpp (renamed from xfa/fxfa/parser/cxfa_simple_parser.cpp) | 84 | ||||
-rw-r--r-- | xfa/fxfa/parser/cxfa_document_parser.h (renamed from xfa/fxfa/parser/cxfa_simple_parser.h) | 14 | ||||
-rw-r--r-- | xfa/fxfa/parser/cxfa_document_parser_embeddertest.cpp (renamed from xfa/fxfa/parser/cxfa_simple_parser_embeddertest.cpp) | 0 | ||||
-rw-r--r-- | xfa/fxfa/parser/cxfa_node.cpp | 2 | ||||
-rw-r--r-- | xfa/fxfa/parser/cxfa_nodeowner.cpp | 2 |
7 files changed, 55 insertions, 55 deletions
diff --git a/xfa/fxfa/cxfa_ffdoc.cpp b/xfa/fxfa/cxfa_ffdoc.cpp index c0bd7816fc..c7642cf977 100644 --- a/xfa/fxfa/cxfa_ffdoc.cpp +++ b/xfa/fxfa/cxfa_ffdoc.cpp @@ -33,9 +33,9 @@ #include "xfa/fxfa/parser/cxfa_dataexporter.h" #include "xfa/fxfa/parser/cxfa_dataimporter.h" #include "xfa/fxfa/parser/cxfa_document.h" +#include "xfa/fxfa/parser/cxfa_document_parser.h" #include "xfa/fxfa/parser/cxfa_dynamicrender.h" #include "xfa/fxfa/parser/cxfa_node.h" -#include "xfa/fxfa/parser/cxfa_simple_parser.h" namespace { @@ -211,7 +211,7 @@ bool CXFA_FFDoc::Load() { bool CXFA_FFDoc::ParseDoc() { // Note, we don't pass the document into the constructor as currently that // triggers different behaviour in the parser. - CXFA_SimpleParser parser; + CXFA_DocumentParser parser; parser.SetFactory(m_pDocument.get()); if (!parser.Parse(m_pStream, XFA_PacketType::Xdp)) return false; diff --git a/xfa/fxfa/parser/cxfa_dataimporter.cpp b/xfa/fxfa/parser/cxfa_dataimporter.cpp index b44e5e0552..481f946fe0 100644 --- a/xfa/fxfa/parser/cxfa_dataimporter.cpp +++ b/xfa/fxfa/parser/cxfa_dataimporter.cpp @@ -14,8 +14,8 @@ #include "xfa/fxfa/fxfa.h" #include "xfa/fxfa/fxfa_basic.h" #include "xfa/fxfa/parser/cxfa_document.h" +#include "xfa/fxfa/parser/cxfa_document_parser.h" #include "xfa/fxfa/parser/cxfa_node.h" -#include "xfa/fxfa/parser/cxfa_simple_parser.h" CXFA_DataImporter::CXFA_DataImporter(CXFA_Document* pDocument) : m_pDocument(pDocument) { @@ -26,7 +26,7 @@ CXFA_DataImporter::~CXFA_DataImporter() {} bool CXFA_DataImporter::ImportData( const RetainPtr<IFX_SeekableStream>& pDataDocument) { - CXFA_SimpleParser parser(m_pDocument.Get()); + CXFA_DocumentParser parser(m_pDocument.Get()); if (!parser.Parse(pDataDocument, XFA_PacketType::Datasets)) return false; diff --git a/xfa/fxfa/parser/cxfa_simple_parser.cpp b/xfa/fxfa/parser/cxfa_document_parser.cpp index 232f1fbec8..707dfc11d5 100644 --- a/xfa/fxfa/parser/cxfa_simple_parser.cpp +++ b/xfa/fxfa/parser/cxfa_document_parser.cpp @@ -4,7 +4,7 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com -#include "xfa/fxfa/parser/cxfa_simple_parser.h" +#include "xfa/fxfa/parser/cxfa_document_parser.h" #include <utility> #include <vector> @@ -323,20 +323,20 @@ bool XFA_RecognizeRichText(CFX_XMLElement* pRichTextXMLNode) { L"http://www.w3.org/1999/xhtml"; } -CXFA_SimpleParser::CXFA_SimpleParser() : m_bDocumentParser(true) {} +CXFA_DocumentParser::CXFA_DocumentParser() : m_bDocumentParser(true) {} -CXFA_SimpleParser::CXFA_SimpleParser(CXFA_Document* pFactory) +CXFA_DocumentParser::CXFA_DocumentParser(CXFA_Document* pFactory) : m_pFactory(pFactory), m_bDocumentParser(false) {} -CXFA_SimpleParser::~CXFA_SimpleParser() {} +CXFA_DocumentParser::~CXFA_DocumentParser() {} -void CXFA_SimpleParser::SetFactory(CXFA_Document* pFactory) { +void CXFA_DocumentParser::SetFactory(CXFA_Document* pFactory) { ASSERT(m_bDocumentParser); m_pFactory = pFactory; } -bool CXFA_SimpleParser::Parse(const RetainPtr<IFX_SeekableStream>& pStream, - XFA_PacketType ePacketID) { +bool CXFA_DocumentParser::Parse(const RetainPtr<IFX_SeekableStream>& pStream, + XFA_PacketType ePacketID) { auto pStreamProxy = pdfium::MakeRetain<CFX_SeekableStreamProxy>(pStream, false); uint16_t wCodePage = pStreamProxy->GetCodePage(); @@ -354,7 +354,7 @@ bool CXFA_SimpleParser::Parse(const RetainPtr<IFX_SeekableStream>& pStream, return !!m_pRootNode; } -CFX_XMLNode* CXFA_SimpleParser::ParseXMLData(const ByteString& wsXML) { +CFX_XMLNode* CXFA_DocumentParser::ParseXMLData(const ByteString& wsXML) { auto pStream = pdfium::MakeRetain<CFX_SeekableStreamProxy>( const_cast<uint8_t*>(wsXML.raw_str()), wsXML.GetLength()); CFX_XMLDoc doc; @@ -364,8 +364,8 @@ CFX_XMLNode* CXFA_SimpleParser::ParseXMLData(const ByteString& wsXML) { return m_pNodeTree ? GetDocumentNode(m_pNodeTree.get()) : nullptr; } -void CXFA_SimpleParser::ConstructXFANode(CXFA_Node* pXFANode, - CFX_XMLNode* pXMLNode) { +void CXFA_DocumentParser::ConstructXFANode(CXFA_Node* pXFANode, + CFX_XMLNode* pXMLNode) { XFA_PacketType ePacketID = pXFANode->GetPacketType(); if (ePacketID == XFA_PacketType::Datasets) { if (pXFANode->GetElementType() == XFA_Element::DataValue) { @@ -408,12 +408,12 @@ void CXFA_SimpleParser::ConstructXFANode(CXFA_Node* pXFANode, } } -CXFA_Node* CXFA_SimpleParser::GetRootNode() const { +CXFA_Node* CXFA_DocumentParser::GetRootNode() const { return m_pRootNode; } -CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket(CFX_XMLNode* pXMLDocumentNode, - XFA_PacketType ePacketID) { +CXFA_Node* CXFA_DocumentParser::ParseAsXDPPacket(CFX_XMLNode* pXMLDocumentNode, + XFA_PacketType ePacketID) { switch (ePacketID) { case XFA_PacketType::Xdp: return ParseAsXDPPacket_XDP(pXMLDocumentNode); @@ -442,7 +442,7 @@ CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket(CFX_XMLNode* pXMLDocumentNode, } } -CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket_XDP( +CXFA_Node* CXFA_DocumentParser::ParseAsXDPPacket_XDP( CFX_XMLNode* pXMLDocumentNode) { const PacketInfo* packet = GetPacketByIndex(XFA_PacketType::Xdp); if (!MatchNodeName(pXMLDocumentNode, packet->name, packet->uri, @@ -564,7 +564,7 @@ CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket_XDP( return pXFARootNode; } -CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket_Config( +CXFA_Node* CXFA_DocumentParser::ParseAsXDPPacket_Config( CFX_XMLNode* pXMLDocumentNode) { const PacketInfo* packet = GetPacketByIndex(XFA_PacketType::Config); if (!MatchNodeName(pXMLDocumentNode, packet->name, packet->uri, @@ -584,7 +584,7 @@ CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket_Config( return pNode; } -CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket_Template( +CXFA_Node* CXFA_DocumentParser::ParseAsXDPPacket_Template( CFX_XMLNode* pXMLDocumentNode) { const PacketInfo* packet = GetPacketByIndex(XFA_PacketType::Template); if (!MatchNodeName(pXMLDocumentNode, packet->name, packet->uri, @@ -614,7 +614,7 @@ CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket_Template( return pNode; } -CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket_Form( +CXFA_Node* CXFA_DocumentParser::ParseAsXDPPacket_Form( CFX_XMLNode* pXMLDocumentNode) { const PacketInfo* packet = GetPacketByIndex(XFA_PacketType::Form); if (!MatchNodeName(pXMLDocumentNode, packet->name, packet->uri, @@ -648,7 +648,7 @@ CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket_Form( return pNode; } -CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket_Data( +CXFA_Node* CXFA_DocumentParser::ParseAsXDPPacket_Data( CFX_XMLNode* pXMLDocumentNode) { CFX_XMLNode* pDatasetsXMLNode = GetDataSetsFromXDP(pXMLDocumentNode); const PacketInfo* packet = GetPacketByIndex(XFA_PacketType::Datasets); @@ -704,7 +704,7 @@ CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket_Data( return pNode; } -CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket_LocaleConnectionSourceSet( +CXFA_Node* CXFA_DocumentParser::ParseAsXDPPacket_LocaleConnectionSourceSet( CFX_XMLNode* pXMLDocumentNode, XFA_PacketType packet_type, XFA_Element element) { @@ -726,7 +726,7 @@ CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket_LocaleConnectionSourceSet( return pNode; } -CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket_Xdc( +CXFA_Node* CXFA_DocumentParser::ParseAsXDPPacket_Xdc( CFX_XMLNode* pXMLDocumentNode) { const PacketInfo* packet = GetPacketByIndex(XFA_PacketType::Xdc); if (!MatchNodeName(pXMLDocumentNode, packet->name, packet->uri, @@ -743,7 +743,7 @@ CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket_Xdc( return pNode; } -CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket_User( +CXFA_Node* CXFA_DocumentParser::ParseAsXDPPacket_User( CFX_XMLNode* pXMLDocumentNode) { CXFA_Node* pNode = m_pFactory->CreateNode(XFA_PacketType::Xdp, XFA_Element::Packet); @@ -760,22 +760,22 @@ CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket_User( return pNode; } -CXFA_Node* CXFA_SimpleParser::UserPacketLoader(CXFA_Node* pXFANode, - CFX_XMLNode* pXMLDoc) { +CXFA_Node* CXFA_DocumentParser::UserPacketLoader(CXFA_Node* pXFANode, + CFX_XMLNode* pXMLDoc) { return pXFANode; } -CXFA_Node* CXFA_SimpleParser::DataLoader(CXFA_Node* pXFANode, - CFX_XMLNode* pXMLDoc, - bool bDoTransform) { +CXFA_Node* CXFA_DocumentParser::DataLoader(CXFA_Node* pXFANode, + CFX_XMLNode* pXMLDoc, + bool bDoTransform) { ParseDataGroup(pXFANode, pXMLDoc, XFA_PacketType::Datasets); return pXFANode; } -CXFA_Node* CXFA_SimpleParser::NormalLoader(CXFA_Node* pXFANode, - CFX_XMLNode* pXMLDoc, - XFA_PacketType ePacketID, - bool bUseAttribute) { +CXFA_Node* CXFA_DocumentParser::NormalLoader(CXFA_Node* pXFANode, + CFX_XMLNode* pXMLDoc, + XFA_PacketType ePacketID, + bool bUseAttribute) { bool bOneOfPropertyFound = false; for (CFX_XMLNode* pXMLChild = pXMLDoc->GetFirstChild(); pXMLChild; pXMLChild = pXMLChild->GetNextSibling()) { @@ -855,9 +855,9 @@ CXFA_Node* CXFA_SimpleParser::NormalLoader(CXFA_Node* pXFANode, return pXFANode; } -void CXFA_SimpleParser::ParseContentNode(CXFA_Node* pXFANode, - CFX_XMLNode* pXMLNode, - XFA_PacketType ePacketID) { +void CXFA_DocumentParser::ParseContentNode(CXFA_Node* pXFANode, + CFX_XMLNode* pXMLNode, + XFA_PacketType ePacketID) { XFA_Element element = XFA_Element::Sharptext; if (pXFANode->GetElementType() == XFA_Element::ExData) { WideString wsContentType = @@ -912,9 +912,9 @@ void CXFA_SimpleParser::ParseContentNode(CXFA_Node* pXFANode, } } -void CXFA_SimpleParser::ParseDataGroup(CXFA_Node* pXFANode, - CFX_XMLNode* pXMLNode, - XFA_PacketType ePacketID) { +void CXFA_DocumentParser::ParseDataGroup(CXFA_Node* pXFANode, + CFX_XMLNode* pXMLNode, + XFA_PacketType ePacketID) { for (CFX_XMLNode* pXMLChild = pXMLNode->GetFirstChild(); pXMLChild; pXMLChild = pXMLChild->GetNextSibling()) { switch (pXMLChild->GetType()) { @@ -1047,9 +1047,9 @@ void CXFA_SimpleParser::ParseDataGroup(CXFA_Node* pXFANode, } } -void CXFA_SimpleParser::ParseDataValue(CXFA_Node* pXFANode, - CFX_XMLNode* pXMLNode, - XFA_PacketType ePacketID) { +void CXFA_DocumentParser::ParseDataValue(CXFA_Node* pXFANode, + CFX_XMLNode* pXMLNode, + XFA_PacketType ePacketID) { CFX_WideTextBuf wsValueTextBuf; CFX_WideTextBuf wsCurValueTextBuf; bool bMarkAsCompound = false; @@ -1139,9 +1139,9 @@ void CXFA_SimpleParser::ParseDataValue(CXFA_Node* pXFANode, false); } -void CXFA_SimpleParser::ParseInstruction(CXFA_Node* pXFANode, - CFX_XMLInstruction* pXMLInstruction, - XFA_PacketType ePacketID) { +void CXFA_DocumentParser::ParseInstruction(CXFA_Node* pXFANode, + CFX_XMLInstruction* pXMLInstruction, + XFA_PacketType ePacketID) { if (!m_bDocumentParser) return; diff --git a/xfa/fxfa/parser/cxfa_simple_parser.h b/xfa/fxfa/parser/cxfa_document_parser.h index 157983fe8e..e41bf7bf07 100644 --- a/xfa/fxfa/parser/cxfa_simple_parser.h +++ b/xfa/fxfa/parser/cxfa_document_parser.h @@ -4,8 +4,8 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com -#ifndef XFA_FXFA_PARSER_CXFA_SIMPLE_PARSER_H_ -#define XFA_FXFA_PARSER_CXFA_SIMPLE_PARSER_H_ +#ifndef XFA_FXFA_PARSER_CXFA_DOCUMENT_PARSER_H_ +#define XFA_FXFA_PARSER_CXFA_DOCUMENT_PARSER_H_ #include <memory> #include <utility> @@ -20,11 +20,11 @@ class CFX_XMLInstruction; class IFX_SeekableStream; class CFX_SeekableStreamProxy; -class CXFA_SimpleParser { +class CXFA_DocumentParser { public: - CXFA_SimpleParser(); - explicit CXFA_SimpleParser(CXFA_Document* pFactory); - ~CXFA_SimpleParser(); + CXFA_DocumentParser(); + explicit CXFA_DocumentParser(CXFA_Document* pFactory); + ~CXFA_DocumentParser(); bool Parse(const RetainPtr<IFX_SeekableStream>& pStream, XFA_PacketType ePacketID); @@ -80,4 +80,4 @@ class CXFA_SimpleParser { const bool m_bDocumentParser; }; -#endif // XFA_FXFA_PARSER_CXFA_SIMPLE_PARSER_H_ +#endif // XFA_FXFA_PARSER_CXFA_DOCUMENT_PARSER_H_ diff --git a/xfa/fxfa/parser/cxfa_simple_parser_embeddertest.cpp b/xfa/fxfa/parser/cxfa_document_parser_embeddertest.cpp index 174febf9ee..174febf9ee 100644 --- a/xfa/fxfa/parser/cxfa_simple_parser_embeddertest.cpp +++ b/xfa/fxfa/parser/cxfa_document_parser_embeddertest.cpp diff --git a/xfa/fxfa/parser/cxfa_node.cpp b/xfa/fxfa/parser/cxfa_node.cpp index 3823d2eae0..ff9475970f 100644 --- a/xfa/fxfa/parser/cxfa_node.cpp +++ b/xfa/fxfa/parser/cxfa_node.cpp @@ -48,6 +48,7 @@ #include "xfa/fxfa/parser/cxfa_comb.h" #include "xfa/fxfa/parser/cxfa_decimal.h" #include "xfa/fxfa/parser/cxfa_document.h" +#include "xfa/fxfa/parser/cxfa_document_parser.h" #include "xfa/fxfa/parser/cxfa_event.h" #include "xfa/fxfa/parser/cxfa_font.h" #include "xfa/fxfa/parser/cxfa_format.h" @@ -62,7 +63,6 @@ #include "xfa/fxfa/parser/cxfa_occur.h" #include "xfa/fxfa/parser/cxfa_para.h" #include "xfa/fxfa/parser/cxfa_picture.h" -#include "xfa/fxfa/parser/cxfa_simple_parser.h" #include "xfa/fxfa/parser/cxfa_stroke.h" #include "xfa/fxfa/parser/cxfa_subform.h" #include "xfa/fxfa/parser/cxfa_traversestrategy_xfacontainernode.h" diff --git a/xfa/fxfa/parser/cxfa_nodeowner.cpp b/xfa/fxfa/parser/cxfa_nodeowner.cpp index 63f2f717c2..dba32dc889 100644 --- a/xfa/fxfa/parser/cxfa_nodeowner.cpp +++ b/xfa/fxfa/parser/cxfa_nodeowner.cpp @@ -21,7 +21,7 @@ void CXFA_NodeOwner::ReleaseXMLNodesIfNeeded() { // it. This will cause the ProbeForLowSeverityLifetimeIssue to fire. // // This doesn't happen in the destructor because of the ownership semantics - // between the CXFA_Document and CXFA_SimpleParser. It has to happen before + // between the CXFA_Document and CXFA_DocumentParser. It has to happen before // the simple parser is destroyed, but the document has to live longer then // the simple parser. for (auto& it : nodes_) |