mirror of
https://github.com/qpdf/qpdf.git
synced 2025-01-31 02:48:31 +00:00
Add private method QPDF::nextObjGen
This commit is contained in:
parent
b3d71e1f58
commit
0a3c533186
@ -1185,6 +1185,7 @@ class QPDF
|
||||
void stopOnError(std::string const& message);
|
||||
QPDFObjectHandle reserveObjectIfNotExists(QPDFObjGen const& og);
|
||||
QPDFObjectHandle reserveStream(QPDFObjGen const& og);
|
||||
QPDFObjGen nextObjGen();
|
||||
QPDFObjectHandle
|
||||
newIndirect(QPDFObjGen const&, std::shared_ptr<QPDFObject> const&);
|
||||
QPDFObjectHandle makeIndirectObject(std::shared_ptr<QPDFObject> const& obj);
|
||||
|
@ -1976,15 +1976,21 @@ QPDF::isUnresolved(QPDFObjGen const& og)
|
||||
return !isCached(og) || m->obj_cache[og].object->isUnresolved();
|
||||
}
|
||||
|
||||
QPDFObjectHandle
|
||||
QPDF::makeIndirectObject(std::shared_ptr<QPDFObject> const& obj)
|
||||
QPDFObjGen
|
||||
QPDF::nextObjGen()
|
||||
{
|
||||
int max_objid = toI(getObjectCount());
|
||||
if (max_objid == std::numeric_limits<int>::max()) {
|
||||
throw std::range_error(
|
||||
"max object id is too high to create new objects");
|
||||
}
|
||||
QPDFObjGen next(max_objid + 1, 0);
|
||||
return QPDFObjGen(max_objid + 1, 0);
|
||||
}
|
||||
|
||||
QPDFObjectHandle
|
||||
QPDF::makeIndirectObject(std::shared_ptr<QPDFObject> const& obj)
|
||||
{
|
||||
QPDFObjGen next{nextObjGen()};
|
||||
m->obj_cache[next] = ObjCache(obj, -1, -1);
|
||||
return newIndirect(next, m->obj_cache[next].object);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user