Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(397)

Side by Side Diff: core/fpdfapi/parser/cpdf_dictionary.h

Issue 2489283003: Make AddIndirectObject() take a unique_ptr. (Closed)
Patch Set: Fix test Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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_PARSER_CPDF_DICTIONARY_H_ 7 #ifndef CORE_FPDFAPI_PARSER_CPDF_DICTIONARY_H_
8 #define CORE_FPDFAPI_PARSER_CPDF_DICTIONARY_H_ 8 #define CORE_FPDFAPI_PARSER_CPDF_DICTIONARY_H_
9 9
10 #include <map> 10 #include <map>
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 CFX_Matrix GetMatrixFor(const CFX_ByteString& key) const; 54 CFX_Matrix GetMatrixFor(const CFX_ByteString& key) const;
55 FX_FLOAT GetFloatFor(const CFX_ByteString& key) const { 55 FX_FLOAT GetFloatFor(const CFX_ByteString& key) const {
56 return GetNumberFor(key); 56 return GetNumberFor(key);
57 } 57 }
58 58
59 bool KeyExist(const CFX_ByteString& key) const; 59 bool KeyExist(const CFX_ByteString& key) const;
60 bool IsSignatureDict() const; 60 bool IsSignatureDict() const;
61 61
62 // Set* functions invalidate iterators for the element with the key |key|. 62 // Set* functions invalidate iterators for the element with the key |key|.
63 void SetFor(const CFX_ByteString& key, CPDF_Object* pObj); 63 void SetFor(const CFX_ByteString& key, CPDF_Object* pObj);
64 void SetBooleanFor(const CFX_ByteString& key, bool bValue);
64 void SetNameFor(const CFX_ByteString& key, const CFX_ByteString& name); 65 void SetNameFor(const CFX_ByteString& key, const CFX_ByteString& name);
65 void SetStringFor(const CFX_ByteString& key, const CFX_ByteString& str); 66 void SetStringFor(const CFX_ByteString& key, const CFX_ByteString& str);
66 void SetIntegerFor(const CFX_ByteString& key, int i); 67 void SetIntegerFor(const CFX_ByteString& key, int i);
67 void SetNumberFor(const CFX_ByteString& key, FX_FLOAT f); 68 void SetNumberFor(const CFX_ByteString& key, FX_FLOAT f);
68 void SetReferenceFor(const CFX_ByteString& key, 69 void SetReferenceFor(const CFX_ByteString& key,
69 CPDF_IndirectObjectHolder* pDoc, 70 CPDF_IndirectObjectHolder* pDoc,
70 uint32_t objnum); 71 uint32_t objnum);
72 void SetReferenceFor(const CFX_ByteString& key,
73 CPDF_IndirectObjectHolder* pDoc,
74 CPDF_Object* pObj);
75
71 void SetRectFor(const CFX_ByteString& key, const CFX_FloatRect& rect); 76 void SetRectFor(const CFX_ByteString& key, const CFX_FloatRect& rect);
72 void SetMatrixFor(const CFX_ByteString& key, const CFX_Matrix& matrix); 77 void SetMatrixFor(const CFX_ByteString& key, const CFX_Matrix& matrix);
73 void SetBooleanFor(const CFX_ByteString& key, bool bValue);
74 78
75 void ConvertToIndirectObjectFor(const CFX_ByteString& key, 79 void ConvertToIndirectObjectFor(const CFX_ByteString& key,
76 CPDF_IndirectObjectHolder* pHolder); 80 CPDF_IndirectObjectHolder* pHolder);
77 81
78 // Invalidates iterators for the element with the key |key|. 82 // Invalidates iterators for the element with the key |key|.
79 void RemoveFor(const CFX_ByteString& key); 83 void RemoveFor(const CFX_ByteString& key);
80 84
81 // Invalidates iterators for the element with the key |oldkey|. 85 // Invalidates iterators for the element with the key |oldkey|.
82 void ReplaceKey(const CFX_ByteString& oldkey, const CFX_ByteString& newkey); 86 void ReplaceKey(const CFX_ByteString& oldkey, const CFX_ByteString& newkey);
83 87
(...skipping 25 matching lines...) Expand all
109 inline std::unique_ptr<CPDF_Dictionary> ToDictionary( 113 inline std::unique_ptr<CPDF_Dictionary> ToDictionary(
110 std::unique_ptr<CPDF_Object> obj) { 114 std::unique_ptr<CPDF_Object> obj) {
111 CPDF_Dictionary* pDict = ToDictionary(obj.get()); 115 CPDF_Dictionary* pDict = ToDictionary(obj.get());
112 if (!pDict) 116 if (!pDict)
113 return nullptr; 117 return nullptr;
114 obj.release(); 118 obj.release();
115 return std::unique_ptr<CPDF_Dictionary>(pDict); 119 return std::unique_ptr<CPDF_Dictionary>(pDict);
116 } 120 }
117 121
118 #endif // CORE_FPDFAPI_PARSER_CPDF_DICTIONARY_H_ 122 #endif // CORE_FPDFAPI_PARSER_CPDF_DICTIONARY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698