mirror of
https://github.com/qpdf/qpdf.git
synced 2024-12-22 02:49:00 +00:00
Add QPDFObjectHandle::getObjGen()
This is safer than getObjectID() and getGeneration() for many uses.
This commit is contained in:
parent
d88231e01e
commit
5039da0b91
@ -1,5 +1,9 @@
|
||||
2013-06-14 Jay Berkenbilt <ejb@ql.org>
|
||||
|
||||
* Add new QPDFObjectHandle::getObjGen() method and indiciate in
|
||||
comments that its use is favored over getObjectID() and
|
||||
getGeneration() for most cases.
|
||||
|
||||
* Add new QPDFObjGen object to represent an object ID/generation
|
||||
pair.
|
||||
|
||||
|
@ -16,6 +16,7 @@
|
||||
#include <set>
|
||||
#include <map>
|
||||
|
||||
#include <qpdf/QPDFObjGen.hh>
|
||||
#include <qpdf/PointerHolder.hh>
|
||||
#include <qpdf/Buffer.hh>
|
||||
#include <qpdf/InputSource.hh>
|
||||
@ -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
|
||||
|
@ -535,6 +535,12 @@ QPDFObjectHandle::replaceStreamData(PointerHolder<StreamDataProvider> provider,
|
||||
provider, filter, decode_parms);
|
||||
}
|
||||
|
||||
QPDFObjGen
|
||||
QPDFObjectHandle::getObjGen() const
|
||||
{
|
||||
return QPDFObjGen(this->objid, this->generation);
|
||||
}
|
||||
|
||||
int
|
||||
QPDFObjectHandle::getObjectID() const
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user