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

Inline QPDFObjGen methods

ABI breaking change
This commit is contained in:
m-holger 2022-07-06 20:27:39 +01:00 committed by Jay Berkenbilt
parent a603c1e395
commit 4c6640cb45
3 changed files with 36 additions and 65 deletions

View File

@ -23,6 +23,7 @@
#define QPDFOBJGEN_HH
#include <qpdf/DLL.h>
#include <qpdf/QUtil.hh>
#include <iostream>
// This class represents an object ID and generation pair. It is
@ -32,22 +33,48 @@ class QPDFObjGen
{
public:
QPDF_DLL
QPDFObjGen();
QPDFObjGen() :
obj(0),
gen(0)
{
}
QPDF_DLL
QPDFObjGen(int obj, int gen);
QPDFObjGen(int obj, int gen) :
obj(obj),
gen(gen)
{
}
QPDF_DLL
bool operator<(QPDFObjGen const&) const;
bool operator<(QPDFObjGen const& rhs) const
{
return ((obj < rhs.obj) || ((obj == rhs.obj) && (gen < rhs.gen)));
}
QPDF_DLL
bool operator==(QPDFObjGen const&) const;
bool operator==(QPDFObjGen const& rhs) const
{
return ((obj == rhs.obj) && (gen == rhs.gen));
}
QPDF_DLL
int getObj() const;
int getObj() const
{
return obj;
}
QPDF_DLL
int getGen() const;
int getGen() const
{
return gen;
}
QPDF_DLL
std::string unparse() const;
std::string unparse() const
{
return QUtil::int_to_string(obj) + "," + QUtil::int_to_string(gen);
}
QPDF_DLL
friend std::ostream& operator<<(std::ostream&, const QPDFObjGen&);
friend std::ostream& operator<<(std::ostream& os, const QPDFObjGen& og)
{
os << og.obj << "," << og.gen;
return os;
}
private:
// This class does not use the Members pattern to avoid a memory

View File

@ -72,7 +72,6 @@ set(libqpdf_SOURCES
QPDFMatrix.cc
QPDFNameTreeObjectHelper.cc
QPDFNumberTreeObjectHelper.cc
QPDFObjGen.cc
QPDFObject.cc
QPDFObjectHandle.cc
QPDFOutlineDocumentHelper.cc

View File

@ -1,55 +0,0 @@
#include <qpdf/QPDFObjGen.hh>
#include <qpdf/QUtil.hh>
QPDFObjGen::QPDFObjGen() :
obj(0),
gen(0)
{
}
QPDFObjGen::QPDFObjGen(int o, int g) :
obj(o),
gen(g)
{
}
bool
QPDFObjGen::operator<(QPDFObjGen const& rhs) const
{
return (
(this->obj < rhs.obj) ||
((this->obj == rhs.obj) && (this->gen < rhs.gen)));
}
bool
QPDFObjGen::operator==(QPDFObjGen const& rhs) const
{
return ((this->obj == rhs.obj) && (this->gen == rhs.gen));
}
int
QPDFObjGen::getObj() const
{
return this->obj;
}
int
QPDFObjGen::getGen() const
{
return this->gen;
}
std::ostream&
operator<<(std::ostream& os, const QPDFObjGen& og)
{
os << og.obj << "," << og.gen;
return os;
}
std::string
QPDFObjGen::unparse() const
{
return QUtil::int_to_string(this->obj) + "," +
QUtil::int_to_string(this->gen);
}