• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2016 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 
7 #ifndef CORE_FPDFAPI_PAGE_CPDF_CONTENTMARK_H_
8 #define CORE_FPDFAPI_PAGE_CPDF_CONTENTMARK_H_
9 
10 #include <vector>
11 
12 #include "core/fpdfapi/page/cpdf_contentmarkitem.h"
13 #include "core/fxcrt/fx_system.h"
14 #include "core/fxcrt/shared_copy_on_write.h"
15 
16 class CPDF_Dictionary;
17 
18 class CPDF_ContentMark {
19  public:
20   CPDF_ContentMark();
21   CPDF_ContentMark(const CPDF_ContentMark& that);
22   ~CPDF_ContentMark();
23 
24   int GetMarkedContentID() const;
25   size_t CountItems() const;
26   const CPDF_ContentMarkItem& GetItem(size_t i) const;
27 
28   void AddMark(const ByteString& name, CPDF_Dictionary* pDict, bool bDirect);
29   void DeleteLastMark();
30 
HasRef()31   bool HasRef() const { return !!m_Ref; }
32 
33  private:
34   class MarkData : public Retainable {
35    public:
36     MarkData();
37     MarkData(const MarkData& src);
38     ~MarkData() override;
39 
40     size_t CountItems() const;
41     const CPDF_ContentMarkItem& GetItem(size_t index) const;
42 
43     int GetMarkedContentID() const;
44     void AddMark(const ByteString& name,
45                  CPDF_Dictionary* pDict,
46                  bool bDictNeedClone);
47     void DeleteLastMark();
48 
49    private:
50     std::vector<CPDF_ContentMarkItem> m_Marks;
51   };
52 
53   SharedCopyOnWrite<MarkData> m_Ref;
54 };
55 
56 #endif  // CORE_FPDFAPI_PAGE_CPDF_CONTENTMARK_H_
57