aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJay Berkenbilt <ejb@ql.org>2021-02-21 22:09:16 +0100
committerJay Berkenbilt <ejb@ql.org>2021-02-21 22:21:52 +0100
commita76decd2d59f8d23791013d822e65b4363d450cd (patch)
treede50a641a3829ca749ec16e2dfb6e21579d99df6
parent7540d2082a97637f334ee882e57afc986ef87116 (diff)
downloadqpdf-a76decd2d59f8d23791013d822e65b4363d450cd.tar.zst
Add QPDFObjGen::unparse
-rw-r--r--ChangeLog2
-rw-r--r--include/qpdf/QPDFObjGen.hh2
-rw-r--r--libqpdf/QPDFObjGen.cc8
3 files changed, 12 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 2adee2ba..46ae6706 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,7 @@
2021-02-21 Jay Berkenbilt <ejb@ql.org>
+ * 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 <qpdf/QPDFObjGen.hh>
+#include <qpdf/QUtil.hh>
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);
+}