mirror of
https://github.com/qpdf/qpdf.git
synced 2024-11-11 23:45:47 +00:00
Remove QPDFObjectHandle::initialized
This commit is contained in:
parent
c7005e8a6d
commit
23d50a2f14
@ -1584,7 +1584,6 @@ class QPDFObjectHandle
|
|||||||
QPDF* qpdf,
|
QPDF* qpdf,
|
||||||
QPDFObjGen const& og,
|
QPDFObjGen const& og,
|
||||||
std::shared_ptr<QPDFObject> const& obj) :
|
std::shared_ptr<QPDFObject> const& obj) :
|
||||||
initialized(true),
|
|
||||||
qpdf(qpdf),
|
qpdf(qpdf),
|
||||||
og(og),
|
og(og),
|
||||||
obj(obj)
|
obj(obj)
|
||||||
@ -1640,8 +1639,6 @@ class QPDFObjectHandle
|
|||||||
static void warn(QPDF*, QPDFExc const&);
|
static void warn(QPDF*, QPDFExc const&);
|
||||||
void checkOwnership(QPDFObjectHandle const&) const;
|
void checkOwnership(QPDFObjectHandle const&) const;
|
||||||
|
|
||||||
bool initialized;
|
|
||||||
|
|
||||||
// Moving members of QPDFObjectHandle into a smart pointer incurs
|
// Moving members of QPDFObjectHandle into a smart pointer incurs
|
||||||
// a substantial performance penalty since QPDFObjectHandle
|
// a substantial performance penalty since QPDFObjectHandle
|
||||||
// objects are copied around so frequently.
|
// objects are copied around so frequently.
|
||||||
@ -1888,13 +1885,13 @@ QPDFObjectHandle::getGeneration() const
|
|||||||
inline bool
|
inline bool
|
||||||
QPDFObjectHandle::isIndirect() const
|
QPDFObjectHandle::isIndirect() const
|
||||||
{
|
{
|
||||||
return initialized && (getObjectID() != 0);
|
return (obj != nullptr) && (getObjectID() != 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool
|
inline bool
|
||||||
QPDFObjectHandle::isInitialized() const
|
QPDFObjectHandle::isInitialized() const
|
||||||
{
|
{
|
||||||
return initialized;
|
return obj != nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Indirect object accessors
|
// Indirect object accessors
|
||||||
@ -1915,7 +1912,7 @@ QPDFObjectHandle::setParsedOffset(qpdf_offset_t offset)
|
|||||||
{
|
{
|
||||||
// This is called during parsing on newly created direct objects,
|
// This is called during parsing on newly created direct objects,
|
||||||
// so we can't call dereference() here.
|
// so we can't call dereference() here.
|
||||||
if (initialized) {
|
if (isInitialized()) {
|
||||||
this->obj->setParsedOffset(offset);
|
this->obj->setParsedOffset(offset);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -236,13 +236,11 @@ LastChar::getLastChar()
|
|||||||
}
|
}
|
||||||
|
|
||||||
QPDFObjectHandle::QPDFObjectHandle() :
|
QPDFObjectHandle::QPDFObjectHandle() :
|
||||||
initialized(false),
|
|
||||||
qpdf(nullptr)
|
qpdf(nullptr)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
QPDFObjectHandle::QPDFObjectHandle(std::shared_ptr<QPDFObject> const& data) :
|
QPDFObjectHandle::QPDFObjectHandle(std::shared_ptr<QPDFObject> const& data) :
|
||||||
initialized(true),
|
|
||||||
qpdf(nullptr),
|
qpdf(nullptr),
|
||||||
obj(data)
|
obj(data)
|
||||||
{
|
{
|
||||||
@ -369,7 +367,7 @@ QPDFObjectHandle::isDirectNull() const
|
|||||||
// Don't call dereference() -- this is a const method, and we know
|
// Don't call dereference() -- this is a const method, and we know
|
||||||
// objid == 0, so there's nothing to resolve.
|
// objid == 0, so there's nothing to resolve.
|
||||||
return (
|
return (
|
||||||
initialized && (getObjectID() == 0) &&
|
isInitialized() && (getObjectID() == 0) &&
|
||||||
(obj->getTypeCode() == QPDFObject::ot_null));
|
(obj->getTypeCode() == QPDFObject::ot_null));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2373,7 +2371,7 @@ QPDFObjectHandle::makeDirect(bool allow_streams)
|
|||||||
void
|
void
|
||||||
QPDFObjectHandle::assertInitialized() const
|
QPDFObjectHandle::assertInitialized() const
|
||||||
{
|
{
|
||||||
if (!initialized) {
|
if (!isInitialized()) {
|
||||||
throw std::logic_error("operation attempted on uninitialized "
|
throw std::logic_error("operation attempted on uninitialized "
|
||||||
"QPDFObjectHandle");
|
"QPDFObjectHandle");
|
||||||
}
|
}
|
||||||
@ -2608,7 +2606,7 @@ QPDFObjectHandle::assertPageObject()
|
|||||||
bool
|
bool
|
||||||
QPDFObjectHandle::dereference()
|
QPDFObjectHandle::dereference()
|
||||||
{
|
{
|
||||||
if (!this->initialized) {
|
if (!isInitialized()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (this->obj->getTypeCode() == QPDFObject::ot_unresolved) {
|
if (this->obj->getTypeCode() == QPDFObject::ot_unresolved) {
|
||||||
|
Loading…
Reference in New Issue
Block a user