From 077d3d451204393d17b9a14c2145487c35fce572 Mon Sep 17 00:00:00 2001 From: Jay Berkenbilt Date: Mon, 17 Dec 2018 17:36:06 -0500 Subject: Add QPDFObjectHandle::wrapInArray() Wrap an object in an array if it is not already an array. --- libqpdf/QPDFObjectHandle.cc | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'libqpdf') diff --git a/libqpdf/QPDFObjectHandle.cc b/libqpdf/QPDFObjectHandle.cc index f4a8a0a4..f26ee931 100644 --- a/libqpdf/QPDFObjectHandle.cc +++ b/libqpdf/QPDFObjectHandle.cc @@ -1235,6 +1235,18 @@ QPDFObjectHandle::unparseBinary() } } +QPDFObjectHandle +QPDFObjectHandle::wrapInArray() +{ + if (isArray()) + { + return *this; + } + QPDFObjectHandle result = QPDFObjectHandle::newArray(); + result.appendItem(*this); + return result; +} + QPDFObjectHandle QPDFObjectHandle::parse(std::string const& object_str, std::string const& object_description) -- cgit v1.2.3-54-g00ecf