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

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

Issue 1811053002: Move core/include/fpdfapi/fpdf_pageobj.h into core/fpdfapi. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 4 years, 9 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
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(const CPDF_ContentMarkData& src)
13 : m_Marks(src.m_Marks) {}
14
15 int CPDF_ContentMarkData::CountItems() const {
16 return pdfium::CollectionSize<int>(m_Marks);
17 }
18
19 int CPDF_ContentMarkData::GetMCID() const {
20 for (const auto& mark : m_Marks) {
21 CPDF_ContentMarkItem::ParamType type = mark.GetParamType();
22 if (type == CPDF_ContentMarkItem::PropertiesDict ||
23 type == CPDF_ContentMarkItem::DirectDict) {
24 CPDF_Dictionary* pDict = mark.GetParam();
25 if (pDict->KeyExist("MCID"))
26 return pDict->GetIntegerBy("MCID");
27 }
28 }
29 return -1;
30 }
31
32 void CPDF_ContentMarkData::AddMark(const CFX_ByteString& name,
33 CPDF_Dictionary* pDict,
34 FX_BOOL bDirect) {
35 CPDF_ContentMarkItem item;
36 item.SetName(name);
37 if (pDict) {
38 if (bDirect) {
39 item.SetParam(CPDF_ContentMarkItem::DirectDict,
40 ToDictionary(pDict->Clone()));
41 } else {
42 item.SetParam(CPDF_ContentMarkItem::PropertiesDict, pDict);
43 }
44 }
45 m_Marks.push_back(item);
46 }
47
48 void CPDF_ContentMarkData::DeleteLastMark() {
49 if (!m_Marks.empty())
50 m_Marks.pop_back();
51 }
OLDNEW
« no previous file with comments | « core/fpdfapi/fpdf_page/cpdf_contentmarkdata.h ('k') | core/fpdfapi/fpdf_page/cpdf_contentmarkitem.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698