summaryrefslogtreecommitdiff
path: root/fpdfsdk
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2018-10-09 19:02:24 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-10-09 19:02:24 +0000
commit7fb895f623e607a3c3b26b2caca0b15a0ef6947c (patch)
treee39a0c0bcd544c134ee79eefd1e51dc32c271466 /fpdfsdk
parent615961cf3f78c7c34569a31698b7fa681208af84 (diff)
downloadpdfium-7fb895f623e607a3c3b26b2caca0b15a0ef6947c.tar.xz
Make more CPDFSDK_AnnotIterator members const.
Change-Id: I1c387ad9f6e1e4e87ebd7b778789617f93cf2c76 Reviewed-on: https://pdfium-review.googlesource.com/c/43614 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
Diffstat (limited to 'fpdfsdk')
-rw-r--r--fpdfsdk/cpdfsdk_annotiterator.cpp23
-rw-r--r--fpdfsdk/cpdfsdk_annotiterator.h6
2 files changed, 16 insertions, 13 deletions
diff --git a/fpdfsdk/cpdfsdk_annotiterator.cpp b/fpdfsdk/cpdfsdk_annotiterator.cpp
index 0dcb5bd917..d85dbe46eb 100644
--- a/fpdfsdk/cpdfsdk_annotiterator.cpp
+++ b/fpdfsdk/cpdfsdk_annotiterator.cpp
@@ -26,20 +26,23 @@ bool CompareByTopDescending(const CPDFSDK_Annot* p1, const CPDFSDK_Annot* p2) {
return GetAnnotRect(p1).top > GetAnnotRect(p2).top;
}
+CPDFSDK_AnnotIterator::TabOrder GetTabOrder(CPDFSDK_PageView* pPageView) {
+ CPDF_Page* pPDFPage = pPageView->GetPDFPage();
+ ByteString sTabs = pPDFPage->GetDict()->GetStringFor("Tabs");
+ if (sTabs == "R")
+ return CPDFSDK_AnnotIterator::ROW;
+ if (sTabs == "C")
+ return CPDFSDK_AnnotIterator::COLUMN;
+ return CPDFSDK_AnnotIterator::STRUCTURE;
+}
+
} // namespace
CPDFSDK_AnnotIterator::CPDFSDK_AnnotIterator(CPDFSDK_PageView* pPageView,
CPDF_Annot::Subtype nAnnotSubtype)
- : m_eTabOrder(STRUCTURE),
- m_pPageView(pPageView),
- m_nAnnotSubtype(nAnnotSubtype) {
- CPDF_Page* pPDFPage = m_pPageView->GetPDFPage();
- ByteString sTabs = pPDFPage->GetDict()->GetStringFor("Tabs");
- if (sTabs == "R")
- m_eTabOrder = ROW;
- else if (sTabs == "C")
- m_eTabOrder = COLUMN;
-
+ : m_pPageView(pPageView),
+ m_nAnnotSubtype(nAnnotSubtype),
+ m_eTabOrder(GetTabOrder(pPageView)) {
GenerateResults();
}
diff --git a/fpdfsdk/cpdfsdk_annotiterator.h b/fpdfsdk/cpdfsdk_annotiterator.h
index 723550edc5..fd7cbdc6b1 100644
--- a/fpdfsdk/cpdfsdk_annotiterator.h
+++ b/fpdfsdk/cpdfsdk_annotiterator.h
@@ -19,7 +19,7 @@ class CPDFSDK_PageView;
class CPDFSDK_AnnotIterator {
public:
- enum TabOrder { STRUCTURE = 0, ROW, COLUMN };
+ enum TabOrder : uint8_t { STRUCTURE = 0, ROW, COLUMN };
CPDFSDK_AnnotIterator(CPDFSDK_PageView* pPageView,
CPDF_Annot::Subtype nAnnotSubtype);
@@ -37,9 +37,9 @@ class CPDFSDK_AnnotIterator {
void AddSelectedToAnnots(std::vector<CPDFSDK_Annot*>* sa,
std::vector<size_t>* aSelect);
- TabOrder m_eTabOrder;
- UnownedPtr<CPDFSDK_PageView> m_pPageView;
+ UnownedPtr<CPDFSDK_PageView> const m_pPageView;
CPDF_Annot::Subtype m_nAnnotSubtype;
+ const TabOrder m_eTabOrder;
std::vector<CPDFSDK_Annot*> m_Annots;
};