diff options
author | Henrique Nakashima <hnakashima@chromium.org> | 2018-10-10 23:17:03 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2018-10-10 23:17:03 +0000 |
commit | 673b90ad5b21a3d17e64ef65d7053d582920fcbe (patch) | |
tree | d113f769e004a52f3789f36f73d4f5d99098a9fa /core/fpdfapi/page/cpdf_contentmarks.h | |
parent | fc41e77c97173592ea2abb88c3f6f4dc7c43349d (diff) | |
download | pdfium-673b90ad5b21a3d17e64ef65d7053d582920fcbe.tar.xz |
Rename CPDF_ContentMark to CPDF_ContentMarks.
Also change variable names and member names of this type.
This better reflects the fact that this class contains all the marks
in a page objects, not just one mark.
Change-Id: I4fe3d2620e78cbe423f18634f19fa82530d7efe1
Reviewed-on: https://pdfium-review.googlesource.com/c/43813
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
Diffstat (limited to 'core/fpdfapi/page/cpdf_contentmarks.h')
-rw-r--r-- | core/fpdfapi/page/cpdf_contentmarks.h | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/core/fpdfapi/page/cpdf_contentmarks.h b/core/fpdfapi/page/cpdf_contentmarks.h new file mode 100644 index 0000000000..335592b940 --- /dev/null +++ b/core/fpdfapi/page/cpdf_contentmarks.h @@ -0,0 +1,72 @@ +// Copyright 2016 PDFium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com + +#ifndef CORE_FPDFAPI_PAGE_CPDF_CONTENTMARKS_H_ +#define CORE_FPDFAPI_PAGE_CPDF_CONTENTMARKS_H_ + +#include <memory> +#include <vector> + +#include "core/fpdfapi/page/cpdf_contentmarkitem.h" +#include "core/fxcrt/fx_system.h" +#include "core/fxcrt/retain_ptr.h" + +class CPDF_Dictionary; + +class CPDF_ContentMarks { + public: + CPDF_ContentMarks(); + ~CPDF_ContentMarks(); + + std::unique_ptr<CPDF_ContentMarks> Clone(); + int GetMarkedContentID() const; + size_t CountItems() const; + bool ContainsItem(const CPDF_ContentMarkItem* pItem) const; + + // The returned pointer is never null. + CPDF_ContentMarkItem* GetItem(size_t index); + const CPDF_ContentMarkItem* GetItem(size_t index) const; + + void AddMark(ByteString name); + void AddMarkWithDirectDict(ByteString name, CPDF_Dictionary* pDict); + void AddMarkWithPropertiesDict(ByteString name, + CPDF_Dictionary* pDict, + const ByteString& property_name); + bool RemoveMark(CPDF_ContentMarkItem* pMarkItem); + void DeleteLastMark(); + size_t FindFirstDifference(const CPDF_ContentMarks* other) const; + + private: + class MarkData final : public Retainable { + public: + MarkData(); + MarkData(const MarkData& src); + ~MarkData() override; + + size_t CountItems() const; + bool ContainsItem(const CPDF_ContentMarkItem* pItem) const; + CPDF_ContentMarkItem* GetItem(size_t index); + const CPDF_ContentMarkItem* GetItem(size_t index) const; + + int GetMarkedContentID() const; + void AddMark(ByteString name); + void AddMarkWithDirectDict(ByteString name, CPDF_Dictionary* pDict); + void AddMarkWithPropertiesDict(ByteString name, + CPDF_Dictionary* pDict, + const ByteString& property_name); + bool RemoveMark(CPDF_ContentMarkItem* pMarkItem); + void DeleteLastMark(); + + private: + std::vector<RetainPtr<CPDF_ContentMarkItem>> m_Marks; + }; + + void EnsureMarkDataExists(); + + RetainPtr<MarkData> m_pMarkData; +}; + +#endif // CORE_FPDFAPI_PAGE_CPDF_CONTENTMARKS_H_ |