diff options
author | Dan Sinclair <dsinclair@chromium.org> | 2017-03-30 16:49:42 -0400 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-03-30 21:15:09 +0000 |
commit | bd9237eb346946b0caa291504c3a5f54e9b1bb3f (patch) | |
tree | 0836e4e33080823c4562390ada7c57004fefc5c6 /xfa/fde/xml/fde_xml_imp.cpp | |
parent | 574b574064af5ec0dabf8d49d98d25af6c5d5925 (diff) | |
download | pdfium-bd9237eb346946b0caa291504c3a5f54e9b1bb3f.tar.xz |
Move CXFA_XMLParser to CFDE_XMLParser
There is nothing XFA specific in the CXFA_XMLParser. This Cl moves it to
the CFDE_XMLParser and co-locates with the other XML code.
Change-Id: I86c12da3f6f5732be54b8019562978f88234e2fc
Reviewed-on: https://pdfium-review.googlesource.com/3432
Reviewed-by: Nicolás Peña <npm@chromium.org>
Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'xfa/fde/xml/fde_xml_imp.cpp')
-rw-r--r-- | xfa/fde/xml/fde_xml_imp.cpp | 31 |
1 files changed, 2 insertions, 29 deletions
diff --git a/xfa/fde/xml/fde_xml_imp.cpp b/xfa/fde/xml/fde_xml_imp.cpp index ade8fc0557..68a4978209 100644 --- a/xfa/fde/xml/fde_xml_imp.cpp +++ b/xfa/fde/xml/fde_xml_imp.cpp @@ -13,6 +13,7 @@ #include "core/fxcrt/fx_safe_types.h" #include "third_party/base/ptr_util.h" #include "third_party/base/stl_util.h" +#include "xfa/fde/xml/cfde_xml_parser.h" #include "xfa/fgas/crt/fgas_codepage.h" namespace { @@ -917,7 +918,7 @@ CFDE_XMLDoc::CFDE_XMLDoc() CFDE_XMLDoc::~CFDE_XMLDoc() {} -bool CFDE_XMLDoc::LoadXML(std::unique_ptr<IFDE_XMLParser> pXMLParser) { +bool CFDE_XMLDoc::LoadXML(std::unique_ptr<CFDE_XMLParser> pXMLParser) { if (!pXMLParser) return false; @@ -1052,34 +1053,6 @@ void CFDE_XMLDoc::SaveXMLNode(const CFX_RetainPtr<IFGAS_Stream>& pXMLStream, } } -void CFDE_XMLDoc::SaveXML(CFX_RetainPtr<IFGAS_Stream>& pXMLStream, - bool bSaveBOM) { - if (!pXMLStream || pXMLStream == m_pStream) { - m_pStream->Seek(FX_STREAMSEEK_Begin, 0); - pXMLStream = m_pStream; - } - ASSERT((pXMLStream->GetAccessModes() & FX_STREAMACCESS_Text) != 0); - ASSERT((pXMLStream->GetAccessModes() & FX_STREAMACCESS_Write) != 0); - uint16_t wCodePage = pXMLStream->GetCodePage(); - if (wCodePage != FX_CODEPAGE_UTF16LE && wCodePage != FX_CODEPAGE_UTF16BE && - wCodePage != FX_CODEPAGE_UTF8) { - wCodePage = FX_CODEPAGE_UTF8; - pXMLStream->SetCodePage(wCodePage); - } - if (bSaveBOM) { - pXMLStream->WriteString(L"\xFEFF", 1); - } - CFDE_XMLNode* pNode = m_pRoot->m_pChild; - while (pNode) { - SaveXMLNode(pXMLStream, static_cast<CFDE_XMLNode*>(pNode)); - pNode = pNode->m_pNext; - } - if (pXMLStream == m_pStream) { - int32_t iPos = pXMLStream->GetPosition(); - pXMLStream->SetLength(iPos); - } -} - CFDE_BlockBuffer::CFDE_BlockBuffer(int32_t iAllocStep) : m_iDataLength(0), m_iBufferSize(0), |