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

Add method QPDFObject::getObjGen and remove QPDFObjectHandle::og

This commit is contained in:
m-holger 2022-08-14 11:32:20 +01:00
parent 5033e3b215
commit 1bb40238e0
3 changed files with 9 additions and 7 deletions

View File

@ -103,6 +103,12 @@ class QPDFObject
{
return value->qpdf;
}
QPDFObjGen
getObjGen() const
{
return value->og;
}
void
setDescription(QPDF* qpdf, std::string const& description)
{

View File

@ -1584,7 +1584,6 @@ class QPDFObjectHandle
QPDF* qpdf,
QPDFObjGen const& og,
std::shared_ptr<QPDFObject> const& obj) :
og(og),
obj(obj)
{
}
@ -1640,7 +1639,6 @@ class QPDFObjectHandle
// Moving members of QPDFObjectHandle into a smart pointer incurs
// a substantial performance penalty since QPDFObjectHandle
// objects are copied around so frequently.
QPDFObjGen og;
std::shared_ptr<QPDFObject> obj;
};
@ -1864,19 +1862,19 @@ class QPDFObjectHandle::QPDFArrayItems
inline QPDFObjGen
QPDFObjectHandle::getObjGen() const
{
return og;
return isInitialized() ? obj->getObjGen() : QPDFObjGen();
}
inline int
QPDFObjectHandle::getObjectID() const
{
return og.getObj();
return getObjGen().getObj();
}
inline int
QPDFObjectHandle::getGeneration() const
{
return og.getGen();
return getObjGen().getGen();
}
inline bool

View File

@ -2282,8 +2282,6 @@ QPDFObjectHandle::copyObject(
" reserved object handle direct");
}
og = QPDFObjGen();
std::shared_ptr<QPDFObject> new_obj;
if (isBool() || isInteger() || isName() || isNull() || isReal() ||