diff options
author | Henrique Nakashima <hnakashima@chromium.org> | 2018-07-10 21:04:05 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2018-07-10 21:04:05 +0000 |
commit | 144107d3ca6ddd2724a460c4da4a20e6e1b7f1b7 (patch) | |
tree | 7fc11c898c7d5397f8b910d447eccfd04680f288 /core/fpdfapi/page/cpdf_contentmark.cpp | |
parent | 416cbeab1d93b1261dfb4584e0c8e47d9cd4720f (diff) | |
download | pdfium-144107d3ca6ddd2724a460c4da4a20e6e1b7f1b7.tar.xz |
Create API for adding content marks and setting their params.chromium/3488
This CL creates the following new functions in the public API:
- FPDFPageObj_AddMark
- FPDFPageObjMark_SetIntParam
- FPDFPageObjMark_SetStringParam
Bug: pdfium:1037
Change-Id: Icabf3fdd8e8153b9156bab807a3708d38a9365d8
Reviewed-on: https://pdfium-review.googlesource.com/37330
Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Diffstat (limited to 'core/fpdfapi/page/cpdf_contentmark.cpp')
-rw-r--r-- | core/fpdfapi/page/cpdf_contentmark.cpp | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/core/fpdfapi/page/cpdf_contentmark.cpp b/core/fpdfapi/page/cpdf_contentmark.cpp index 6021dc893d..912cc0ea03 100644 --- a/core/fpdfapi/page/cpdf_contentmark.cpp +++ b/core/fpdfapi/page/cpdf_contentmark.cpp @@ -29,7 +29,12 @@ size_t CPDF_ContentMark::CountItems() const { return m_pMarkData->CountItems(); } -const CPDF_ContentMarkItem& CPDF_ContentMark::GetItem(size_t i) const { +CPDF_ContentMarkItem* CPDF_ContentMark::GetItem(size_t i) { + ASSERT(i < CountItems()); + return m_pMarkData->GetItem(i); +} + +const CPDF_ContentMarkItem* CPDF_ContentMark::GetItem(size_t i) const { ASSERT(i < CountItems()); return m_pMarkData->GetItem(i); } @@ -42,7 +47,7 @@ int CPDF_ContentMark::GetMarkedContentID() const { } void CPDF_ContentMark::AddMark(ByteString name, - const CPDF_Dictionary* pDict, + CPDF_Dictionary* pDict, bool bDirect) { if (!m_pMarkData) m_pMarkData.Reset(new MarkData()); @@ -70,9 +75,13 @@ size_t CPDF_ContentMark::MarkData::CountItems() const { return m_Marks.size(); } -const CPDF_ContentMarkItem& CPDF_ContentMark::MarkData::GetItem( +CPDF_ContentMarkItem* CPDF_ContentMark::MarkData::GetItem(size_t index) { + return m_Marks[index].Get(); +} + +const CPDF_ContentMarkItem* CPDF_ContentMark::MarkData::GetItem( size_t index) const { - return *m_Marks[index]; + return m_Marks[index].Get(); } int CPDF_ContentMark::MarkData::GetMarkedContentID() const { @@ -85,7 +94,7 @@ int CPDF_ContentMark::MarkData::GetMarkedContentID() const { } void CPDF_ContentMark::MarkData::AddMark(ByteString name, - const CPDF_Dictionary* pDict, + CPDF_Dictionary* pDict, bool bDirect) { auto pItem = pdfium::MakeRetain<CPDF_ContentMarkItem>(); pItem->SetName(std::move(name)); |