aboutsummaryrefslogtreecommitdiffstats
path: root/libqpdf/QPDF_Array.cc
diff options
context:
space:
mode:
authorJay Berkenbilt <ejb@ql.org>2008-04-29 14:55:25 +0200
committerJay Berkenbilt <ejb@ql.org>2008-04-29 14:55:25 +0200
commit9a0b88bf7777c153dc46ace22db74ef24d51583a (patch)
treef567ac1cf2bf5071a611eb49323a935b6ac938ff /libqpdf/QPDF_Array.cc
downloadqpdf-9a0b88bf7777c153dc46ace22db74ef24d51583a.tar.zst
update release date to actual daterelease-qpdf-2.0
git-svn-id: svn+q:///qpdf/trunk@599 71b93d88-0707-0410-a8cf-f5a4172ac649
Diffstat (limited to 'libqpdf/QPDF_Array.cc')
-rw-r--r--libqpdf/QPDF_Array.cc51
1 files changed, 51 insertions, 0 deletions
diff --git a/libqpdf/QPDF_Array.cc b/libqpdf/QPDF_Array.cc
new file mode 100644
index 00000000..d1edbfdd
--- /dev/null
+++ b/libqpdf/QPDF_Array.cc
@@ -0,0 +1,51 @@
+
+#include <qpdf/QPDF_Array.hh>
+
+#include <qpdf/QEXC.hh>
+
+QPDF_Array::QPDF_Array(std::vector<QPDFObjectHandle> const& items) :
+ items(items)
+{
+}
+
+QPDF_Array::~QPDF_Array()
+{
+}
+
+std::string
+QPDF_Array::unparse()
+{
+ std::string result = "[ ";
+ for (std::vector<QPDFObjectHandle>::iterator iter = this->items.begin();
+ iter != this->items.end(); ++iter)
+ {
+ result += (*iter).unparse();
+ result += " ";
+ }
+ result += "]";
+ return result;
+}
+
+int
+QPDF_Array::getNItems() const
+{
+ return this->items.size();
+}
+
+QPDFObjectHandle
+QPDF_Array::getItem(int n) const
+{
+ if ((n < 0) || (n >= (int)this->items.size()))
+ {
+ throw QEXC::Internal("bounds array accessing QPDF_Array element");
+ }
+ return this->items[n];
+}
+
+void
+QPDF_Array::setItem(int n, QPDFObjectHandle const& oh)
+{
+ // Call getItem for bounds checking
+ (void) getItem(n);
+ this->items[n] = oh;
+}