From 5039da0b91a981b438cbb1c7a7325fde12e2632b Mon Sep 17 00:00:00 2001 From: Jay Berkenbilt Date: Fri, 14 Jun 2013 11:27:15 -0400 Subject: Add QPDFObjectHandle::getObjGen() This is safer than getObjectID() and getGeneration() for many uses. --- include/qpdf/QPDFObjectHandle.hh | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/qpdf/QPDFObjectHandle.hh b/include/qpdf/QPDFObjectHandle.hh index ed02d3bb..81400056 100644 --- a/include/qpdf/QPDFObjectHandle.hh +++ b/include/qpdf/QPDFObjectHandle.hh @@ -16,6 +16,7 @@ #include #include +#include #include #include #include @@ -454,7 +455,17 @@ class QPDFObjectHandle QPDFObjectHandle const& filter, QPDFObjectHandle const& decode_parms); - // return 0 for direct objects + // Access object ID and generation. For direct objects, return + // object ID 0. + + // NOTE: Be careful about calling getObjectID() and + // getGeneration() directly as this can lead to the pattern of + // depending on object ID or generation without the other. In + // general, when keeping track of object IDs, it's better to use + // QPDFObjGen instead. + + QPDF_DLL + QPDFObjGen getObjGen() const; QPDF_DLL int getObjectID() const; QPDF_DLL -- cgit v1.2.3-54-g00ecf