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