Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(37)

Side by Side Diff: core/fpdfapi/fpdf_page/cpdf_contentmarkdata.cpp

Issue 2312743005: Make CPDF_ContentMarkData private to CPDF_ContentMark (Closed)
Patch Set: Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « core/fpdfapi/fpdf_page/cpdf_contentmarkdata.h ('k') | core/fpdfdoc/cpdf_occontext.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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 #include "core/fpdfapi/fpdf_page/cpdf_contentmarkdata.h"
8
9 #include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h"
10 #include "third_party/base/stl_util.h"
11
12 CPDF_ContentMarkData::CPDF_ContentMarkData() {}
13
14 CPDF_ContentMarkData::CPDF_ContentMarkData(const CPDF_ContentMarkData& src)
15 : m_Marks(src.m_Marks) {}
16
17 CPDF_ContentMarkData::~CPDF_ContentMarkData() {}
18
19 int CPDF_ContentMarkData::CountItems() const {
20 return pdfium::CollectionSize<int>(m_Marks);
21 }
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
31 int CPDF_ContentMarkData::GetMCID() const {
32 for (const auto& mark : m_Marks) {
33 CPDF_ContentMarkItem::ParamType type = mark.GetParamType();
34 if (type == CPDF_ContentMarkItem::PropertiesDict ||
35 type == CPDF_ContentMarkItem::DirectDict) {
36 CPDF_Dictionary* pDict = mark.GetParam();
37 if (pDict->KeyExist("MCID"))
38 return pDict->GetIntegerBy("MCID");
39 }
40 }
41 return -1;
42 }
43
44 void CPDF_ContentMarkData::AddMark(const CFX_ByteString& name,
45 CPDF_Dictionary* pDict,
46 FX_BOOL bDirect) {
47 CPDF_ContentMarkItem item;
48 item.SetName(name);
49 if (pDict) {
50 if (bDirect) {
51 item.SetParam(CPDF_ContentMarkItem::DirectDict,
52 ToDictionary(pDict->Clone()));
53 } else {
54 item.SetParam(CPDF_ContentMarkItem::PropertiesDict, pDict);
55 }
56 }
57 m_Marks.push_back(item);
58 }
59
60 void CPDF_ContentMarkData::DeleteLastMark() {
61 if (!m_Marks.empty())
62 m_Marks.pop_back();
63 }
OLDNEW
« no previous file with comments | « core/fpdfapi/fpdf_page/cpdf_contentmarkdata.h ('k') | core/fpdfdoc/cpdf_occontext.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698