• 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/cfx_shared_copy_on_write.h"
14 #include "core/fxcrt/fx_basic.h"
15 #include "core/fxcrt/fx_system.h"
16 
17 class CPDF_Dictionary;
18 
19 class CPDF_ContentMark {
20  public:
21   CPDF_ContentMark();
22   CPDF_ContentMark(const CPDF_ContentMark& that);
23   ~CPDF_ContentMark();
24 
25   void SetNull();
26 
27   int GetMCID() const;
28   int CountItems() const;
29   const CPDF_ContentMarkItem& GetItem(int i) const;
30 
31   bool HasMark(const CFX_ByteStringC& mark) const;
32   bool LookupMark(const CFX_ByteStringC& mark, CPDF_Dictionary*& pDict) const;
33   void AddMark(const CFX_ByteString& name,
34                CPDF_Dictionary* pDict,
35                bool bDirect);
36   void DeleteLastMark();
37 
38   explicit operator bool() const { return !!m_Ref; }
39 
40  private:
41   class MarkData {
42    public:
43     MarkData();
44     MarkData(const MarkData& src);
45     ~MarkData();
46 
47     int CountItems() const;
48     CPDF_ContentMarkItem& GetItem(int index);
49     const CPDF_ContentMarkItem& GetItem(int index) const;
50 
51     int GetMCID() const;
52     void AddMark(const CFX_ByteString& name,
53                  CPDF_Dictionary* pDict,
54                  bool bDictNeedClone);
55     void DeleteLastMark();
56 
57    private:
58     std::vector<CPDF_ContentMarkItem> m_Marks;
59   };
60 
61   CFX_SharedCopyOnWrite<MarkData> m_Ref;
62 };
63 
64 #endif  // CORE_FPDFAPI_PAGE_CPDF_CONTENTMARK_H_
65