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

Side by Side Diff: core/fpdfapi/page/cpdf_contentmarkitem.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/edit/fpdf_edit_create.cpp ('k') | core/fpdfapi/page/cpdf_streamcontentparser.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/page/cpdf_contentmarkitem.h" 7 #include "core/fpdfapi/page/cpdf_contentmarkitem.h"
8 8
9 #include "core/fpdfapi/parser/cpdf_dictionary.h" 9 #include "core/fpdfapi/parser/cpdf_dictionary.h"
10 10
11 CPDF_ContentMarkItem::CPDF_ContentMarkItem() 11 CPDF_ContentMarkItem::CPDF_ContentMarkItem()
12 : m_ParamType(None), m_pPropertiesDict(nullptr) {} 12 : m_ParamType(None), m_pPropertiesDict(nullptr) {}
13 13
14 CPDF_ContentMarkItem::CPDF_ContentMarkItem(const CPDF_ContentMarkItem& that) 14 CPDF_ContentMarkItem::CPDF_ContentMarkItem(const CPDF_ContentMarkItem& that)
15 : m_MarkName(that.m_MarkName), 15 : m_MarkName(that.m_MarkName),
16 m_ParamType(that.m_ParamType), 16 m_ParamType(that.m_ParamType),
17 m_pPropertiesDict(that.m_pPropertiesDict) { 17 m_pPropertiesDict(that.m_pPropertiesDict) {
18 if (that.m_pDirectDict) 18 if (that.m_pDirectDict)
19 m_pDirectDict.reset(that.m_pDirectDict->Clone()->AsDictionary()); 19 m_pDirectDict = ToDictionary(that.m_pDirectDict->Clone());
20 } 20 }
21 21
22 CPDF_ContentMarkItem::~CPDF_ContentMarkItem() {} 22 CPDF_ContentMarkItem::~CPDF_ContentMarkItem() {}
23 23
24 CPDF_Dictionary* CPDF_ContentMarkItem::GetParam() const { 24 CPDF_Dictionary* CPDF_ContentMarkItem::GetParam() const {
25 switch (m_ParamType) { 25 switch (m_ParamType) {
26 case PropertiesDict: 26 case PropertiesDict:
27 return m_pPropertiesDict; 27 return m_pPropertiesDict;
28 case DirectDict: 28 case DirectDict:
29 return m_pDirectDict.get(); 29 return m_pDirectDict.get();
(...skipping 11 matching lines...) Expand all
41 void CPDF_ContentMarkItem::SetDirectDict( 41 void CPDF_ContentMarkItem::SetDirectDict(
42 std::unique_ptr<CPDF_Dictionary> pDict) { 42 std::unique_ptr<CPDF_Dictionary> pDict) {
43 m_ParamType = DirectDict; 43 m_ParamType = DirectDict;
44 m_pDirectDict = std::move(pDict); 44 m_pDirectDict = std::move(pDict);
45 } 45 }
46 46
47 void CPDF_ContentMarkItem::SetPropertiesDict(CPDF_Dictionary* pDict) { 47 void CPDF_ContentMarkItem::SetPropertiesDict(CPDF_Dictionary* pDict) {
48 m_ParamType = PropertiesDict; 48 m_ParamType = PropertiesDict;
49 m_pPropertiesDict = pDict; 49 m_pPropertiesDict = pDict;
50 } 50 }
OLDNEW
« no previous file with comments | « core/fpdfapi/edit/fpdf_edit_create.cpp ('k') | core/fpdfapi/page/cpdf_streamcontentparser.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698