mirror of
https://github.com/qpdf/qpdf.git
synced 2024-12-22 02:49:00 +00:00
Add QPDFObjectHandle::wrapInArray()
Wrap an object in an array if it is not already an array.
This commit is contained in:
parent
9caf005d89
commit
077d3d4512
@ -1,3 +1,11 @@
|
||||
2018-12-18 Jay Berkenbilt <ejb@ql.org>
|
||||
|
||||
* New method QPDFObjectHandle::wrapInArray returns the object
|
||||
itself if it is an array. Otherwise, it returns an array
|
||||
containing the object. This is useful for dealing with PDF data
|
||||
that is sometimes expressed as a single element and sometimes
|
||||
expressed as an array, which is a somewhat common PDF idiom.
|
||||
|
||||
2018-10-11 Jay Berkenbilt <ejb@ql.org>
|
||||
|
||||
* Files generated by autogen.sh are now committed so that it is
|
||||
|
@ -255,6 +255,12 @@ class QPDFObjectHandle
|
||||
|
||||
// Public factory methods
|
||||
|
||||
// Wrap an object in an array if it is not already an array. This
|
||||
// is a helper for cases in which something in a PDF may either be
|
||||
// a single item or an array of items, which is a common idiom.
|
||||
QPDF_DLL
|
||||
QPDFObjectHandle wrapInArray();
|
||||
|
||||
// Construct an object of any type from a string representation of
|
||||
// the object. Throws QPDFExc with an empty filename and an
|
||||
// offset into the string if there is an error. Any indirect
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user