OLD | NEW |
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_PARSER_CPDF_INDIRECT_OBJECT_HOLDER_H_ | 7 #ifndef CORE_FPDFAPI_PARSER_CPDF_INDIRECT_OBJECT_HOLDER_H_ |
8 #define CORE_FPDFAPI_PARSER_CPDF_INDIRECT_OBJECT_HOLDER_H_ | 8 #define CORE_FPDFAPI_PARSER_CPDF_INDIRECT_OBJECT_HOLDER_H_ |
9 | 9 |
10 #include <map> | 10 #include <map> |
11 #include <memory> | 11 #include <memory> |
12 | 12 |
| 13 #include "core/fxcrt/cfx_string_pool_template.h" |
| 14 #include "core/fxcrt/cfx_weak_ptr.h" |
13 #include "core/fxcrt/fx_system.h" | 15 #include "core/fxcrt/fx_system.h" |
14 #include "third_party/base/ptr_util.h" | 16 #include "third_party/base/ptr_util.h" |
15 | 17 |
16 class CPDF_Object; | 18 class CPDF_Object; |
17 | 19 |
18 class CPDF_IndirectObjectHolder { | 20 class CPDF_IndirectObjectHolder { |
19 public: | 21 public: |
20 using const_iterator = | 22 using const_iterator = |
21 std::map<uint32_t, std::unique_ptr<CPDF_Object>>::const_iterator; | 23 std::map<uint32_t, std::unique_ptr<CPDF_Object>>::const_iterator; |
22 | 24 |
(...skipping 15 matching lines...) Expand all Loading... |
38 CPDF_Object* AddIndirectObject(std::unique_ptr<CPDF_Object> pObj); | 40 CPDF_Object* AddIndirectObject(std::unique_ptr<CPDF_Object> pObj); |
39 | 41 |
40 // Always takes ownership of |pObj|, return true if higher generation number. | 42 // Always takes ownership of |pObj|, return true if higher generation number. |
41 bool ReplaceIndirectObjectIfHigherGeneration( | 43 bool ReplaceIndirectObjectIfHigherGeneration( |
42 uint32_t objnum, | 44 uint32_t objnum, |
43 std::unique_ptr<CPDF_Object> pObj); | 45 std::unique_ptr<CPDF_Object> pObj); |
44 | 46 |
45 uint32_t GetLastObjNum() const { return m_LastObjNum; } | 47 uint32_t GetLastObjNum() const { return m_LastObjNum; } |
46 void SetLastObjNum(uint32_t objnum) { m_LastObjNum = objnum; } | 48 void SetLastObjNum(uint32_t objnum) { m_LastObjNum = objnum; } |
47 | 49 |
| 50 CFX_WeakPtr<CFX_ByteStringPool> GetByteStringPool() const { |
| 51 return m_pByteStringPool; |
| 52 } |
| 53 |
48 const_iterator begin() const { return m_IndirectObjs.begin(); } | 54 const_iterator begin() const { return m_IndirectObjs.begin(); } |
49 const_iterator end() const { return m_IndirectObjs.end(); } | 55 const_iterator end() const { return m_IndirectObjs.end(); } |
50 | 56 |
51 protected: | 57 protected: |
52 virtual std::unique_ptr<CPDF_Object> ParseIndirectObject(uint32_t objnum); | 58 virtual std::unique_ptr<CPDF_Object> ParseIndirectObject(uint32_t objnum); |
53 | 59 |
54 private: | 60 private: |
55 uint32_t m_LastObjNum; | 61 uint32_t m_LastObjNum; |
56 std::map<uint32_t, std::unique_ptr<CPDF_Object>> m_IndirectObjs; | 62 std::map<uint32_t, std::unique_ptr<CPDF_Object>> m_IndirectObjs; |
| 63 CFX_WeakPtr<CFX_ByteStringPool> m_pByteStringPool; |
57 }; | 64 }; |
58 | 65 |
59 #endif // CORE_FPDFAPI_PARSER_CPDF_INDIRECT_OBJECT_HOLDER_H_ | 66 #endif // CORE_FPDFAPI_PARSER_CPDF_INDIRECT_OBJECT_HOLDER_H_ |
OLD | NEW |