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

Side by Side Diff: core/fpdfapi/fpdf_parser/include/cpdf_indirect_object_holder.h

Issue 2275593002: IndirectObjectHolder API updates (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Missed one Created 4 years, 3 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
« no previous file with comments | « core/fpdfapi/fpdf_parser/cpdf_reference.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 PDFium Authors. All rights reserved. 1 // Copyright 2016 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 #ifndef CORE_FPDFAPI_FPDF_PARSER_INCLUDE_CPDF_INDIRECT_OBJECT_HOLDER_H_ 7 #ifndef CORE_FPDFAPI_FPDF_PARSER_INCLUDE_CPDF_INDIRECT_OBJECT_HOLDER_H_
8 #define CORE_FPDFAPI_FPDF_PARSER_INCLUDE_CPDF_INDIRECT_OBJECT_HOLDER_H_ 8 #define CORE_FPDFAPI_FPDF_PARSER_INCLUDE_CPDF_INDIRECT_OBJECT_HOLDER_H_
9 9
10 #include <map> 10 #include <map>
11 11
12 #include "core/fxcrt/include/fx_system.h" 12 #include "core/fxcrt/include/fx_system.h"
13 13
14 class CPDF_Object; 14 class CPDF_Object;
15 class CPDF_Parser; 15 class CPDF_Parser;
16 16
17 class CPDF_IndirectObjectHolder { 17 class CPDF_IndirectObjectHolder {
18 public: 18 public:
19 using iterator = std::map<uint32_t, CPDF_Object*>::iterator; 19 using iterator = std::map<uint32_t, CPDF_Object*>::iterator;
20 using const_iterator = std::map<uint32_t, CPDF_Object*>::const_iterator; 20 using const_iterator = std::map<uint32_t, CPDF_Object*>::const_iterator;
21 21
22 explicit CPDF_IndirectObjectHolder(CPDF_Parser* pParser); 22 explicit CPDF_IndirectObjectHolder(CPDF_Parser* pParser);
23 ~CPDF_IndirectObjectHolder(); 23 ~CPDF_IndirectObjectHolder();
24 24
25 CPDF_Object* GetIndirectObject(uint32_t objnum); 25 CPDF_Object* GetOrParseIndirectObject(uint32_t objnum);
26 uint32_t AddIndirectObject(CPDF_Object* pObj);
27 void ReleaseIndirectObject(uint32_t objnum); 26 void ReleaseIndirectObject(uint32_t objnum);
28 27
29 // Takes ownership of |pObj|. 28 // Take ownership of |pObj|.
30 bool InsertIndirectObject(uint32_t objnum, CPDF_Object* pObj); 29 uint32_t AddIndirectObject(CPDF_Object* pObj);
30 bool ReplaceIndirectObjectIfHigherGeneration(uint32_t objnum,
31 CPDF_Object* pObj);
31 32
32 uint32_t GetLastObjNum() const { return m_LastObjNum; } 33 uint32_t GetLastObjNum() const { return m_LastObjNum; }
34 void SetLastObjNum(uint32_t objnum) { m_LastObjNum = objnum; }
35
33 iterator begin() { return m_IndirectObjs.begin(); } 36 iterator begin() { return m_IndirectObjs.begin(); }
34 const_iterator begin() const { return m_IndirectObjs.begin(); } 37 const_iterator begin() const { return m_IndirectObjs.begin(); }
35 iterator end() { return m_IndirectObjs.end(); } 38 iterator end() { return m_IndirectObjs.end(); }
36 const_iterator end() const { return m_IndirectObjs.end(); } 39 const_iterator end() const { return m_IndirectObjs.end(); }
37 40
38 protected: 41 protected:
39 CPDF_Parser* m_pParser; 42 CPDF_Parser* m_pParser;
43 std::map<uint32_t, CPDF_Object*> m_IndirectObjs;
44
45 private:
40 uint32_t m_LastObjNum; 46 uint32_t m_LastObjNum;
41 std::map<uint32_t, CPDF_Object*> m_IndirectObjs;
42 }; 47 };
43 48
44 #endif // CORE_FPDFAPI_FPDF_PARSER_INCLUDE_CPDF_INDIRECT_OBJECT_HOLDER_H_ 49 #endif // CORE_FPDFAPI_FPDF_PARSER_INCLUDE_CPDF_INDIRECT_OBJECT_HOLDER_H_
OLDNEW
« no previous file with comments | « core/fpdfapi/fpdf_parser/cpdf_reference.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698