diff options
author | Dan Sinclair <dsinclair@chromium.org> | 2017-04-04 15:10:00 -0400 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-04-04 19:54:55 +0000 |
commit | 93bfc262074abf003ba4ab0ff1d9767d8dfa9a3d (patch) | |
tree | fd2c2c9d0a99923d397501f85e780498928a7e35 /xfa/fxfa/parser/cxfa_simple_parser.cpp | |
parent | b2fb20e0f8e7ea368c541d35ccb61506041f7ddd (diff) | |
download | pdfium-93bfc262074abf003ba4ab0ff1d9767d8dfa9a3d.tar.xz |
Cleanup CFDE_XMLCharData and CFDE_XMLText
This Cl switchs CFDE_XMLCharData to subclass CFDE_XMLText and cleans up
the code which was the same except for the accessor names.
Change-Id: I85ebf4f3f19f0d15be4dd77a71b89ca8083f4b1e
Reviewed-on: https://pdfium-review.googlesource.com/3672
Commit-Queue: dsinclair <dsinclair@chromium.org>
Reviewed-by: Nicolás Peña <npm@chromium.org>
Diffstat (limited to 'xfa/fxfa/parser/cxfa_simple_parser.cpp')
-rw-r--r-- | xfa/fxfa/parser/cxfa_simple_parser.cpp | 55 |
1 files changed, 10 insertions, 45 deletions
diff --git a/xfa/fxfa/parser/cxfa_simple_parser.cpp b/xfa/fxfa/parser/cxfa_simple_parser.cpp index 06e2e5d704..cb6a90d2a5 100644 --- a/xfa/fxfa/parser/cxfa_simple_parser.cpp +++ b/xfa/fxfa/parser/cxfa_simple_parser.cpp @@ -213,24 +213,16 @@ void ConvertXMLToPlainText(CFDE_XMLElement* pRootXMLNode, wsOutput += wsTextData; break; } - case FDE_XMLNODE_Text: { - CFX_WideString wsText; - static_cast<CFDE_XMLText*>(pXMLChild)->GetText(wsText); + case FDE_XMLNODE_Text: + case FDE_XMLNODE_CharData: { + CFX_WideString wsText = + static_cast<CFDE_XMLText*>(pXMLChild)->GetText(); if (IsStringAllWhitespace(wsText)) continue; wsOutput = wsText; break; } - case FDE_XMLNODE_CharData: { - CFX_WideString wsCharData; - static_cast<CFDE_XMLCharData*>(pXMLChild)->GetCharData(wsCharData); - if (IsStringAllWhitespace(wsCharData)) - continue; - - wsOutput = wsCharData; - break; - } default: ASSERT(false); break; @@ -1004,10 +996,8 @@ void CXFA_SimpleParser::ParseContentNode(CXFA_Node* pXFANode, } else { if (eNodeType == FDE_XMLNODE_Element) break; - if (eNodeType == FDE_XMLNODE_Text) - static_cast<CFDE_XMLText*>(pXMLChild)->GetText(wsValue); - else if (eNodeType == FDE_XMLNODE_CharData) - static_cast<CFDE_XMLCharData*>(pXMLChild)->GetCharData(wsValue); + if (eNodeType == FDE_XMLNODE_Text || eNodeType == FDE_XMLNODE_CharData) + wsValue = static_cast<CFDE_XMLText*>(pXMLChild)->GetText(); } break; } @@ -1140,29 +1130,10 @@ void CXFA_SimpleParser::ParseDataGroup(CXFA_Node* pXFANode, pXFAChild->SetFlag(XFA_NodeFlag_Initialized, false); continue; } - case FDE_XMLNODE_CharData: { - CFDE_XMLCharData* pXMLCharData = - static_cast<CFDE_XMLCharData*>(pXMLChild); - CFX_WideString wsCharData; - pXMLCharData->GetCharData(wsCharData); - if (IsStringAllWhitespace(wsCharData)) - continue; - - CXFA_Node* pXFAChild = m_pFactory->CreateNode(XFA_XDPPACKET_Datasets, - XFA_Element::DataValue); - if (!pXFAChild) - return; - - pXFAChild->SetCData(XFA_ATTRIBUTE_Value, wsCharData); - pXFANode->InsertChild(pXFAChild); - pXFAChild->SetXMLMappingNode(pXMLCharData); - pXFAChild->SetFlag(XFA_NodeFlag_Initialized, false); - continue; - } + case FDE_XMLNODE_CharData: case FDE_XMLNODE_Text: { CFDE_XMLText* pXMLText = static_cast<CFDE_XMLText*>(pXMLChild); - CFX_WideString wsText; - pXMLText->GetText(wsText); + CFX_WideString wsText = pXMLText->GetText(); if (IsStringAllWhitespace(wsText)) continue; @@ -1199,14 +1170,8 @@ void CXFA_SimpleParser::ParseDataValue(CXFA_Node* pXFANode, continue; CFX_WideString wsText; - if (eNodeType == FDE_XMLNODE_Text) { - static_cast<CFDE_XMLText*>(pXMLChild)->GetText(wsText); - if (!pXMLCurValueNode) - pXMLCurValueNode = pXMLChild; - - wsCurValueTextBuf << wsText; - } else if (eNodeType == FDE_XMLNODE_CharData) { - static_cast<CFDE_XMLCharData*>(pXMLChild)->GetCharData(wsText); + if (eNodeType == FDE_XMLNODE_Text || eNodeType == FDE_XMLNODE_CharData) { + wsText = static_cast<CFDE_XMLText*>(pXMLChild)->GetText(); if (!pXMLCurValueNode) pXMLCurValueNode = pXMLChild; |