diff --git a/libqpdf/QPDF.cc b/libqpdf/QPDF.cc index beab50ee..e5bde7ea 100644 --- a/libqpdf/QPDF.cc +++ b/libqpdf/QPDF.cc @@ -500,6 +500,12 @@ QPDF::getObjectCount() return toS(og.getObj()); } +std::vector +QPDF::getAllObjects() +{ + return m->objects.all(); +} + void QPDF::setLastObjectDescription(std::string const& description, QPDFObjGen const& og) { diff --git a/libqpdf/QPDF_objects.cc b/libqpdf/QPDF_objects.cc index 6857b2eb..69c444b0 100644 --- a/libqpdf/QPDF_objects.cc +++ b/libqpdf/QPDF_objects.cc @@ -1149,13 +1149,13 @@ Xref_table::resolve() } std::vector -QPDF::getAllObjects() +Objects ::all() { // After fixDanglingReferences is called, all objects are in the object cache. - fixDanglingReferences(); + qpdf.fixDanglingReferences(); std::vector result; - for (auto const& iter: m->objects.obj_cache) { - result.push_back(newIndirect(iter.first, iter.second.object)); + for (auto const& iter: obj_cache) { + result.emplace_back(iter.second.object); } return result; } diff --git a/libqpdf/qpdf/QPDF_objects.hh b/libqpdf/qpdf/QPDF_objects.hh index 43e3048a..ff483a98 100644 --- a/libqpdf/qpdf/QPDF_objects.hh +++ b/libqpdf/qpdf/QPDF_objects.hh @@ -441,6 +441,8 @@ class QPDF::Objects return get(QPDFObjGen(id, gen)); } + std::vector all(); + void erase(QPDFObjGen og); void replace(QPDFObjGen og, QPDFObjectHandle oh);