mirror of
https://github.com/qpdf/qpdf.git
synced 2024-11-01 03:12:29 +00:00
9496b2cb20
git-svn-id: svn+q:///qpdf/trunk@976 71b93d88-0707-0410-a8cf-f5a4172ac649
61 lines
1.1 KiB
C++
61 lines
1.1 KiB
C++
#include <qpdf/QPDF_Array.hh>
|
|
#include <stdexcept>
|
|
|
|
QPDF_Array::QPDF_Array(std::vector<QPDFObjectHandle> const& items) :
|
|
items(items)
|
|
{
|
|
}
|
|
|
|
QPDF_Array::~QPDF_Array()
|
|
{
|
|
}
|
|
|
|
void
|
|
QPDF_Array::releaseResolved()
|
|
{
|
|
for (std::vector<QPDFObjectHandle>::iterator iter = this->items.begin();
|
|
iter != this->items.end(); ++iter)
|
|
{
|
|
QPDFObjectHandle::ReleaseResolver::releaseResolved(*iter);
|
|
}
|
|
}
|
|
|
|
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 std::logic_error(
|
|
"INTERNAL ERROR: 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;
|
|
}
|