| 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/fxcrt/xml_int.h" | 7 #include "core/fxcrt/xml_int.h" |
| 8 | 8 |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 683 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 694 } | 694 } |
| 695 CFX_WideString CXML_Element::GetContent(uint32_t index) const { | 695 CFX_WideString CXML_Element::GetContent(uint32_t index) const { |
| 696 if (index < m_Children.size() && m_Children[index].type == Content) { | 696 if (index < m_Children.size() && m_Children[index].type == Content) { |
| 697 CXML_Content* pContent = | 697 CXML_Content* pContent = |
| 698 static_cast<CXML_Content*>(m_Children[index].child); | 698 static_cast<CXML_Content*>(m_Children[index].child); |
| 699 if (pContent) | 699 if (pContent) |
| 700 return pContent->m_Content; | 700 return pContent->m_Content; |
| 701 } | 701 } |
| 702 return CFX_WideString(); | 702 return CFX_WideString(); |
| 703 } | 703 } |
| 704 CXML_Element* CXML_Element::GetElement(uint32_t index) const { | 704 CXML_Element* CXML_Element::GetObjectBy(uint32_t index) const { |
| 705 if (index < m_Children.size() && m_Children[index].type == Element) { | 705 if (index < m_Children.size() && m_Children[index].type == Element) { |
| 706 return static_cast<CXML_Element*>(m_Children[index].child); | 706 return static_cast<CXML_Element*>(m_Children[index].child); |
| 707 } | 707 } |
| 708 return nullptr; | 708 return nullptr; |
| 709 } | 709 } |
| 710 uint32_t CXML_Element::CountElements(const CFX_ByteStringC& space, | 710 uint32_t CXML_Element::CountElements(const CFX_ByteStringC& space, |
| 711 const CFX_ByteStringC& tag) const { | 711 const CFX_ByteStringC& tag) const { |
| 712 int count = 0; | 712 int count = 0; |
| 713 for (const ChildRecord& record : m_Children) { | 713 for (const ChildRecord& record : m_Children) { |
| 714 if (record.type != Element) | 714 if (record.type != Element) |
| 715 continue; | 715 continue; |
| 716 | 716 |
| 717 CXML_Element* pKid = static_cast<CXML_Element*>(record.child); | 717 CXML_Element* pKid = static_cast<CXML_Element*>(record.child); |
| 718 if ((space.IsEmpty() || pKid->m_QSpaceName == space) && | 718 if ((space.IsEmpty() || pKid->m_QSpaceName == space) && |
| 719 pKid->m_TagName == tag) { | 719 pKid->m_TagName == tag) { |
| 720 count++; | 720 count++; |
| 721 } | 721 } |
| 722 } | 722 } |
| 723 return count; | 723 return count; |
| 724 } | 724 } |
| 725 CXML_Element* CXML_Element::GetElement(const CFX_ByteStringC& space, | 725 CXML_Element* CXML_Element::GetObjectBy(const CFX_ByteStringC& space, |
| 726 const CFX_ByteStringC& tag, | 726 const CFX_ByteStringC& tag, |
| 727 int index) const { | 727 int index) const { |
| 728 if (index < 0) | 728 if (index < 0) |
| 729 return nullptr; | 729 return nullptr; |
| 730 | 730 |
| 731 for (const ChildRecord& record : m_Children) { | 731 for (const ChildRecord& record : m_Children) { |
| 732 if (record.type != Element) | 732 if (record.type != Element) |
| 733 continue; | 733 continue; |
| 734 | 734 |
| 735 CXML_Element* pKid = static_cast<CXML_Element*>(record.child); | 735 CXML_Element* pKid = static_cast<CXML_Element*>(record.child); |
| 736 if ((space.IsEmpty() || pKid->m_QSpaceName == space) && | 736 if ((space.IsEmpty() || pKid->m_QSpaceName == space) && |
| 737 pKid->m_TagName == tag) { | 737 pKid->m_TagName == tag) { |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 786 m_pMap->push_back({space, name, value}); | 786 m_pMap->push_back({space, name, value}); |
| 787 } | 787 } |
| 788 | 788 |
| 789 int CXML_AttrMap::GetSize() const { | 789 int CXML_AttrMap::GetSize() const { |
| 790 return m_pMap ? pdfium::CollectionSize<int>(*m_pMap) : 0; | 790 return m_pMap ? pdfium::CollectionSize<int>(*m_pMap) : 0; |
| 791 } | 791 } |
| 792 | 792 |
| 793 CXML_AttrItem& CXML_AttrMap::GetAt(int index) const { | 793 CXML_AttrItem& CXML_AttrMap::GetAt(int index) const { |
| 794 return (*m_pMap)[index]; | 794 return (*m_pMap)[index]; |
| 795 } | 795 } |
| OLD | NEW |