2
1
mirror of https://github.com/qpdf/qpdf.git synced 2024-10-31 19:02:30 +00:00

Add method QPDFObject::resolve

This commit is contained in:
m-holger 2022-08-14 10:50:30 +01:00
parent 56e9bcabe9
commit 4a8515912c
4 changed files with 21 additions and 5 deletions

View File

@ -843,7 +843,7 @@ class QPDF
// it can resolve indirect references.
class Resolver
{
friend class QPDFObjectHandle;
friend class QPDFObject;
private:
static void

View File

@ -153,10 +153,19 @@ class QPDFObject
}
bool
isUnresolved()
isUnresolved() const
{
return value->type_code == ::ot_unresolved;
}
void
resolve()
{
if (isUnresolved()) {
doResolve();
}
}
void doResolve();
template <typename T>
T*
as()

View File

@ -1 +1,10 @@
#include <qpdf/QPDFObject.hh>
#include <qpdf/QPDF.hh>
void
QPDFObject::doResolve()
{
auto og = value->og;
QPDF::Resolver::resolve(value->qpdf, og);
}

View File

@ -2595,9 +2595,7 @@ QPDFObjectHandle::dereference()
if (!isInitialized()) {
return false;
}
if (this->obj->isUnresolved()) {
QPDF::Resolver::resolve(this->qpdf, getObjGen());
}
this->obj->resolve();
return true;
}