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

Side by Side Diff: core/fpdfapi/fpdf_parser/cpdf_array.cpp

Issue 2001783003: Get rid of CPDF_Object::GetArray(). (Closed) Base URL: https://pdfium.googlesource.com/pdfium@master
Patch Set: Created 4 years, 7 months 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 #include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" 7 #include "core/fpdfapi/fpdf_parser/include/cpdf_array.h"
8 8
9 #include "core/fpdfapi/fpdf_parser/include/cpdf_name.h" 9 #include "core/fpdfapi/fpdf_parser/include/cpdf_name.h"
10 #include "core/fpdfapi/fpdf_parser/include/cpdf_number.h" 10 #include "core/fpdfapi/fpdf_parser/include/cpdf_number.h"
11 #include "core/fpdfapi/fpdf_parser/include/cpdf_reference.h" 11 #include "core/fpdfapi/fpdf_parser/include/cpdf_reference.h"
12 #include "core/fpdfapi/fpdf_parser/include/cpdf_stream.h" 12 #include "core/fpdfapi/fpdf_parser/include/cpdf_stream.h"
13 #include "core/fpdfapi/fpdf_parser/include/cpdf_string.h" 13 #include "core/fpdfapi/fpdf_parser/include/cpdf_string.h"
14 14
15 CPDF_Array::CPDF_Array() {} 15 CPDF_Array::CPDF_Array() {}
16 16
17 CPDF_Array::~CPDF_Array() { 17 CPDF_Array::~CPDF_Array() {
18 for (auto& it : m_Objects) { 18 for (auto& it : m_Objects) {
19 if (it) 19 if (it)
20 it->Release(); 20 it->Release();
21 } 21 }
22 } 22 }
23 23
24 CPDF_Object::Type CPDF_Array::GetType() const { 24 CPDF_Object::Type CPDF_Array::GetType() const {
25 return ARRAY; 25 return ARRAY;
26 } 26 }
27 27
28 CPDF_Array* CPDF_Array::GetArray() const {
29 // The method should be made non-const if we want to not be const.
30 // See bug #234.
31 return const_cast<CPDF_Array*>(this);
32 }
33
34 bool CPDF_Array::IsArray() const { 28 bool CPDF_Array::IsArray() const {
35 return true; 29 return true;
36 } 30 }
37 31
38 CPDF_Array* CPDF_Array::AsArray() { 32 CPDF_Array* CPDF_Array::AsArray() {
39 return this; 33 return this;
40 } 34 }
41 35
42 const CPDF_Array* CPDF_Array::AsArray() const { 36 const CPDF_Array* CPDF_Array::AsArray() const {
43 return this; 37 return this;
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 ASSERT(IsArray()); 191 ASSERT(IsArray());
198 CPDF_Number* pNumber = new CPDF_Number(f); 192 CPDF_Number* pNumber = new CPDF_Number(f);
199 Add(pNumber); 193 Add(pNumber);
200 } 194 }
201 195
202 void CPDF_Array::AddReference(CPDF_IndirectObjectHolder* pDoc, 196 void CPDF_Array::AddReference(CPDF_IndirectObjectHolder* pDoc,
203 uint32_t objnum) { 197 uint32_t objnum) {
204 ASSERT(IsArray()); 198 ASSERT(IsArray());
205 Add(new CPDF_Reference(pDoc, objnum)); 199 Add(new CPDF_Reference(pDoc, objnum));
206 } 200 }
OLDNEW
« no previous file with comments | « core/fpdfapi/fpdf_page/fpdf_page_parser.cpp ('k') | core/fpdfapi/fpdf_parser/cpdf_data_avail.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698