mirror of
https://github.com/qpdf/qpdf.git
synced 2024-12-22 10:58:58 +00:00
Performance: remove indirection through Members for QPDFObject
This commit is contained in:
parent
89f19b7099
commit
07afb668b1
@ -24,7 +24,6 @@
|
||||
|
||||
#include <qpdf/DLL.h>
|
||||
#include <qpdf/Types.h>
|
||||
#include <qpdf/PointerHolder.hh>
|
||||
#include <qpdf/JSON.hh>
|
||||
|
||||
#include <string>
|
||||
@ -100,21 +99,12 @@ class QPDFObject
|
||||
virtual void releaseResolved() {}
|
||||
|
||||
private:
|
||||
QPDFObject(QPDFObject const&);
|
||||
QPDFObject& operator=(QPDFObject const&);
|
||||
class Members
|
||||
{
|
||||
friend class QPDFObject;
|
||||
public:
|
||||
QPDF_DLL
|
||||
~Members();
|
||||
private:
|
||||
Members();
|
||||
QPDF* owning_qpdf;
|
||||
std::string object_description;
|
||||
qpdf_offset_t parsed_offset;
|
||||
};
|
||||
PointerHolder<Members> m;
|
||||
QPDFObject(QPDFObject const&) = delete;
|
||||
QPDFObject& operator=(QPDFObject const&) = delete;
|
||||
|
||||
QPDF* owning_qpdf;
|
||||
std::string object_description;
|
||||
qpdf_offset_t parsed_offset;
|
||||
};
|
||||
|
||||
#endif // QPDFOBJECT_HH
|
||||
|
@ -1,49 +1,40 @@
|
||||
#include <qpdf/QPDFObject.hh>
|
||||
|
||||
QPDFObject::Members::Members() :
|
||||
QPDFObject::QPDFObject() :
|
||||
owning_qpdf(0),
|
||||
parsed_offset(-1)
|
||||
{
|
||||
}
|
||||
|
||||
QPDFObject::Members::~Members()
|
||||
{
|
||||
}
|
||||
|
||||
QPDFObject::QPDFObject() :
|
||||
m(new Members)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
QPDFObject::setDescription(QPDF* qpdf, std::string const& description)
|
||||
{
|
||||
this->m->owning_qpdf = qpdf;
|
||||
this->m->object_description = description;
|
||||
this->owning_qpdf = qpdf;
|
||||
this->object_description = description;
|
||||
}
|
||||
|
||||
bool
|
||||
QPDFObject::getDescription(QPDF*& qpdf, std::string& description)
|
||||
{
|
||||
qpdf = this->m->owning_qpdf;
|
||||
description = this->m->object_description;
|
||||
return this->m->owning_qpdf != 0;
|
||||
qpdf = this->owning_qpdf;
|
||||
description = this->object_description;
|
||||
return this->owning_qpdf != 0;
|
||||
}
|
||||
|
||||
bool
|
||||
QPDFObject::hasDescription()
|
||||
{
|
||||
return this->m->owning_qpdf != 0;
|
||||
return this->owning_qpdf != 0;
|
||||
}
|
||||
|
||||
void
|
||||
QPDFObject::setParsedOffset(qpdf_offset_t offset)
|
||||
{
|
||||
this->m->parsed_offset = offset;
|
||||
this->parsed_offset = offset;
|
||||
}
|
||||
|
||||
qpdf_offset_t
|
||||
QPDFObject::getParsedOffset()
|
||||
{
|
||||
return this->m->parsed_offset;
|
||||
return this->parsed_offset;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user