2
1
mirror of https://github.com/qpdf/qpdf.git synced 2024-12-22 02:49:00 +00:00

Add new method Objects::all

This commit is contained in:
m-holger 2024-10-07 17:44:19 +01:00
parent 9e03dc54cc
commit 113ea4e7ae
3 changed files with 12 additions and 4 deletions

View File

@ -500,6 +500,12 @@ QPDF::getObjectCount()
return toS(og.getObj()); return toS(og.getObj());
} }
std::vector<QPDFObjectHandle>
QPDF::getAllObjects()
{
return m->objects.all();
}
void void
QPDF::setLastObjectDescription(std::string const& description, QPDFObjGen const& og) QPDF::setLastObjectDescription(std::string const& description, QPDFObjGen const& og)
{ {

View File

@ -1149,13 +1149,13 @@ Xref_table::resolve()
} }
std::vector<QPDFObjectHandle> std::vector<QPDFObjectHandle>
QPDF::getAllObjects() Objects ::all()
{ {
// After fixDanglingReferences is called, all objects are in the object cache. // After fixDanglingReferences is called, all objects are in the object cache.
fixDanglingReferences(); qpdf.fixDanglingReferences();
std::vector<QPDFObjectHandle> result; std::vector<QPDFObjectHandle> result;
for (auto const& iter: m->objects.obj_cache) { for (auto const& iter: obj_cache) {
result.push_back(newIndirect(iter.first, iter.second.object)); result.emplace_back(iter.second.object);
} }
return result; return result;
} }

View File

@ -441,6 +441,8 @@ class QPDF::Objects
return get(QPDFObjGen(id, gen)); return get(QPDFObjGen(id, gen));
} }
std::vector<QPDFObjectHandle> all();
void erase(QPDFObjGen og); void erase(QPDFObjGen og);
void replace(QPDFObjGen og, QPDFObjectHandle oh); void replace(QPDFObjGen og, QPDFObjectHandle oh);