aboutsummaryrefslogtreecommitdiffstats
path: root/libqpdf/QPDF_Array.cc
diff options
context:
space:
mode:
authorm-holger <m-holger@kubitscheck.org>2022-12-19 12:41:09 +0100
committerJay Berkenbilt <jberkenbilt@users.noreply.github.com>2022-12-31 20:37:35 +0100
commit9da50ca3601ee58c2ccceaa5d430b56a1ab27306 (patch)
tree7518877907dfd1c2e43cad161b04b6fcdac272b5 /libqpdf/QPDF_Array.cc
parente91e642cf35a704866f1dabd89d9a987a309bcc2 (diff)
downloadqpdf-9da50ca3601ee58c2ccceaa5d430b56a1ab27306.tar.zst
Change olist variable in QPDFParser::parse to vector<shared_ptr<QPDFObject>>
Diffstat (limited to 'libqpdf/QPDF_Array.cc')
-rw-r--r--libqpdf/QPDF_Array.cc22
1 files changed, 22 insertions, 0 deletions
diff --git a/libqpdf/QPDF_Array.cc b/libqpdf/QPDF_Array.cc
index 6e8db5e9..12e4b3e9 100644
--- a/libqpdf/QPDF_Array.cc
+++ b/libqpdf/QPDF_Array.cc
@@ -1,6 +1,7 @@
#include <qpdf/QPDF_Array.hh>
#include <qpdf/QIntC.hh>
+#include <qpdf/QPDFObject_private.hh>
#include <qpdf/QUtil.hh>
#include <stdexcept>
@@ -10,6 +11,12 @@ QPDF_Array::QPDF_Array(std::vector<QPDFObjectHandle> const& v) :
setFromVector(v);
}
+QPDF_Array::QPDF_Array(std::vector<std::shared_ptr<QPDFObject>>&& v) :
+ QPDFValue(::ot_array, "array")
+{
+ setFromVector(std::move(v));
+}
+
QPDF_Array::QPDF_Array(SparseOHArray const& items) :
QPDFValue(::ot_array, "array"),
elements(items)
@@ -23,6 +30,12 @@ QPDF_Array::create(std::vector<QPDFObjectHandle> const& items)
}
std::shared_ptr<QPDFObject>
+QPDF_Array::create(std::vector<std::shared_ptr<QPDFObject>>&& items)
+{
+ return do_create(new QPDF_Array(std::move(items)));
+}
+
+std::shared_ptr<QPDFObject>
QPDF_Array::create(SparseOHArray const& items)
{
return do_create(new QPDF_Array(items));
@@ -107,6 +120,15 @@ QPDF_Array::setFromVector(std::vector<QPDFObjectHandle> const& v)
}
void
+QPDF_Array::setFromVector(std::vector<std::shared_ptr<QPDFObject>>&& v)
+{
+ this->elements = SparseOHArray();
+ for (auto&& iter: v) {
+ this->elements.append(iter);
+ }
+}
+
+void
QPDF_Array::insertItem(int at, QPDFObjectHandle const& item)
{
// As special case, also allow insert beyond the end