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> |
(...skipping 14 matching lines...) Expand all Loading... |
25 | 25 |
26 // CPDF_Object. | 26 // CPDF_Object. |
27 Type GetType() const override; | 27 Type GetType() const override; |
28 CPDF_Object* Clone() const override; | 28 CPDF_Object* Clone() const override; |
29 CPDF_Dictionary* GetDict() const override; | 29 CPDF_Dictionary* GetDict() const override; |
30 bool IsDictionary() const override; | 30 bool IsDictionary() const override; |
31 CPDF_Dictionary* AsDictionary() override; | 31 CPDF_Dictionary* AsDictionary() override; |
32 const CPDF_Dictionary* AsDictionary() const override; | 32 const CPDF_Dictionary* AsDictionary() const override; |
33 | 33 |
34 size_t GetCount() const { return m_Map.size(); } | 34 size_t GetCount() const { return m_Map.size(); } |
35 CPDF_Object* GetObjectBy(const CFX_ByteString& key) const; | 35 CPDF_Object* GetObjectFor(const CFX_ByteString& key) const; |
36 CPDF_Object* GetDirectObjectBy(const CFX_ByteString& key) const; | 36 CPDF_Object* GetDirectObjectFor(const CFX_ByteString& key) const; |
37 CFX_ByteString GetStringBy(const CFX_ByteString& key) const; | 37 CFX_ByteString GetStringFor(const CFX_ByteString& key) const; |
38 CFX_ByteString GetStringBy(const CFX_ByteString& key, | 38 CFX_ByteString GetStringFor(const CFX_ByteString& key, |
39 const CFX_ByteString& default_str) const; | 39 const CFX_ByteString& default_str) const; |
40 CFX_WideString GetUnicodeTextBy(const CFX_ByteString& key) const; | 40 CFX_WideString GetUnicodeTextFor(const CFX_ByteString& key) const; |
41 int GetIntegerBy(const CFX_ByteString& key) const; | 41 int GetIntegerFor(const CFX_ByteString& key) const; |
42 int GetIntegerBy(const CFX_ByteString& key, int default_int) const; | 42 int GetIntegerFor(const CFX_ByteString& key, int default_int) const; |
43 bool GetBooleanBy(const CFX_ByteString& key, bool bDefault = false) const; | 43 bool GetBooleanFor(const CFX_ByteString& key, bool bDefault = false) const; |
44 FX_FLOAT GetNumberBy(const CFX_ByteString& key) const; | 44 FX_FLOAT GetNumberFor(const CFX_ByteString& key) const; |
45 CPDF_Dictionary* GetDictBy(const CFX_ByteString& key) const; | 45 CPDF_Dictionary* GetDictFor(const CFX_ByteString& key) const; |
46 CPDF_Stream* GetStreamBy(const CFX_ByteString& key) const; | 46 CPDF_Stream* GetStreamFor(const CFX_ByteString& key) const; |
47 CPDF_Array* GetArrayBy(const CFX_ByteString& key) const; | 47 CPDF_Array* GetArrayFor(const CFX_ByteString& key) const; |
48 CFX_FloatRect GetRectBy(const CFX_ByteString& key) const; | 48 CFX_FloatRect GetRectFor(const CFX_ByteString& key) const; |
49 CFX_Matrix GetMatrixBy(const CFX_ByteString& key) const; | 49 CFX_Matrix GetMatrixFor(const CFX_ByteString& key) const; |
50 FX_FLOAT GetFloatBy(const CFX_ByteString& key) const { | 50 FX_FLOAT GetFloatFor(const CFX_ByteString& key) const { |
51 return GetNumberBy(key); | 51 return GetNumberFor(key); |
52 } | 52 } |
53 | 53 |
54 FX_BOOL KeyExist(const CFX_ByteString& key) const; | 54 FX_BOOL KeyExist(const CFX_ByteString& key) const; |
55 bool IsSignatureDict() const; | 55 bool IsSignatureDict() const; |
56 | 56 |
57 // Set* functions invalidate iterators for the element with the key |key|. | 57 // Set* functions invalidate iterators for the element with the key |key|. |
58 void SetAt(const CFX_ByteString& key, CPDF_Object* pObj); | 58 void SetFor(const CFX_ByteString& key, CPDF_Object* pObj); |
59 void SetAtName(const CFX_ByteString& key, const CFX_ByteString& name); | 59 void SetNameFor(const CFX_ByteString& key, const CFX_ByteString& name); |
60 void SetAtString(const CFX_ByteString& key, const CFX_ByteString& str); | 60 void SetStringFor(const CFX_ByteString& key, const CFX_ByteString& str); |
61 void SetAtInteger(const CFX_ByteString& key, int i); | 61 void SetIntegerFor(const CFX_ByteString& key, int i); |
62 void SetAtNumber(const CFX_ByteString& key, FX_FLOAT f); | 62 void SetNumberFor(const CFX_ByteString& key, FX_FLOAT f); |
63 void SetAtReference(const CFX_ByteString& key, | 63 void SetReferenceFor(const CFX_ByteString& key, |
64 CPDF_IndirectObjectHolder* pDoc, | 64 CPDF_IndirectObjectHolder* pDoc, |
65 uint32_t objnum); | 65 uint32_t objnum); |
66 void SetAtReference(const CFX_ByteString& key, | 66 void SetReferenceFor(const CFX_ByteString& key, |
67 CPDF_IndirectObjectHolder* pDoc, | 67 CPDF_IndirectObjectHolder* pDoc, |
68 CPDF_Object* obj) { | 68 CPDF_Object* obj) { |
69 SetAtReference(key, pDoc, obj->GetObjNum()); | 69 SetReferenceFor(key, pDoc, obj->GetObjNum()); |
70 } | 70 } |
71 void SetAtRect(const CFX_ByteString& key, const CFX_FloatRect& rect); | 71 void SetRectFor(const CFX_ByteString& key, const CFX_FloatRect& rect); |
72 void SetAtMatrix(const CFX_ByteString& key, const CFX_Matrix& matrix); | 72 void SetMatrixFor(const CFX_ByteString& key, const CFX_Matrix& matrix); |
73 void SetAtBoolean(const CFX_ByteString& key, bool bValue); | 73 void SetBooleanFor(const CFX_ByteString& key, bool bValue); |
74 | 74 |
75 // Invalidates iterators for the element with the key |key|. | 75 // Invalidates iterators for the element with the key |key|. |
76 void RemoveAt(const CFX_ByteString& key); | 76 void RemoveFor(const CFX_ByteString& key); |
77 | 77 |
78 // Invalidates iterators for the element with the key |oldkey|. | 78 // Invalidates iterators for the element with the key |oldkey|. |
79 void ReplaceKey(const CFX_ByteString& oldkey, const CFX_ByteString& newkey); | 79 void ReplaceKey(const CFX_ByteString& oldkey, const CFX_ByteString& newkey); |
80 | 80 |
81 iterator begin() { return m_Map.begin(); } | 81 iterator begin() { return m_Map.begin(); } |
82 iterator end() { return m_Map.end(); } | 82 iterator end() { return m_Map.end(); } |
83 const_iterator begin() const { return m_Map.begin(); } | 83 const_iterator begin() const { return m_Map.begin(); } |
84 const_iterator end() const { return m_Map.end(); } | 84 const_iterator end() const { return m_Map.end(); } |
85 | 85 |
86 protected: | 86 protected: |
87 ~CPDF_Dictionary() override; | 87 ~CPDF_Dictionary() override; |
88 | 88 |
89 CPDF_Object* CloneNonCyclic( | 89 CPDF_Object* CloneNonCyclic( |
90 bool bDirect, | 90 bool bDirect, |
91 std::set<const CPDF_Object*>* visited) const override; | 91 std::set<const CPDF_Object*>* visited) const override; |
92 | 92 |
93 std::map<CFX_ByteString, CPDF_Object*> m_Map; | 93 std::map<CFX_ByteString, CPDF_Object*> m_Map; |
94 }; | 94 }; |
95 | 95 |
96 #endif // CORE_FPDFAPI_FPDF_PARSER_INCLUDE_CPDF_DICTIONARY_H_ | 96 #endif // CORE_FPDFAPI_FPDF_PARSER_INCLUDE_CPDF_DICTIONARY_H_ |
OLD | NEW |