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

Side by Side Diff: core/src/fpdfapi/fpdf_parser/fpdf_parser_document.cpp

Issue 1576113003: Use std::map in CPDF_IndirectObjects (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Remove cbegin() and cend(). Created 4 years, 11 months 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
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 "core/include/fpdfapi/fpdf_parser.h" 7 #include "core/include/fpdfapi/fpdf_parser.h"
8 8
9 #include "core/include/fpdfapi/fpdf_module.h" 9 #include "core/include/fpdfapi/fpdf_module.h"
10 10
11 CPDF_Document::CPDF_Document(CPDF_Parser* pParser) 11 CPDF_Document::CPDF_Document(CPDF_Parser* pParser)
12 : CPDF_IndirectObjects(pParser) { 12 : CPDF_IndirectObjectHolder(pParser) {
13 ASSERT(pParser); 13 ASSERT(pParser);
14 m_pRootDict = NULL; 14 m_pRootDict = NULL;
15 m_pInfoDict = NULL; 15 m_pInfoDict = NULL;
16 m_bLinearized = FALSE; 16 m_bLinearized = FALSE;
17 m_dwFirstPageNo = 0; 17 m_dwFirstPageNo = 0;
18 m_dwFirstPageObjNum = 0; 18 m_dwFirstPageObjNum = 0;
19 m_pDocPage = CPDF_ModuleMgr::Get()->GetPageModule()->CreateDocData(this); 19 m_pDocPage = CPDF_ModuleMgr::Get()->GetPageModule()->CreateDocData(this);
20 m_pDocRender = CPDF_ModuleMgr::Get()->GetRenderModule()->CreateDocData(this); 20 m_pDocRender = CPDF_ModuleMgr::Get()->GetRenderModule()->CreateDocData(this);
21 } 21 }
22 CPDF_DocPageData* CPDF_Document::GetValidatePageData() { 22 CPDF_DocPageData* CPDF_Document::GetValidatePageData() {
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after
325 FX_DWORD CPDF_Document::GetUserPermissions(FX_BOOL bCheckRevision) const { 325 FX_DWORD CPDF_Document::GetUserPermissions(FX_BOOL bCheckRevision) const {
326 if (!m_pParser) { 326 if (!m_pParser) {
327 return (FX_DWORD)-1; 327 return (FX_DWORD)-1;
328 } 328 }
329 return m_pParser->GetPermissions(bCheckRevision); 329 return m_pParser->GetPermissions(bCheckRevision);
330 } 330 }
331 FX_BOOL CPDF_Document::IsOwner() const { 331 FX_BOOL CPDF_Document::IsOwner() const {
332 return !m_pParser || m_pParser->IsOwner(); 332 return !m_pParser || m_pParser->IsOwner();
333 } 333 }
334 FX_BOOL CPDF_Document::IsFormStream(FX_DWORD objnum, FX_BOOL& bForm) const { 334 FX_BOOL CPDF_Document::IsFormStream(FX_DWORD objnum, FX_BOOL& bForm) const {
335 { 335 auto it = m_IndirectObjs.find(objnum);
336 CPDF_Object* pObj; 336 if (it != m_IndirectObjs.end()) {
337 if (m_IndirectObjs.Lookup((void*)(uintptr_t)objnum, (void*&)pObj)) { 337 CPDF_Stream* pStream = it->second->AsStream();
338 CPDF_Stream* pStream = pObj->AsStream(); 338 bForm = pStream && pStream->GetDict()->GetString("Subtype") == "Form";
339 bForm = pStream && pStream->GetDict()->GetString("Subtype") == "Form"; 339 return TRUE;
340 return TRUE;
341 }
342 } 340 }
343 if (!m_pParser) { 341 if (!m_pParser) {
344 bForm = FALSE; 342 bForm = FALSE;
345 return TRUE; 343 return TRUE;
346 } 344 }
347 return m_pParser->IsFormStream(objnum, bForm); 345 return m_pParser->IsFormStream(objnum, bForm);
348 } 346 }
349 void CPDF_Document::ClearPageData() { 347 void CPDF_Document::ClearPageData() {
350 if (m_pDocPage) { 348 if (m_pDocPage) {
351 CPDF_ModuleMgr::Get()->GetPageModule()->ClearDoc(this); 349 CPDF_ModuleMgr::Get()->GetPageModule()->ClearDoc(this);
352 } 350 }
353 } 351 }
354 void CPDF_Document::ClearRenderData() { 352 void CPDF_Document::ClearRenderData() {
355 if (m_pDocRender) { 353 if (m_pDocRender) {
356 CPDF_ModuleMgr::Get()->GetRenderModule()->ClearDocData(m_pDocRender); 354 CPDF_ModuleMgr::Get()->GetRenderModule()->ClearDocData(m_pDocRender);
357 } 355 }
358 } 356 }
OLDNEW
« no previous file with comments | « core/src/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp ('k') | core/src/fpdfapi/fpdf_parser/fpdf_parser_fdf.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698