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

Side by Side Diff: core/fpdfapi/parser/cpdf_array.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_ARRAY_H_ 7 #ifndef CORE_FPDFAPI_PARSER_CPDF_ARRAY_H_
8 #define CORE_FPDFAPI_PARSER_CPDF_ARRAY_H_ 8 #define CORE_FPDFAPI_PARSER_CPDF_ARRAY_H_
9 9
10 #include <set> 10 #include <set>
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 void InsertAt(size_t index, CPDF_Object* pObj); 48 void InsertAt(size_t index, CPDF_Object* pObj);
49 void RemoveAt(size_t index, size_t nCount = 1); 49 void RemoveAt(size_t index, size_t nCount = 1);
50 void ConvertToIndirectObjectAt(size_t index, CPDF_IndirectObjectHolder* pDoc); 50 void ConvertToIndirectObjectAt(size_t index, CPDF_IndirectObjectHolder* pDoc);
51 51
52 void Add(CPDF_Object* pObj); 52 void Add(CPDF_Object* pObj);
53 void AddNumber(FX_FLOAT f); 53 void AddNumber(FX_FLOAT f);
54 void AddInteger(int i); 54 void AddInteger(int i);
55 void AddString(const CFX_ByteString& str); 55 void AddString(const CFX_ByteString& str);
56 void AddName(const CFX_ByteString& str); 56 void AddName(const CFX_ByteString& str);
57 void AddReference(CPDF_IndirectObjectHolder* pDoc, uint32_t objnum); 57 void AddReference(CPDF_IndirectObjectHolder* pDoc, uint32_t objnum);
58 void AddReference(CPDF_IndirectObjectHolder* pDoc, CPDF_Object* pObj);
58 59
59 iterator begin() { return m_Objects.begin(); } 60 iterator begin() { return m_Objects.begin(); }
60 iterator end() { return m_Objects.end(); } 61 iterator end() { return m_Objects.end(); }
61 const_iterator begin() const { return m_Objects.begin(); } 62 const_iterator begin() const { return m_Objects.begin(); }
62 const_iterator end() const { return m_Objects.end(); } 63 const_iterator end() const { return m_Objects.end(); }
63 64
64 protected: 65 protected:
65 std::unique_ptr<CPDF_Object> CloneNonCyclic( 66 std::unique_ptr<CPDF_Object> CloneNonCyclic(
66 bool bDirect, 67 bool bDirect,
67 std::set<const CPDF_Object*>* pVisited) const override; 68 std::set<const CPDF_Object*>* pVisited) const override;
(...skipping 11 matching lines...) Expand all
79 80
80 inline std::unique_ptr<CPDF_Array> ToArray(std::unique_ptr<CPDF_Object> obj) { 81 inline std::unique_ptr<CPDF_Array> ToArray(std::unique_ptr<CPDF_Object> obj) {
81 CPDF_Array* pArray = ToArray(obj.get()); 82 CPDF_Array* pArray = ToArray(obj.get());
82 if (!pArray) 83 if (!pArray)
83 return nullptr; 84 return nullptr;
84 obj.release(); 85 obj.release();
85 return std::unique_ptr<CPDF_Array>(pArray); 86 return std::unique_ptr<CPDF_Array>(pArray);
86 } 87 }
87 88
88 #endif // CORE_FPDFAPI_PARSER_CPDF_ARRAY_H_ 89 #endif // CORE_FPDFAPI_PARSER_CPDF_ARRAY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698