OLD | NEW |
1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 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/fpdf_parser_utility.h" | 7 #include "core/fpdfapi/parser/fpdf_parser_utility.h" |
8 | 8 |
9 #include "core/fpdfapi/parser/cpdf_array.h" | 9 #include "core/fpdfapi/parser/cpdf_array.h" |
10 #include "core/fpdfapi/parser/cpdf_dictionary.h" | 10 #include "core/fpdfapi/parser/cpdf_dictionary.h" |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 } | 186 } |
187 } | 187 } |
188 buf << "]"; | 188 buf << "]"; |
189 break; | 189 break; |
190 } | 190 } |
191 case CPDF_Object::DICTIONARY: { | 191 case CPDF_Object::DICTIONARY: { |
192 const CPDF_Dictionary* p = pObj->AsDictionary(); | 192 const CPDF_Dictionary* p = pObj->AsDictionary(); |
193 buf << "<<"; | 193 buf << "<<"; |
194 for (const auto& it : *p) { | 194 for (const auto& it : *p) { |
195 const CFX_ByteString& key = it.first; | 195 const CFX_ByteString& key = it.first; |
196 CPDF_Object* pValue = it.second; | 196 CPDF_Object* pValue = it.second.get(); |
197 buf << "/" << PDF_NameEncode(key); | 197 buf << "/" << PDF_NameEncode(key); |
198 if (pValue && !pValue->IsInline()) { | 198 if (pValue && !pValue->IsInline()) { |
199 buf << " " << pValue->GetObjNum() << " 0 R "; | 199 buf << " " << pValue->GetObjNum() << " 0 R "; |
200 } else { | 200 } else { |
201 buf << pValue; | 201 buf << pValue; |
202 } | 202 } |
203 } | 203 } |
204 buf << ">>"; | 204 buf << ">>"; |
205 break; | 205 break; |
206 } | 206 } |
207 case CPDF_Object::STREAM: { | 207 case CPDF_Object::STREAM: { |
208 const CPDF_Stream* p = pObj->AsStream(); | 208 const CPDF_Stream* p = pObj->AsStream(); |
209 buf << p->GetDict() << "stream\r\n"; | 209 buf << p->GetDict() << "stream\r\n"; |
210 CPDF_StreamAcc acc; | 210 CPDF_StreamAcc acc; |
211 acc.LoadAllData(p, TRUE); | 211 acc.LoadAllData(p, TRUE); |
212 buf.AppendBlock(acc.GetData(), acc.GetSize()); | 212 buf.AppendBlock(acc.GetData(), acc.GetSize()); |
213 buf << "\r\nendstream"; | 213 buf << "\r\nendstream"; |
214 break; | 214 break; |
215 } | 215 } |
216 default: | 216 default: |
217 ASSERT(FALSE); | 217 ASSERT(FALSE); |
218 break; | 218 break; |
219 } | 219 } |
220 return buf; | 220 return buf; |
221 } | 221 } |
OLD | NEW |