OLD | NEW |
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" |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 | 94 |
95 FX_FLOAT CPDF_Array::GetNumberAt(size_t i) const { | 95 FX_FLOAT CPDF_Array::GetNumberAt(size_t i) const { |
96 if (i >= m_Objects.size()) | 96 if (i >= m_Objects.size()) |
97 return 0; | 97 return 0; |
98 return m_Objects.at(i)->GetNumber(); | 98 return m_Objects.at(i)->GetNumber(); |
99 } | 99 } |
100 | 100 |
101 CPDF_Dictionary* CPDF_Array::GetDictAt(size_t i) const { | 101 CPDF_Dictionary* CPDF_Array::GetDictAt(size_t i) const { |
102 CPDF_Object* p = GetDirectObjectAt(i); | 102 CPDF_Object* p = GetDirectObjectAt(i); |
103 if (!p) | 103 if (!p) |
104 return NULL; | 104 return nullptr; |
105 if (CPDF_Dictionary* pDict = p->AsDictionary()) | 105 if (CPDF_Dictionary* pDict = p->AsDictionary()) |
106 return pDict; | 106 return pDict; |
107 if (CPDF_Stream* pStream = p->AsStream()) | 107 if (CPDF_Stream* pStream = p->AsStream()) |
108 return pStream->GetDict(); | 108 return pStream->GetDict(); |
109 return NULL; | 109 return nullptr; |
110 } | 110 } |
111 | 111 |
112 CPDF_Stream* CPDF_Array::GetStreamAt(size_t i) const { | 112 CPDF_Stream* CPDF_Array::GetStreamAt(size_t i) const { |
113 return ToStream(GetDirectObjectAt(i)); | 113 return ToStream(GetDirectObjectAt(i)); |
114 } | 114 } |
115 | 115 |
116 CPDF_Array* CPDF_Array::GetArrayAt(size_t i) const { | 116 CPDF_Array* CPDF_Array::GetArrayAt(size_t i) const { |
117 return ToArray(GetDirectObjectAt(i)); | 117 return ToArray(GetDirectObjectAt(i)); |
118 } | 118 } |
119 | 119 |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 ASSERT(IsArray()); | 191 ASSERT(IsArray()); |
192 CPDF_Number* pNumber = new CPDF_Number(f); | 192 CPDF_Number* pNumber = new CPDF_Number(f); |
193 Add(pNumber); | 193 Add(pNumber); |
194 } | 194 } |
195 | 195 |
196 void CPDF_Array::AddReference(CPDF_IndirectObjectHolder* pDoc, | 196 void CPDF_Array::AddReference(CPDF_IndirectObjectHolder* pDoc, |
197 uint32_t objnum) { | 197 uint32_t objnum) { |
198 ASSERT(IsArray()); | 198 ASSERT(IsArray()); |
199 Add(new CPDF_Reference(pDoc, objnum)); | 199 Add(new CPDF_Reference(pDoc, objnum)); |
200 } | 200 } |
OLD | NEW |