mirror of
https://github.com/qpdf/qpdf.git
synced 2024-12-22 19:08:59 +00:00
Remove temporary OHArray::disconnect and setAt
This commit is contained in:
parent
1367226002
commit
0db65e7912
@ -1494,14 +1494,14 @@ class QPDFObjectHandle
|
||||
// disconnected().
|
||||
class DisconnectAccess
|
||||
{
|
||||
friend class QPDF_Array;
|
||||
friend class QPDF_Dictionary;
|
||||
friend class QPDF_Stream;
|
||||
friend class SparseOHArray;
|
||||
friend class OHArray;
|
||||
|
||||
private:
|
||||
static void
|
||||
disconnect(QPDFObjectHandle& o)
|
||||
disconnect(QPDFObjectHandle o)
|
||||
{
|
||||
o.disconnect();
|
||||
}
|
||||
|
@ -11,26 +11,6 @@ OHArray::OHArray()
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
OHArray::disconnect()
|
||||
{
|
||||
for (auto const& iter: elements) {
|
||||
if (iter) {
|
||||
QPDFObjectHandle oh = iter;
|
||||
QPDFObjectHandle::DisconnectAccess::disconnect(oh);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
OHArray::setAt(size_t idx, QPDFObjectHandle oh)
|
||||
{
|
||||
if (idx >= elements.size()) {
|
||||
throw std::logic_error("bounds error setting item in OHArray");
|
||||
}
|
||||
elements[idx] = oh.getObj();
|
||||
}
|
||||
|
||||
void
|
||||
OHArray::erase(size_t idx)
|
||||
{
|
||||
|
@ -77,7 +77,11 @@ QPDF_Array::disconnect()
|
||||
if (sparse) {
|
||||
sp_elements.disconnect();
|
||||
} else {
|
||||
elements.disconnect();
|
||||
for (auto const& iter: elements.elements) {
|
||||
if (iter) {
|
||||
QPDFObjectHandle::DisconnectAccess::disconnect(iter);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -176,7 +180,11 @@ QPDF_Array::setItem(int n, QPDFObjectHandle const& oh)
|
||||
if (sparse) {
|
||||
sp_elements.setAt(QIntC::to_size(n), oh);
|
||||
} else {
|
||||
elements.setAt(QIntC::to_size(n), oh);
|
||||
size_t idx = size_t(n);
|
||||
if (n < 0 || idx >= elements.elements.size()) {
|
||||
throw std::logic_error("bounds error setting item in QPDF_Array");
|
||||
}
|
||||
elements.elements[idx] = oh.getObj();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -12,11 +12,9 @@ class OHArray
|
||||
{
|
||||
public:
|
||||
OHArray();
|
||||
void setAt(size_t idx, QPDFObjectHandle oh);
|
||||
void erase(size_t idx);
|
||||
void insert(size_t idx, QPDFObjectHandle oh);
|
||||
OHArray copy();
|
||||
void disconnect();
|
||||
|
||||
private:
|
||||
friend class QPDF_Array;
|
||||
|
Loading…
Reference in New Issue
Block a user