Add ostream << for QPDFObjGen

This commit is contained in:
Jay Berkenbilt 2020-12-26 17:49:04 -05:00
parent 858c7b89bc
commit 3f9191a344
3 changed files with 15 additions and 0 deletions

View File

@ -1,3 +1,8 @@
2020-12-26 Jay Berkenbilt <ejb@ql.org>
* Add ostream << for QPDFObjGen. (Don't ask why it took 7.5 years
for me to decide to do this.)
2020-12-25 Jay Berkenbilt <ejb@ql.org>
* Refactor write code to eliminate an extra full traversal of

View File

@ -23,6 +23,7 @@
#define QPDFOBJGEN_HH
#include <qpdf/DLL.h>
#include <iostream>
// This class represents an object ID and generation pair. It is
// suitable to use as a key in a map or set.
@ -43,6 +44,9 @@ class QPDFObjGen
QPDF_DLL
int getGen() const;
QPDF_DLL
friend std::ostream& operator<<(std::ostream&, const QPDFObjGen&);
private:
// This class does not use the Members pattern to avoid a memory
// allocation for every one of these. A lot of these get created

View File

@ -36,3 +36,9 @@ QPDFObjGen::getGen() const
{
return this->gen;
}
std::ostream& operator<<(std::ostream& os, const QPDFObjGen& og)
{
os << og.obj << "," << og.gen;
return os;
}