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_dictionary.h" | 7 #include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h" |
8 | 8 |
9 #include "core/fpdfapi/fpdf_parser/cpdf_boolean.h" | 9 #include "core/fpdfapi/fpdf_parser/cpdf_boolean.h" |
10 #include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" | 10 #include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" |
(...skipping 26 matching lines...) Expand all Loading... | |
37 } | 37 } |
38 | 38 |
39 CPDF_Dictionary* CPDF_Dictionary::AsDictionary() { | 39 CPDF_Dictionary* CPDF_Dictionary::AsDictionary() { |
40 return this; | 40 return this; |
41 } | 41 } |
42 | 42 |
43 const CPDF_Dictionary* CPDF_Dictionary::AsDictionary() const { | 43 const CPDF_Dictionary* CPDF_Dictionary::AsDictionary() const { |
44 return this; | 44 return this; |
45 } | 45 } |
46 | 46 |
47 CPDF_Object* CPDF_Dictionary::Clone(FX_BOOL bDirect) const { | 47 CPDF_Object* CPDF_Dictionary::Clone() const { |
48 return CloneDeRef(false); | |
49 } | |
50 | |
51 CPDF_Object* CPDF_Dictionary::CloneWithCheck( | |
52 bool bDirect, | |
53 std::set<const CPDF_Object*>* pVisited) const { | |
54 pVisited->insert(this); | |
48 CPDF_Dictionary* pCopy = new CPDF_Dictionary(); | 55 CPDF_Dictionary* pCopy = new CPDF_Dictionary(); |
49 for (const auto& it : *this) | 56 for (const auto& it : *this) { |
50 pCopy->m_Map.insert(std::make_pair(it.first, it.second->Clone(bDirect))); | 57 auto value = it.second; |
Lei Zhang
2016/08/18 15:16:44
auto* ?
Wei Li
2016/08/18 22:02:30
Changed to actual type
| |
58 if (!pdfium::ContainsKey(*pVisited, value)) | |
dsinclair
2016/08/18 14:04:31
nit: add {}'s
Wei Li
2016/08/18 22:02:30
Done.
| |
59 pCopy->m_Map.insert( | |
60 std::make_pair(it.first, value->CloneWithCheck(bDirect, pVisited))); | |
61 } | |
51 return pCopy; | 62 return pCopy; |
52 } | 63 } |
53 | 64 |
54 CPDF_Object* CPDF_Dictionary::GetObjectBy(const CFX_ByteString& key) const { | 65 CPDF_Object* CPDF_Dictionary::GetObjectBy(const CFX_ByteString& key) const { |
55 auto it = m_Map.find(key); | 66 auto it = m_Map.find(key); |
56 return it != m_Map.end() ? it->second : nullptr; | 67 return it != m_Map.end() ? it->second : nullptr; |
57 } | 68 } |
58 | 69 |
59 CPDF_Object* CPDF_Dictionary::GetDirectObjectBy( | 70 CPDF_Object* CPDF_Dictionary::GetDirectObjectBy( |
60 const CFX_ByteString& key) const { | 71 const CFX_ByteString& key) const { |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
236 const CFX_Matrix& matrix) { | 247 const CFX_Matrix& matrix) { |
237 CPDF_Array* pArray = new CPDF_Array; | 248 CPDF_Array* pArray = new CPDF_Array; |
238 pArray->AddNumber(matrix.a); | 249 pArray->AddNumber(matrix.a); |
239 pArray->AddNumber(matrix.b); | 250 pArray->AddNumber(matrix.b); |
240 pArray->AddNumber(matrix.c); | 251 pArray->AddNumber(matrix.c); |
241 pArray->AddNumber(matrix.d); | 252 pArray->AddNumber(matrix.d); |
242 pArray->AddNumber(matrix.e); | 253 pArray->AddNumber(matrix.e); |
243 pArray->AddNumber(matrix.f); | 254 pArray->AddNumber(matrix.f); |
244 SetAt(key, pArray); | 255 SetAt(key, pArray); |
245 } | 256 } |
OLD | NEW |