From 7dc197ef88a3f19a830f38d19aba649175d53c5e Mon Sep 17 00:00:00 2001 From: Jay Berkenbilt Date: Wed, 10 Aug 2011 12:42:48 -0400 Subject: implement replace and swap --- include/qpdf/QPDF.hh | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'include') diff --git a/include/qpdf/QPDF.hh b/include/qpdf/QPDF.hh index 1ef353e7..dc2b4c22 100644 --- a/include/qpdf/QPDF.hh +++ b/include/qpdf/QPDF.hh @@ -128,6 +128,36 @@ class QPDF QPDF_DLL QPDFObjectHandle getObjectByID(int objid, int generation); + // Replace the object with the given object id with the given + // object. The object handle passed in must be a direct object, + // though it may contain references to other indirect objects + // within it. Calling this method can have somewhat confusing + // results. Any existing QPDFObjectHandle instances that point to + // the old object and that have been resolved (which happens + // automatically if you access them in any way) will continue to + // point to the old object even though that object will no longer + // be associated with the PDF file. Note that replacing an object + // with QPDFObjectHandle::newNull() effectively removes the object + // from the file since a non-existent object is treated as a null + // object. + QPDF_DLL + void replaceObject(int objid, int generation, QPDFObjectHandle); + + // Swap two objects given by ID. Calling this method can have + // confusing results. After swapping two objects, existing + // QPDFObjectHandle instances that reference them will still + // reference the same underlying objects, at which point those + // existing QPDFObjectHandle instances will have incorrect + // information about the object and generation number of those + // objects. While this does not necessarily cause a problem, it + // can certainly be confusing. It is therefore recommended that + // you replace any existing QPDFObjectHandle instances that point + // to the swapped objects with new ones, possibly by calling + // getObjectByID. + QPDF_DLL + void swapObjects(int objid1, int generation1, + int objid2, int generation2); + // Encryption support enum encryption_method_e { e_none, e_unknown, e_rc4, e_aes }; -- cgit v1.2.3-54-g00ecf