summaryrefslogtreecommitdiff
path: root/core/fpdfapi/fpdf_parser/include
diff options
context:
space:
mode:
authorweili <weili@chromium.org>2016-04-13 14:40:10 -0700
committerCommit bot <commit-bot@chromium.org>2016-04-13 14:40:10 -0700
commitcdce75706de7e76e73550a0582e1fd28af324fd0 (patch)
tree815b06c03cf13473de19f478589b59bf19696fb2 /core/fpdfapi/fpdf_parser/include
parent9cec54ab0a5461b3075c585f8f233dbfd06c2cbd (diff)
downloadpdfium-cdce75706de7e76e73550a0582e1fd28af324fd0.tar.xz
Add iterators and unit tests for CPDF_Array class
Add iterators to enable range based for loop. Also add unit tests for recent modified functions. Review URL: https://codereview.chromium.org/1878803002
Diffstat (limited to 'core/fpdfapi/fpdf_parser/include')
-rw-r--r--core/fpdfapi/fpdf_parser/include/cpdf_array.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/core/fpdfapi/fpdf_parser/include/cpdf_array.h b/core/fpdfapi/fpdf_parser/include/cpdf_array.h
index ac3bf41b45..dfe03b9d70 100644
--- a/core/fpdfapi/fpdf_parser/include/cpdf_array.h
+++ b/core/fpdfapi/fpdf_parser/include/cpdf_array.h
@@ -16,6 +16,9 @@
class CPDF_Array : public CPDF_Object {
public:
+ using iterator = std::vector<CPDF_Object*>::iterator;
+ using const_iterator = std::vector<CPDF_Object*>::const_iterator;
+
CPDF_Array();
// CPDF_Object.
@@ -57,6 +60,11 @@ class CPDF_Array : public CPDF_Object {
AddReference(pDoc, obj->GetObjNum());
}
+ iterator begin() { return m_Objects.begin(); }
+ iterator end() { return m_Objects.end(); }
+ const_iterator begin() const { return m_Objects.begin(); }
+ const_iterator end() const { return m_Objects.end(); }
+
protected:
~CPDF_Array() override;