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 | 12 |
12 #include "core/fpdfapi/fpdf_parser/include/cpdf_object.h" | 13 #include "core/fpdfapi/fpdf_parser/include/cpdf_object.h" |
13 #include "core/fxcrt/include/fx_coordinates.h" | 14 #include "core/fxcrt/include/fx_coordinates.h" |
14 #include "core/fxcrt/include/fx_string.h" | 15 #include "core/fxcrt/include/fx_string.h" |
15 | 16 |
16 class CPDF_IndirectObjectHolder; | 17 class CPDF_IndirectObjectHolder; |
17 | 18 |
18 class CPDF_Dictionary : public CPDF_Object { | 19 class CPDF_Dictionary : public CPDF_Object { |
19 public: | 20 public: |
20 using iterator = std::map<CFX_ByteString, CPDF_Object*>::iterator; | 21 using iterator = std::map<CFX_ByteString, CPDF_Object*>::iterator; |
21 using const_iterator = std::map<CFX_ByteString, CPDF_Object*>::const_iterator; | 22 using const_iterator = std::map<CFX_ByteString, CPDF_Object*>::const_iterator; |
22 | 23 |
23 CPDF_Dictionary(); | 24 CPDF_Dictionary(); |
24 | 25 |
25 // CPDF_Object. | 26 // CPDF_Object. |
26 Type GetType() const override; | 27 Type GetType() const override; |
27 CPDF_Object* Clone(FX_BOOL bDirect = FALSE) const override; | 28 CPDF_Object* Clone() const override; |
28 CPDF_Dictionary* GetDict() const override; | 29 CPDF_Dictionary* GetDict() const override; |
29 bool IsDictionary() const override; | 30 bool IsDictionary() const override; |
30 CPDF_Dictionary* AsDictionary() override; | 31 CPDF_Dictionary* AsDictionary() override; |
31 const CPDF_Dictionary* AsDictionary() const override; | 32 const CPDF_Dictionary* AsDictionary() const override; |
32 | 33 |
33 size_t GetCount() const { return m_Map.size(); } | 34 size_t GetCount() const { return m_Map.size(); } |
34 CPDF_Object* GetObjectBy(const CFX_ByteString& key) const; | 35 CPDF_Object* GetObjectBy(const CFX_ByteString& key) const; |
35 CPDF_Object* GetDirectObjectBy(const CFX_ByteString& key) const; | 36 CPDF_Object* GetDirectObjectBy(const CFX_ByteString& key) const; |
36 CFX_ByteString GetStringBy(const CFX_ByteString& key) const; | 37 CFX_ByteString GetStringBy(const CFX_ByteString& key) const; |
37 CFX_ByteString GetStringBy(const CFX_ByteString& key, | 38 CFX_ByteString GetStringBy(const CFX_ByteString& key, |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
76 | 77 |
77 // Invalidates iterators for the element with the key |oldkey|. | 78 // Invalidates iterators for the element with the key |oldkey|. |
78 void ReplaceKey(const CFX_ByteString& oldkey, const CFX_ByteString& newkey); | 79 void ReplaceKey(const CFX_ByteString& oldkey, const CFX_ByteString& newkey); |
79 | 80 |
80 iterator begin() { return m_Map.begin(); } | 81 iterator begin() { return m_Map.begin(); } |
81 iterator end() { return m_Map.end(); } | 82 iterator end() { return m_Map.end(); } |
82 const_iterator begin() const { return m_Map.begin(); } | 83 const_iterator begin() const { return m_Map.begin(); } |
83 const_iterator end() const { return m_Map.end(); } | 84 const_iterator end() const { return m_Map.end(); } |
84 | 85 |
85 protected: | 86 protected: |
86 ~CPDF_Dictionary() override; | 87 ~CPDF_Dictionary() override; |
Lei Zhang
2016/08/19 16:21:09
Ditto, add a separator line.
Wei Li
2016/08/19 18:14:57
Done.
| |
88 CPDF_Object* CloneNonCyclic( | |
89 bool bDirect, | |
90 std::set<const CPDF_Object*>* visited) const override; | |
87 | 91 |
88 std::map<CFX_ByteString, CPDF_Object*> m_Map; | 92 std::map<CFX_ByteString, CPDF_Object*> m_Map; |
89 }; | 93 }; |
90 | 94 |
91 #endif // CORE_FPDFAPI_FPDF_PARSER_INCLUDE_CPDF_DICTIONARY_H_ | 95 #endif // CORE_FPDFAPI_FPDF_PARSER_INCLUDE_CPDF_DICTIONARY_H_ |
OLD | NEW |