Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(66)

Side by Side Diff: xfa/fde/xml/fde_xml_imp.cpp

Issue 2535723010: Rename IFX_Stream to IFGAS_Stream. (Closed)
Patch Set: rename more to IFGAS, {} Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « xfa/fde/xml/fde_xml_imp.h ('k') | xfa/fde/xml/fde_xml_imp_unittest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 PDFium Authors. All rights reserved. 1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 6
7 #include "xfa/fde/xml/fde_xml_imp.h" 7 #include "xfa/fde/xml/fde_xml_imp.h"
8 8
9 #include <algorithm> 9 #include <algorithm>
10 10
(...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after
387 default: 387 default:
388 break; 388 break;
389 } 389 }
390 return pNode; 390 return pNode;
391 } 391 }
392 392
393 CFDE_XMLNode* CFDE_XMLNode::Clone(bool bRecursive) { 393 CFDE_XMLNode* CFDE_XMLNode::Clone(bool bRecursive) {
394 return nullptr; 394 return nullptr;
395 } 395 }
396 396
397 void CFDE_XMLNode::SaveXMLNode(IFX_Stream* pXMLStream) { 397 void CFDE_XMLNode::SaveXMLNode(IFGAS_Stream* pXMLStream) {
398 CFDE_XMLNode* pNode = (CFDE_XMLNode*)this; 398 CFDE_XMLNode* pNode = (CFDE_XMLNode*)this;
399 switch (pNode->GetType()) { 399 switch (pNode->GetType()) {
400 case FDE_XMLNODE_Instruction: { 400 case FDE_XMLNODE_Instruction: {
401 CFX_WideString ws; 401 CFX_WideString ws;
402 CFDE_XMLInstruction* pInstruction = (CFDE_XMLInstruction*)pNode; 402 CFDE_XMLInstruction* pInstruction = (CFDE_XMLInstruction*)pNode;
403 if (pInstruction->m_wsTarget.CompareNoCase(L"xml") == 0) { 403 if (pInstruction->m_wsTarget.CompareNoCase(L"xml") == 0) {
404 ws = L"<?xml version=\"1.0\" encoding=\""; 404 ws = L"<?xml version=\"1.0\" encoding=\"";
405 uint16_t wCodePage = pXMLStream->GetCodePage(); 405 uint16_t wCodePage = pXMLStream->GetCodePage();
406 if (wCodePage == FX_CODEPAGE_UTF16LE) { 406 if (wCodePage == FX_CODEPAGE_UTF16LE) {
407 ws += L"UTF-16"; 407 ws += L"UTF-16";
(...skipping 571 matching lines...) Expand 10 before | Expand all | Expand 10 after
979 int32_t CFDE_XMLDoc::DoLoad(IFX_Pause* pPause) { 979 int32_t CFDE_XMLDoc::DoLoad(IFX_Pause* pPause) {
980 if (m_iStatus >= 100) 980 if (m_iStatus >= 100)
981 return m_iStatus; 981 return m_iStatus;
982 return m_iStatus = m_pXMLParser->DoParser(pPause); 982 return m_iStatus = m_pXMLParser->DoParser(pPause);
983 } 983 }
984 984
985 void CFDE_XMLDoc::CloseXML() { 985 void CFDE_XMLDoc::CloseXML() {
986 ReleaseParser(); 986 ReleaseParser();
987 } 987 }
988 988
989 void CFDE_XMLDoc::SaveXMLNode(IFX_Stream* pXMLStream, CFDE_XMLNode* pINode) { 989 void CFDE_XMLDoc::SaveXMLNode(IFGAS_Stream* pXMLStream, CFDE_XMLNode* pINode) {
990 CFDE_XMLNode* pNode = (CFDE_XMLNode*)pINode; 990 CFDE_XMLNode* pNode = (CFDE_XMLNode*)pINode;
991 switch (pNode->GetType()) { 991 switch (pNode->GetType()) {
992 case FDE_XMLNODE_Instruction: { 992 case FDE_XMLNODE_Instruction: {
993 CFX_WideString ws; 993 CFX_WideString ws;
994 CFDE_XMLInstruction* pInstruction = (CFDE_XMLInstruction*)pNode; 994 CFDE_XMLInstruction* pInstruction = (CFDE_XMLInstruction*)pNode;
995 if (pInstruction->m_wsTarget.CompareNoCase(L"xml") == 0) { 995 if (pInstruction->m_wsTarget.CompareNoCase(L"xml") == 0) {
996 ws = L"<?xml version=\"1.0\" encoding=\""; 996 ws = L"<?xml version=\"1.0\" encoding=\"";
997 uint16_t wCodePage = pXMLStream->GetCodePage(); 997 uint16_t wCodePage = pXMLStream->GetCodePage();
998 if (wCodePage == FX_CODEPAGE_UTF16LE) { 998 if (wCodePage == FX_CODEPAGE_UTF16LE) {
999 ws += L"UTF-16"; 999 ws += L"UTF-16";
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
1089 ws += L"]]>"; 1089 ws += L"]]>";
1090 pXMLStream->WriteString(ws.c_str(), ws.GetLength()); 1090 pXMLStream->WriteString(ws.c_str(), ws.GetLength());
1091 } break; 1091 } break;
1092 case FDE_XMLNODE_Unknown: 1092 case FDE_XMLNODE_Unknown:
1093 break; 1093 break;
1094 default: 1094 default:
1095 break; 1095 break;
1096 } 1096 }
1097 } 1097 }
1098 1098
1099 void CFDE_XMLDoc::SaveXML(IFX_Stream* pXMLStream, bool bSaveBOM) { 1099 void CFDE_XMLDoc::SaveXML(IFGAS_Stream* pXMLStream, bool bSaveBOM) {
1100 if (!pXMLStream || pXMLStream == m_pStream) { 1100 if (!pXMLStream || pXMLStream == m_pStream) {
1101 m_pStream->Seek(FX_STREAMSEEK_Begin, 0); 1101 m_pStream->Seek(FX_STREAMSEEK_Begin, 0);
1102 pXMLStream = m_pStream; 1102 pXMLStream = m_pStream;
1103 } 1103 }
1104 ASSERT((pXMLStream->GetAccessModes() & FX_STREAMACCESS_Text) != 0); 1104 ASSERT((pXMLStream->GetAccessModes() & FX_STREAMACCESS_Text) != 0);
1105 ASSERT((pXMLStream->GetAccessModes() & FX_STREAMACCESS_Write) != 0); 1105 ASSERT((pXMLStream->GetAccessModes() & FX_STREAMACCESS_Write) != 0);
1106 uint16_t wCodePage = pXMLStream->GetCodePage(); 1106 uint16_t wCodePage = pXMLStream->GetCodePage();
1107 if (wCodePage != FX_CODEPAGE_UTF16LE && wCodePage != FX_CODEPAGE_UTF16BE && 1107 if (wCodePage != FX_CODEPAGE_UTF16LE && wCodePage != FX_CODEPAGE_UTF16BE &&
1108 wCodePage != FX_CODEPAGE_UTF8) { 1108 wCodePage != FX_CODEPAGE_UTF8) {
1109 wCodePage = FX_CODEPAGE_UTF8; 1109 wCodePage = FX_CODEPAGE_UTF8;
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
1281 m_iTextDataLength(0), 1281 m_iTextDataLength(0),
1282 m_syntaxParserResult(FDE_XmlSyntaxResult::None), 1282 m_syntaxParserResult(FDE_XmlSyntaxResult::None),
1283 m_syntaxParserState(FDE_XmlSyntaxState::Text), 1283 m_syntaxParserState(FDE_XmlSyntaxState::Text),
1284 m_wQuotationMark(0), 1284 m_wQuotationMark(0),
1285 m_iEntityStart(-1), 1285 m_iEntityStart(-1),
1286 m_SkipStack(16) { 1286 m_SkipStack(16) {
1287 m_CurNode.iNodeNum = -1; 1287 m_CurNode.iNodeNum = -1;
1288 m_CurNode.eNodeType = FDE_XMLNODE_Unknown; 1288 m_CurNode.eNodeType = FDE_XMLNODE_Unknown;
1289 } 1289 }
1290 1290
1291 void CFDE_XMLSyntaxParser::Init(IFX_Stream* pStream, 1291 void CFDE_XMLSyntaxParser::Init(IFGAS_Stream* pStream,
1292 int32_t iXMLPlaneSize, 1292 int32_t iXMLPlaneSize,
1293 int32_t iTextDataSize) { 1293 int32_t iTextDataSize) {
1294 ASSERT(!m_pStream && !m_pBuffer); 1294 ASSERT(!m_pStream && !m_pBuffer);
1295 ASSERT(pStream && iXMLPlaneSize > 0); 1295 ASSERT(pStream && iXMLPlaneSize > 0);
1296 int32_t iStreamLength = pStream->GetLength(); 1296 int32_t iStreamLength = pStream->GetLength();
1297 ASSERT(iStreamLength > 0); 1297 ASSERT(iStreamLength > 0);
1298 m_pStream = pStream; 1298 m_pStream = pStream;
1299 m_iXMLPlaneSize = std::min(iXMLPlaneSize, iStreamLength); 1299 m_iXMLPlaneSize = std::min(iXMLPlaneSize, iStreamLength);
1300 uint8_t bom[4]; 1300 uint8_t bom[4];
1301 m_iCurrentPos = m_pStream->GetBOM(bom); 1301 m_iCurrentPos = m_pStream->GetBOM(bom);
(...skipping 606 matching lines...) Expand 10 before | Expand all | Expand 10 after
1908 m_BlockBuffer.DeleteTextChars(m_iDataLength - m_iEntityStart, false); 1908 m_BlockBuffer.DeleteTextChars(m_iDataLength - m_iEntityStart, false);
1909 m_pCurrentBlock = m_BlockBuffer.GetAvailableBlock(m_iIndexInBlock); 1909 m_pCurrentBlock = m_BlockBuffer.GetAvailableBlock(m_iIndexInBlock);
1910 m_iEntityStart = -1; 1910 m_iEntityStart = -1;
1911 } else { 1911 } else {
1912 if (m_iEntityStart < 0 && character == L'&') { 1912 if (m_iEntityStart < 0 && character == L'&') {
1913 m_iEntityStart = m_iDataLength - 1; 1913 m_iEntityStart = m_iDataLength - 1;
1914 } 1914 }
1915 } 1915 }
1916 m_pStart++; 1916 m_pStart++;
1917 } 1917 }
OLDNEW
« no previous file with comments | « xfa/fde/xml/fde_xml_imp.h ('k') | xfa/fde/xml/fde_xml_imp_unittest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698