| 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 13 matching lines...) Expand all Loading... |
| 24 | 24 |
| 25 // CPDF_Object. | 25 // CPDF_Object. |
| 26 Type GetType() const override; | 26 Type GetType() const override; |
| 27 CPDF_Object* Clone(FX_BOOL bDirect = FALSE) const override; | 27 CPDF_Object* Clone(FX_BOOL bDirect = FALSE) const override; |
| 28 CPDF_Dictionary* GetDict() const override; | 28 CPDF_Dictionary* GetDict() const override; |
| 29 bool IsDictionary() const override; | 29 bool IsDictionary() const override; |
| 30 CPDF_Dictionary* AsDictionary() override; | 30 CPDF_Dictionary* AsDictionary() override; |
| 31 const CPDF_Dictionary* AsDictionary() const override; | 31 const CPDF_Dictionary* AsDictionary() const override; |
| 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_ByteStringC& key) const; | 34 CPDF_Object* GetObjectBy(const CFX_ByteString& key) const; |
| 35 CPDF_Object* GetDirectObjectBy(const CFX_ByteStringC& key) const; | 35 CPDF_Object* GetDirectObjectBy(const CFX_ByteString& key) const; |
| 36 CFX_ByteString GetStringBy(const CFX_ByteStringC& key) const; | 36 CFX_ByteString GetStringBy(const CFX_ByteString& key) const; |
| 37 CFX_ByteString GetStringBy(const CFX_ByteStringC& key, | 37 CFX_ByteString GetStringBy(const CFX_ByteString& key, |
| 38 const CFX_ByteStringC& default_str) const; | 38 const CFX_ByteString& default_str) const; |
| 39 CFX_WideString GetUnicodeTextBy(const CFX_ByteStringC& key) const; | 39 CFX_WideString GetUnicodeTextBy(const CFX_ByteString& key) const; |
| 40 int GetIntegerBy(const CFX_ByteStringC& key) const; | 40 int GetIntegerBy(const CFX_ByteString& key) const; |
| 41 int GetIntegerBy(const CFX_ByteStringC& key, int default_int) const; | 41 int GetIntegerBy(const CFX_ByteString& key, int default_int) const; |
| 42 FX_BOOL GetBooleanBy(const CFX_ByteStringC& key, | 42 FX_BOOL GetBooleanBy(const CFX_ByteString& key, |
| 43 FX_BOOL bDefault = FALSE) const; | 43 FX_BOOL bDefault = FALSE) const; |
| 44 FX_FLOAT GetNumberBy(const CFX_ByteStringC& key) const; | 44 FX_FLOAT GetNumberBy(const CFX_ByteString& key) const; |
| 45 CPDF_Dictionary* GetDictBy(const CFX_ByteStringC& key) const; | 45 CPDF_Dictionary* GetDictBy(const CFX_ByteString& key) const; |
| 46 CPDF_Stream* GetStreamBy(const CFX_ByteStringC& key) const; | 46 CPDF_Stream* GetStreamBy(const CFX_ByteString& key) const; |
| 47 CPDF_Array* GetArrayBy(const CFX_ByteStringC& key) const; | 47 CPDF_Array* GetArrayBy(const CFX_ByteString& key) const; |
| 48 CFX_FloatRect GetRectBy(const CFX_ByteStringC& key) const; | 48 CFX_FloatRect GetRectBy(const CFX_ByteString& key) const; |
| 49 CFX_Matrix GetMatrixBy(const CFX_ByteStringC& key) const; | 49 CFX_Matrix GetMatrixBy(const CFX_ByteString& key) const; |
| 50 FX_FLOAT GetFloatBy(const CFX_ByteStringC& key) const { | 50 FX_FLOAT GetFloatBy(const CFX_ByteString& key) const { |
| 51 return GetNumberBy(key); | 51 return GetNumberBy(key); |
| 52 } | 52 } |
| 53 | 53 |
| 54 FX_BOOL KeyExist(const CFX_ByteStringC& 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_ByteStringC& key, CPDF_Object* pObj); | 58 void SetAt(const CFX_ByteString& key, CPDF_Object* pObj); |
| 59 void SetAtName(const CFX_ByteStringC& key, const CFX_ByteString& name); | 59 void SetAtName(const CFX_ByteString& key, const CFX_ByteString& name); |
| 60 void SetAtString(const CFX_ByteStringC& key, const CFX_ByteString& str); | 60 void SetAtString(const CFX_ByteString& key, const CFX_ByteString& str); |
| 61 void SetAtInteger(const CFX_ByteStringC& key, int i); | 61 void SetAtInteger(const CFX_ByteString& key, int i); |
| 62 void SetAtNumber(const CFX_ByteStringC& key, FX_FLOAT f); | 62 void SetAtNumber(const CFX_ByteString& key, FX_FLOAT f); |
| 63 void SetAtReference(const CFX_ByteStringC& key, | 63 void SetAtReference(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_ByteStringC& key, | 66 void SetAtReference(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 SetAtReference(key, pDoc, obj->GetObjNum()); |
| 70 } | 70 } |
| 71 void SetAtRect(const CFX_ByteStringC& key, const CFX_FloatRect& rect); | 71 void SetAtRect(const CFX_ByteString& key, const CFX_FloatRect& rect); |
| 72 void SetAtMatrix(const CFX_ByteStringC& key, const CFX_Matrix& matrix); | 72 void SetAtMatrix(const CFX_ByteString& key, const CFX_Matrix& matrix); |
| 73 void SetAtBoolean(const CFX_ByteStringC& key, FX_BOOL bValue); | 73 void SetAtBoolean(const CFX_ByteString& key, FX_BOOL bValue); |
| 74 | 74 |
| 75 void AddReference(const CFX_ByteStringC& key, | 75 void AddReference(const CFX_ByteString& key, |
| 76 CPDF_IndirectObjectHolder* pDoc, | 76 CPDF_IndirectObjectHolder* pDoc, |
| 77 uint32_t objnum); | 77 uint32_t objnum); |
| 78 | 78 |
| 79 // Invalidates iterators for the element with the key |key|. | 79 // Invalidates iterators for the element with the key |key|. |
| 80 void RemoveAt(const CFX_ByteStringC& key); | 80 void RemoveAt(const CFX_ByteString& key); |
| 81 | 81 |
| 82 // Invalidates iterators for the element with the key |oldkey|. | 82 // Invalidates iterators for the element with the key |oldkey|. |
| 83 void ReplaceKey(const CFX_ByteStringC& oldkey, const CFX_ByteStringC& newkey); | 83 void ReplaceKey(const CFX_ByteString& oldkey, const CFX_ByteString& newkey); |
| 84 | 84 |
| 85 iterator begin() { return m_Map.begin(); } | 85 iterator begin() { return m_Map.begin(); } |
| 86 iterator end() { return m_Map.end(); } | 86 iterator end() { return m_Map.end(); } |
| 87 const_iterator begin() const { return m_Map.begin(); } | 87 const_iterator begin() const { return m_Map.begin(); } |
| 88 const_iterator end() const { return m_Map.end(); } | 88 const_iterator end() const { return m_Map.end(); } |
| 89 | 89 |
| 90 protected: | 90 protected: |
| 91 ~CPDF_Dictionary() override; | 91 ~CPDF_Dictionary() 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 |