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

Side by Side Diff: core/fpdfdoc/doc_tagged.cpp

Issue 1862123003: Rename both As{Byte,Wide}StringC() helpers to AsStringC(). (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Rebase, fix new usage. Created 4 years, 8 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
« no previous file with comments | « core/fpdfdoc/doc_ocg.cpp ('k') | core/fpdfdoc/doc_utils.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 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 <map> 7 #include <map>
8 8
9 #include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" 9 #include "core/fpdfapi/fpdf_parser/include/cpdf_array.h"
10 #include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h" 10 #include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h"
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 return TRUE; 198 return TRUE;
199 } 199 }
200 CPDF_StructElementImpl::CPDF_StructElementImpl(CPDF_StructTreeImpl* pTree, 200 CPDF_StructElementImpl::CPDF_StructElementImpl(CPDF_StructTreeImpl* pTree,
201 CPDF_StructElementImpl* pParent, 201 CPDF_StructElementImpl* pParent,
202 CPDF_Dictionary* pDict) 202 CPDF_Dictionary* pDict)
203 : m_RefCount(0) { 203 : m_RefCount(0) {
204 m_pTree = pTree; 204 m_pTree = pTree;
205 m_pDict = pDict; 205 m_pDict = pDict;
206 m_Type = pDict->GetStringBy("S"); 206 m_Type = pDict->GetStringBy("S");
207 if (pTree->m_pRoleMap) { 207 if (pTree->m_pRoleMap) {
208 CFX_ByteString mapped = 208 CFX_ByteString mapped = pTree->m_pRoleMap->GetStringBy(m_Type.AsStringC());
209 pTree->m_pRoleMap->GetStringBy(m_Type.AsByteStringC());
210 if (!mapped.IsEmpty()) { 209 if (!mapped.IsEmpty()) {
211 m_Type = mapped; 210 m_Type = mapped;
212 } 211 }
213 } 212 }
214 m_pParent = pParent; 213 m_pParent = pParent;
215 LoadKids(pDict); 214 LoadKids(pDict);
216 } 215 }
217 CPDF_StructElementImpl::~CPDF_StructElementImpl() { 216 CPDF_StructElementImpl::~CPDF_StructElementImpl() {
218 for (int i = 0; i < m_Kids.GetSize(); i++) { 217 for (int i = 0; i < m_Kids.GetSize(); i++) {
219 if (m_Kids[i].m_Type == CPDF_StructKid::Element && 218 if (m_Kids[i].m_Type == CPDF_StructKid::Element &&
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
368 return nullptr; 367 return nullptr;
369 368
370 CPDF_Dictionary* pClassMap = m_pTree->m_pTreeRoot->GetDictBy("ClassMap"); 369 CPDF_Dictionary* pClassMap = m_pTree->m_pTreeRoot->GetDictBy("ClassMap");
371 if (!pClassMap) 370 if (!pClassMap)
372 return nullptr; 371 return nullptr;
373 372
374 if (CPDF_Array* pArray = pC->AsArray()) { 373 if (CPDF_Array* pArray = pC->AsArray()) {
375 for (uint32_t i = 0; i < pArray->GetCount(); i++) { 374 for (uint32_t i = 0; i < pArray->GetCount(); i++) {
376 CFX_ByteString class_name = pArray->GetStringAt(i); 375 CFX_ByteString class_name = pArray->GetStringAt(i);
377 CPDF_Dictionary* pClassDict = 376 CPDF_Dictionary* pClassDict =
378 pClassMap->GetDictBy(class_name.AsByteStringC()); 377 pClassMap->GetDictBy(class_name.AsStringC());
379 if (pClassDict && pClassDict->GetStringBy("O") == owner) 378 if (pClassDict && pClassDict->GetStringBy("O") == owner)
380 return pClassDict->GetDirectObjectBy(name); 379 return pClassDict->GetDirectObjectBy(name);
381 } 380 }
382 return nullptr; 381 return nullptr;
383 } 382 }
384 CFX_ByteString class_name = pC->GetString(); 383 CFX_ByteString class_name = pC->GetString();
385 CPDF_Dictionary* pClassDict = 384 CPDF_Dictionary* pClassDict = pClassMap->GetDictBy(class_name.AsStringC());
386 pClassMap->GetDictBy(class_name.AsByteStringC());
387 if (pClassDict && pClassDict->GetStringBy("O") == owner) 385 if (pClassDict && pClassDict->GetStringBy("O") == owner)
388 return pClassDict->GetDirectObjectBy(name); 386 return pClassDict->GetDirectObjectBy(name);
389 return nullptr; 387 return nullptr;
390 } 388 }
391 CPDF_Object* CPDF_StructElementImpl::GetAttr(const CFX_ByteStringC& owner, 389 CPDF_Object* CPDF_StructElementImpl::GetAttr(const CFX_ByteStringC& owner,
392 const CFX_ByteStringC& name, 390 const CFX_ByteStringC& name,
393 FX_BOOL bInheritable, 391 FX_BOOL bInheritable,
394 int subindex) { 392 int subindex) {
395 CPDF_Object* pAttr = GetAttr(owner, name, bInheritable); 393 CPDF_Object* pAttr = GetAttr(owner, name, bInheritable);
396 CPDF_Array* pArray = ToArray(pAttr); 394 CPDF_Array* pArray = ToArray(pAttr);
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
434 return ToNumber(pAttr) ? pAttr->GetNumber() : default_value; 432 return ToNumber(pAttr) ? pAttr->GetNumber() : default_value;
435 } 433 }
436 int CPDF_StructElementImpl::GetInteger(const CFX_ByteStringC& owner, 434 int CPDF_StructElementImpl::GetInteger(const CFX_ByteStringC& owner,
437 const CFX_ByteStringC& name, 435 const CFX_ByteStringC& name,
438 int default_value, 436 int default_value,
439 FX_BOOL bInheritable, 437 FX_BOOL bInheritable,
440 int subindex) { 438 int subindex) {
441 CPDF_Object* pAttr = GetAttr(owner, name, bInheritable, subindex); 439 CPDF_Object* pAttr = GetAttr(owner, name, bInheritable, subindex);
442 return ToNumber(pAttr) ? pAttr->GetInteger() : default_value; 440 return ToNumber(pAttr) ? pAttr->GetInteger() : default_value;
443 } 441 }
OLDNEW
« no previous file with comments | « core/fpdfdoc/doc_ocg.cpp ('k') | core/fpdfdoc/doc_utils.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698