2
1
mirror of https://github.com/qpdf/qpdf.git synced 2024-12-22 19:08:59 +00:00

Performance: remove indirection through Members for QPDFObject

This commit is contained in:
Jay Berkenbilt 2020-04-02 18:52:31 -04:00
parent 89f19b7099
commit 07afb668b1
2 changed files with 15 additions and 34 deletions

View File

@ -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

View File

@ -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;
}