| 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_page/cpdf_contentmarkdata.h" | 7 #include "core/fpdfapi/fpdf_page/cpdf_contentmarkdata.h" |
| 8 | 8 |
| 9 #include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h" | 9 #include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h" |
| 10 #include "third_party/base/stl_util.h" | 10 #include "third_party/base/stl_util.h" |
| 11 | 11 |
| 12 CPDF_ContentMarkData::CPDF_ContentMarkData() {} |
| 13 |
| 12 CPDF_ContentMarkData::CPDF_ContentMarkData(const CPDF_ContentMarkData& src) | 14 CPDF_ContentMarkData::CPDF_ContentMarkData(const CPDF_ContentMarkData& src) |
| 13 : m_Marks(src.m_Marks) {} | 15 : m_Marks(src.m_Marks) {} |
| 14 | 16 |
| 17 CPDF_ContentMarkData::~CPDF_ContentMarkData() {} |
| 18 |
| 15 int CPDF_ContentMarkData::CountItems() const { | 19 int CPDF_ContentMarkData::CountItems() const { |
| 16 return pdfium::CollectionSize<int>(m_Marks); | 20 return pdfium::CollectionSize<int>(m_Marks); |
| 17 } | 21 } |
| 18 | 22 |
| 23 CPDF_ContentMarkItem& CPDF_ContentMarkData::GetItem(int index) { |
| 24 return m_Marks[index]; |
| 25 } |
| 26 |
| 27 const CPDF_ContentMarkItem& CPDF_ContentMarkData::GetItem(int index) const { |
| 28 return m_Marks[index]; |
| 29 } |
| 30 |
| 19 int CPDF_ContentMarkData::GetMCID() const { | 31 int CPDF_ContentMarkData::GetMCID() const { |
| 20 for (const auto& mark : m_Marks) { | 32 for (const auto& mark : m_Marks) { |
| 21 CPDF_ContentMarkItem::ParamType type = mark.GetParamType(); | 33 CPDF_ContentMarkItem::ParamType type = mark.GetParamType(); |
| 22 if (type == CPDF_ContentMarkItem::PropertiesDict || | 34 if (type == CPDF_ContentMarkItem::PropertiesDict || |
| 23 type == CPDF_ContentMarkItem::DirectDict) { | 35 type == CPDF_ContentMarkItem::DirectDict) { |
| 24 CPDF_Dictionary* pDict = mark.GetParam(); | 36 CPDF_Dictionary* pDict = mark.GetParam(); |
| 25 if (pDict->KeyExist("MCID")) | 37 if (pDict->KeyExist("MCID")) |
| 26 return pDict->GetIntegerBy("MCID"); | 38 return pDict->GetIntegerBy("MCID"); |
| 27 } | 39 } |
| 28 } | 40 } |
| (...skipping 13 matching lines...) Expand all Loading... |
| 42 item.SetParam(CPDF_ContentMarkItem::PropertiesDict, pDict); | 54 item.SetParam(CPDF_ContentMarkItem::PropertiesDict, pDict); |
| 43 } | 55 } |
| 44 } | 56 } |
| 45 m_Marks.push_back(item); | 57 m_Marks.push_back(item); |
| 46 } | 58 } |
| 47 | 59 |
| 48 void CPDF_ContentMarkData::DeleteLastMark() { | 60 void CPDF_ContentMarkData::DeleteLastMark() { |
| 49 if (!m_Marks.empty()) | 61 if (!m_Marks.empty()) |
| 50 m_Marks.pop_back(); | 62 m_Marks.pop_back(); |
| 51 } | 63 } |
| OLD | NEW |