From a76decd2d59f8d23791013d822e65b4363d450cd Mon Sep 17 00:00:00 2001 From: Jay Berkenbilt Date: Sun, 21 Feb 2021 16:09:16 -0500 Subject: [PATCH] Add QPDFObjGen::unparse --- ChangeLog | 2 ++ include/qpdf/QPDFObjGen.hh | 2 ++ libqpdf/QPDFObjGen.cc | 8 ++++++++ 3 files changed, 12 insertions(+) diff --git a/ChangeLog b/ChangeLog index 2adee2ba..46ae6706 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,7 @@ 2021-02-21 Jay Berkenbilt + * Add QPDFObjGen::unparse() + * Add QPDFObjectHandle::copyStream() for making a copy of a stream within the same QPDF instance. diff --git a/include/qpdf/QPDFObjGen.hh b/include/qpdf/QPDFObjGen.hh index 892887b1..b3b46a97 100644 --- a/include/qpdf/QPDFObjGen.hh +++ b/include/qpdf/QPDFObjGen.hh @@ -43,6 +43,8 @@ class QPDFObjGen int getObj() const; QPDF_DLL int getGen() const; + QPDF_DLL + std::string unparse() const; QPDF_DLL friend std::ostream& operator<<(std::ostream&, const QPDFObjGen&); diff --git a/libqpdf/QPDFObjGen.cc b/libqpdf/QPDFObjGen.cc index a887720e..6f956239 100644 --- a/libqpdf/QPDFObjGen.cc +++ b/libqpdf/QPDFObjGen.cc @@ -1,4 +1,5 @@ #include +#include QPDFObjGen::QPDFObjGen() : obj(0), @@ -42,3 +43,10 @@ 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); +}