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_DICTIONARY_H_ | 7 #ifndef CORE_FPDFAPI_PARSER_CPDF_DICTIONARY_H_ |
8 #define CORE_FPDFAPI_PARSER_CPDF_DICTIONARY_H_ | 8 #define CORE_FPDFAPI_PARSER_CPDF_DICTIONARY_H_ |
9 | 9 |
10 #include <map> | 10 #include <map> |
11 #include <set> | 11 #include <set> |
12 | 12 |
13 #include "core/fpdfapi/parser/cpdf_object.h" | 13 #include "core/fpdfapi/parser/cpdf_object.h" |
14 #include "core/fxcrt/cfx_string_pool_template.h" | 14 #include "core/fxcrt/cfx_string_pool_template.h" |
15 #include "core/fxcrt/cfx_weak_ptr.h" | 15 #include "core/fxcrt/cfx_weak_ptr.h" |
16 #include "core/fxcrt/fx_coordinates.h" | 16 #include "core/fxcrt/fx_coordinates.h" |
17 #include "core/fxcrt/fx_string.h" | 17 #include "core/fxcrt/fx_string.h" |
18 | 18 |
19 class CPDF_IndirectObjectHolder; | 19 class CPDF_IndirectObjectHolder; |
20 | 20 |
21 class CPDF_Dictionary : public CPDF_Object { | 21 class CPDF_Dictionary : public CPDF_Object { |
22 public: | 22 public: |
23 using iterator = std::map<CFX_ByteString, CPDF_Object*>::iterator; | 23 using iterator = std::map<CFX_ByteString, CPDF_Object*>::iterator; |
24 using const_iterator = std::map<CFX_ByteString, CPDF_Object*>::const_iterator; | 24 using const_iterator = std::map<CFX_ByteString, CPDF_Object*>::const_iterator; |
25 | 25 |
26 CPDF_Dictionary(); | 26 CPDF_Dictionary(); |
27 explicit CPDF_Dictionary(const CFX_WeakPtr<CFX_ByteStringPool>& pPool); | 27 explicit CPDF_Dictionary(const CFX_WeakPtr<CFX_ByteStringPool>& pPool); |
| 28 ~CPDF_Dictionary() override; |
28 | 29 |
29 // CPDF_Object. | 30 // CPDF_Object. |
30 Type GetType() const override; | 31 Type GetType() const override; |
31 CPDF_Object* Clone() const override; | 32 CPDF_Object* Clone() const override; |
32 CPDF_Dictionary* GetDict() const override; | 33 CPDF_Dictionary* GetDict() const override; |
33 bool IsDictionary() const override; | 34 bool IsDictionary() const override; |
34 CPDF_Dictionary* AsDictionary() override; | 35 CPDF_Dictionary* AsDictionary() override; |
35 const CPDF_Dictionary* AsDictionary() const override; | 36 const CPDF_Dictionary* AsDictionary() const override; |
36 | 37 |
37 size_t GetCount() const { return m_Map.size(); } | 38 size_t GetCount() const { return m_Map.size(); } |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 void ReplaceKey(const CFX_ByteString& oldkey, const CFX_ByteString& newkey); | 78 void ReplaceKey(const CFX_ByteString& oldkey, const CFX_ByteString& newkey); |
78 | 79 |
79 iterator begin() { return m_Map.begin(); } | 80 iterator begin() { return m_Map.begin(); } |
80 iterator end() { return m_Map.end(); } | 81 iterator end() { return m_Map.end(); } |
81 const_iterator begin() const { return m_Map.begin(); } | 82 const_iterator begin() const { return m_Map.begin(); } |
82 const_iterator end() const { return m_Map.end(); } | 83 const_iterator end() const { return m_Map.end(); } |
83 | 84 |
84 CFX_WeakPtr<CFX_ByteStringPool> GetByteStringPool() const { return m_pPool; } | 85 CFX_WeakPtr<CFX_ByteStringPool> GetByteStringPool() const { return m_pPool; } |
85 | 86 |
86 protected: | 87 protected: |
87 ~CPDF_Dictionary() override; | |
88 | |
89 CFX_ByteString MaybeIntern(const CFX_ByteString& str); | 88 CFX_ByteString MaybeIntern(const CFX_ByteString& str); |
90 CPDF_Object* CloneNonCyclic( | 89 CPDF_Object* CloneNonCyclic( |
91 bool bDirect, | 90 bool bDirect, |
92 std::set<const CPDF_Object*>* visited) const override; | 91 std::set<const CPDF_Object*>* visited) const override; |
93 | 92 |
94 CFX_WeakPtr<CFX_ByteStringPool> m_pPool; | 93 CFX_WeakPtr<CFX_ByteStringPool> m_pPool; |
95 std::map<CFX_ByteString, CPDF_Object*> m_Map; | 94 std::map<CFX_ByteString, CPDF_Object*> m_Map; |
96 }; | 95 }; |
97 | 96 |
98 #endif // CORE_FPDFAPI_PARSER_CPDF_DICTIONARY_H_ | 97 #endif // CORE_FPDFAPI_PARSER_CPDF_DICTIONARY_H_ |
OLD | NEW |