summaryrefslogtreecommitdiff
path: root/xfa/fde/xml/cfde_xmlnode.cpp
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2017-04-04 15:10:00 -0400
committerChromium commit bot <commit-bot@chromium.org>2017-04-04 19:54:55 +0000
commit93bfc262074abf003ba4ab0ff1d9767d8dfa9a3d (patch)
treefd2c2c9d0a99923d397501f85e780498928a7e35 /xfa/fde/xml/cfde_xmlnode.cpp
parentb2fb20e0f8e7ea368c541d35ccb61506041f7ddd (diff)
downloadpdfium-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/fde/xml/cfde_xmlnode.cpp')
-rw-r--r--xfa/fde/xml/cfde_xmlnode.cpp35
1 files changed, 11 insertions, 24 deletions
diff --git a/xfa/fde/xml/cfde_xmlnode.cpp b/xfa/fde/xml/cfde_xmlnode.cpp
index bd86c0b071..22bd262bf2 100644
--- a/xfa/fde/xml/cfde_xmlnode.cpp
+++ b/xfa/fde/xml/cfde_xmlnode.cpp
@@ -325,7 +325,7 @@ CFDE_XMLNode* CFDE_XMLNode::RemoveNodeItem(CFDE_XMLNode::NodeItem eItem) {
return pNode;
}
-CFDE_XMLNode* CFDE_XMLNode::Clone(bool bRecursive) {
+std::unique_ptr<CFDE_XMLNode> CFDE_XMLNode::Clone() {
return nullptr;
}
@@ -379,7 +379,8 @@ void CFDE_XMLNode::SaveXMLNode(const CFX_RetainPtr<IFGAS_Stream>& pXMLStream) {
ws = L"?>";
pXMLStream->WriteString(ws.c_str(), ws.GetLength());
}
- } break;
+ break;
+ }
case FDE_XMLNODE_Element: {
CFX_WideString ws;
ws = L"<";
@@ -418,41 +419,27 @@ void CFDE_XMLNode::SaveXMLNode(const CFX_RetainPtr<IFGAS_Stream>& pXMLStream) {
ws = L"\n/>";
}
pXMLStream->WriteString(ws.c_str(), ws.GetLength());
- } break;
+ break;
+ }
case FDE_XMLNODE_Text: {
- CFX_WideString ws = ((CFDE_XMLText*)pNode)->m_wsText;
+ CFX_WideString ws = static_cast<CFDE_XMLText*>(pNode)->GetText();
ws.Replace(L"&", L"&amp;");
ws.Replace(L"<", L"&lt;");
ws.Replace(L">", L"&gt;");
ws.Replace(L"\'", L"&apos;");
ws.Replace(L"\"", L"&quot;");
pXMLStream->WriteString(ws.c_str(), ws.GetLength());
- } break;
+ break;
+ }
case FDE_XMLNODE_CharData: {
CFX_WideString ws = L"<![CDATA[";
- ws += ((CFDE_XMLCharData*)pNode)->m_wsCharData;
+ ws += static_cast<CFDE_XMLCharData*>(pNode)->GetText();
ws += L"]]>";
pXMLStream->WriteString(ws.c_str(), ws.GetLength());
- } break;
- case FDE_XMLNODE_Unknown:
break;
+ }
+ case FDE_XMLNODE_Unknown:
default:
break;
}
}
-
-void CFDE_XMLNode::CloneChildren(CFDE_XMLNode* pClone) {
- if (!m_pChild) {
- return;
- }
- CFDE_XMLNode* pNext = m_pChild;
- CFDE_XMLNode* pCloneNext = pNext->Clone(true);
- pClone->InsertChildNode(pCloneNext);
- pNext = pNext->m_pNext;
- while (pNext) {
- CFDE_XMLNode* pChild = pNext->Clone(true);
- pCloneNext->InsertNodeItem(CFDE_XMLNode::NextSibling, pChild);
- pCloneNext = pChild;
- pNext = pNext->m_pNext;
- }
-}