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 21 matching lines...) Expand all Loading... |
32 | 32 |
33 size_t GetCount() const { return m_Map.size(); } | 33 size_t GetCount() const { return m_Map.size(); } |
34 CPDF_Object* GetObjectBy(const CFX_ByteString& key) const; | 34 CPDF_Object* GetObjectBy(const CFX_ByteString& key) const; |
35 CPDF_Object* GetDirectObjectBy(const CFX_ByteString& key) const; | 35 CPDF_Object* GetDirectObjectBy(const CFX_ByteString& key) const; |
36 CFX_ByteString GetStringBy(const CFX_ByteString& key) const; | 36 CFX_ByteString GetStringBy(const CFX_ByteString& key) const; |
37 CFX_ByteString GetStringBy(const CFX_ByteString& key, | 37 CFX_ByteString GetStringBy(const CFX_ByteString& key, |
38 const CFX_ByteString& default_str) const; | 38 const CFX_ByteString& default_str) const; |
39 CFX_WideString GetUnicodeTextBy(const CFX_ByteString& key) const; | 39 CFX_WideString GetUnicodeTextBy(const CFX_ByteString& key) const; |
40 int GetIntegerBy(const CFX_ByteString& key) const; | 40 int GetIntegerBy(const CFX_ByteString& key) const; |
41 int GetIntegerBy(const CFX_ByteString& key, int default_int) const; | 41 int GetIntegerBy(const CFX_ByteString& key, int default_int) const; |
42 FX_BOOL GetBooleanBy(const CFX_ByteString& key, | 42 bool GetBooleanBy(const CFX_ByteString& key, bool bDefault = false) const; |
43 FX_BOOL bDefault = FALSE) const; | |
44 FX_FLOAT GetNumberBy(const CFX_ByteString& key) const; | 43 FX_FLOAT GetNumberBy(const CFX_ByteString& key) const; |
45 CPDF_Dictionary* GetDictBy(const CFX_ByteString& key) const; | 44 CPDF_Dictionary* GetDictBy(const CFX_ByteString& key) const; |
46 CPDF_Stream* GetStreamBy(const CFX_ByteString& key) const; | 45 CPDF_Stream* GetStreamBy(const CFX_ByteString& key) const; |
47 CPDF_Array* GetArrayBy(const CFX_ByteString& key) const; | 46 CPDF_Array* GetArrayBy(const CFX_ByteString& key) const; |
48 CFX_FloatRect GetRectBy(const CFX_ByteString& key) const; | 47 CFX_FloatRect GetRectBy(const CFX_ByteString& key) const; |
49 CFX_Matrix GetMatrixBy(const CFX_ByteString& key) const; | 48 CFX_Matrix GetMatrixBy(const CFX_ByteString& key) const; |
50 FX_FLOAT GetFloatBy(const CFX_ByteString& key) const { | 49 FX_FLOAT GetFloatBy(const CFX_ByteString& key) const { |
51 return GetNumberBy(key); | 50 return GetNumberBy(key); |
52 } | 51 } |
53 | 52 |
54 FX_BOOL KeyExist(const CFX_ByteString& key) const; | 53 FX_BOOL KeyExist(const CFX_ByteString& key) const; |
55 bool IsSignatureDict() const; | 54 bool IsSignatureDict() const; |
56 | 55 |
57 // Set* functions invalidate iterators for the element with the key |key|. | 56 // Set* functions invalidate iterators for the element with the key |key|. |
58 void SetAt(const CFX_ByteString& key, CPDF_Object* pObj); | 57 void SetAt(const CFX_ByteString& key, CPDF_Object* pObj); |
59 void SetAtName(const CFX_ByteString& key, const CFX_ByteString& name); | 58 void SetAtName(const CFX_ByteString& key, const CFX_ByteString& name); |
60 void SetAtString(const CFX_ByteString& key, const CFX_ByteString& str); | 59 void SetAtString(const CFX_ByteString& key, const CFX_ByteString& str); |
61 void SetAtInteger(const CFX_ByteString& key, int i); | 60 void SetAtInteger(const CFX_ByteString& key, int i); |
62 void SetAtNumber(const CFX_ByteString& key, FX_FLOAT f); | 61 void SetAtNumber(const CFX_ByteString& key, FX_FLOAT f); |
63 void SetAtReference(const CFX_ByteString& key, | 62 void SetAtReference(const CFX_ByteString& key, |
64 CPDF_IndirectObjectHolder* pDoc, | 63 CPDF_IndirectObjectHolder* pDoc, |
65 uint32_t objnum); | 64 uint32_t objnum); |
66 void SetAtReference(const CFX_ByteString& key, | 65 void SetAtReference(const CFX_ByteString& key, |
67 CPDF_IndirectObjectHolder* pDoc, | 66 CPDF_IndirectObjectHolder* pDoc, |
68 CPDF_Object* obj) { | 67 CPDF_Object* obj) { |
69 SetAtReference(key, pDoc, obj->GetObjNum()); | 68 SetAtReference(key, pDoc, obj->GetObjNum()); |
70 } | 69 } |
71 void SetAtRect(const CFX_ByteString& key, const CFX_FloatRect& rect); | 70 void SetAtRect(const CFX_ByteString& key, const CFX_FloatRect& rect); |
72 void SetAtMatrix(const CFX_ByteString& key, const CFX_Matrix& matrix); | 71 void SetAtMatrix(const CFX_ByteString& key, const CFX_Matrix& matrix); |
73 void SetAtBoolean(const CFX_ByteString& key, FX_BOOL bValue); | 72 void SetAtBoolean(const CFX_ByteString& key, bool bValue); |
74 | 73 |
75 void AddReference(const CFX_ByteString& key, | 74 void AddReference(const CFX_ByteString& key, |
76 CPDF_IndirectObjectHolder* pDoc, | 75 CPDF_IndirectObjectHolder* pDoc, |
77 uint32_t objnum); | 76 uint32_t objnum); |
78 | 77 |
79 // Invalidates iterators for the element with the key |key|. | 78 // Invalidates iterators for the element with the key |key|. |
80 void RemoveAt(const CFX_ByteString& key); | 79 void RemoveAt(const CFX_ByteString& key); |
81 | 80 |
82 // Invalidates iterators for the element with the key |oldkey|. | 81 // Invalidates iterators for the element with the key |oldkey|. |
83 void ReplaceKey(const CFX_ByteString& oldkey, const CFX_ByteString& newkey); | 82 void ReplaceKey(const CFX_ByteString& oldkey, const CFX_ByteString& newkey); |
84 | 83 |
85 iterator begin() { return m_Map.begin(); } | 84 iterator begin() { return m_Map.begin(); } |
86 iterator end() { return m_Map.end(); } | 85 iterator end() { return m_Map.end(); } |
87 const_iterator begin() const { return m_Map.begin(); } | 86 const_iterator begin() const { return m_Map.begin(); } |
88 const_iterator end() const { return m_Map.end(); } | 87 const_iterator end() const { return m_Map.end(); } |
89 | 88 |
90 protected: | 89 protected: |
91 ~CPDF_Dictionary() override; | 90 ~CPDF_Dictionary() override; |
92 | 91 |
93 std::map<CFX_ByteString, CPDF_Object*> m_Map; | 92 std::map<CFX_ByteString, CPDF_Object*> m_Map; |
94 }; | 93 }; |
95 | 94 |
96 #endif // CORE_FPDFAPI_FPDF_PARSER_INCLUDE_CPDF_DICTIONARY_H_ | 95 #endif // CORE_FPDFAPI_FPDF_PARSER_INCLUDE_CPDF_DICTIONARY_H_ |
OLD | NEW |