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

Side by Side Diff: core/fpdfapi/parser/cpdf_object.cpp

Issue 2484033002: Return unique_ptr from CPDF_Object::Clone(). (Closed)
Patch Set: std::move() it 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
« no previous file with comments | « core/fpdfapi/parser/cpdf_object.h ('k') | core/fpdfapi/parser/cpdf_object_unittest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #include "core/fpdfapi/parser/cpdf_object.h" 7 #include "core/fpdfapi/parser/cpdf_object.h"
8 8
9 #include <algorithm> 9 #include <algorithm>
10 10
11 #include "core/fpdfapi/parser/cpdf_array.h" 11 #include "core/fpdfapi/parser/cpdf_array.h"
12 #include "core/fpdfapi/parser/cpdf_dictionary.h" 12 #include "core/fpdfapi/parser/cpdf_dictionary.h"
13 #include "core/fpdfapi/parser/cpdf_indirect_object_holder.h" 13 #include "core/fpdfapi/parser/cpdf_indirect_object_holder.h"
14 #include "core/fpdfapi/parser/cpdf_parser.h" 14 #include "core/fpdfapi/parser/cpdf_parser.h"
15 #include "core/fpdfapi/parser/fpdf_parser_decode.h" 15 #include "core/fpdfapi/parser/fpdf_parser_decode.h"
16 #include "core/fxcrt/fx_string.h" 16 #include "core/fxcrt/fx_string.h"
17 #include "third_party/base/stl_util.h" 17 #include "third_party/base/stl_util.h"
18 18
19 CPDF_Object::~CPDF_Object() {} 19 CPDF_Object::~CPDF_Object() {}
20 20
21 CPDF_Object* CPDF_Object::GetDirect() const { 21 CPDF_Object* CPDF_Object::GetDirect() const {
22 return const_cast<CPDF_Object*>(this); 22 return const_cast<CPDF_Object*>(this);
23 } 23 }
24 24
25 CPDF_Object* CPDF_Object::CloneObjectNonCyclic(bool bDirect) const { 25 std::unique_ptr<CPDF_Object> CPDF_Object::CloneObjectNonCyclic(
26 bool bDirect) const {
26 std::set<const CPDF_Object*> visited_objs; 27 std::set<const CPDF_Object*> visited_objs;
27 return CloneNonCyclic(bDirect, &visited_objs); 28 return CloneNonCyclic(bDirect, &visited_objs);
28 } 29 }
29 30
30 CPDF_Object* CPDF_Object::CloneDirectObject() const { 31 std::unique_ptr<CPDF_Object> CPDF_Object::CloneDirectObject() const {
31 return CloneObjectNonCyclic(true); 32 return CloneObjectNonCyclic(true);
32 } 33 }
33 34
34 CPDF_Object* CPDF_Object::CloneNonCyclic( 35 std::unique_ptr<CPDF_Object> CPDF_Object::CloneNonCyclic(
35 bool bDirect, 36 bool bDirect,
36 std::set<const CPDF_Object*>* pVisited) const { 37 std::set<const CPDF_Object*>* pVisited) const {
37 return Clone(); 38 return Clone();
38 } 39 }
39 40
40 CFX_ByteString CPDF_Object::GetString() const { 41 CFX_ByteString CPDF_Object::GetString() const {
41 return CFX_ByteString(); 42 return CFX_ByteString();
42 } 43 }
43 44
44 CFX_WideString CPDF_Object::GetUnicodeText() const { 45 CFX_WideString CPDF_Object::GetUnicodeText() const {
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 return nullptr; 150 return nullptr;
150 } 151 }
151 152
152 CPDF_String* CPDF_Object::AsString() { 153 CPDF_String* CPDF_Object::AsString() {
153 return nullptr; 154 return nullptr;
154 } 155 }
155 156
156 const CPDF_String* CPDF_Object::AsString() const { 157 const CPDF_String* CPDF_Object::AsString() const {
157 return nullptr; 158 return nullptr;
158 } 159 }
OLDNEW
« no previous file with comments | « core/fpdfapi/parser/cpdf_object.h ('k') | core/fpdfapi/parser/cpdf_object_unittest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698