diff options
author | Jay Berkenbilt <jberkenbilt@users.noreply.github.com> | 2023-05-20 21:27:33 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-05-20 21:27:33 +0200 |
commit | 1c14a9e6c49e43aa95f564a89c4456f14c450546 (patch) | |
tree | 215d1c7bc5fcfd8e7bced3ebefeb246e2b2e2fd5 /include | |
parent | 77cc965993f91b6c296d435e22859e3df27624fd (diff) | |
parent | 05a49cecf1b1caa12575fa34fa478560ba25e31b (diff) | |
download | qpdf-1c14a9e6c49e43aa95f564a89c4456f14c450546.tar.zst |
Merge pull request #959 from m-holger/reserved
Add new method QPDF::newReserved()
Diffstat (limited to 'include')
-rw-r--r-- | include/qpdf/QPDF.hh | 18 | ||||
-rw-r--r-- | include/qpdf/QPDFObjectHandle.hh | 3 |
2 files changed, 20 insertions, 1 deletions
diff --git a/include/qpdf/QPDF.hh b/include/qpdf/QPDF.hh index e43bf4c5..905c4b05 100644 --- a/include/qpdf/QPDF.hh +++ b/include/qpdf/QPDF.hh @@ -413,6 +413,24 @@ class QPDF QPDF_DLL QPDFObjectHandle newStream(std::string const& data); + // A reserved object is a special sentinel used for qpdf to + // reserve a spot for an object that is going to be added to the + // QPDF object. Normally you don't have to use this type since + // you can just call QPDF::makeIndirectObject. However, in some + // cases, if you have to create objects with circular references, + // you may need to create a reserved object so that you can have a + // reference to it and then replace the object later. Reserved + // objects have the special property that they can't be resolved + // to direct objects. This makes it possible to replace a + // reserved object with a new object while preserving existing + // references to them. When you are ready to replace a reserved + // object with its replacement, use QPDF::replaceReserved for this + // purpose rather than the more general QPDF::replaceObject. It + // is an error to try to write a QPDF with QPDFWriter if it has + // any reserved objects in it. + QPDF_DLL + QPDFObjectHandle newReserved(); + // Install this object handle as an indirect object and return an // indirect reference to it. QPDF_DLL diff --git a/include/qpdf/QPDFObjectHandle.hh b/include/qpdf/QPDFObjectHandle.hh index eaab6dc6..aeca4bf6 100644 --- a/include/qpdf/QPDFObjectHandle.hh +++ b/include/qpdf/QPDFObjectHandle.hh @@ -668,7 +668,8 @@ class QPDFObjectHandle // object with its replacement, use QPDF::replaceReserved for this // purpose rather than the more general QPDF::replaceObject. It // is an error to try to write a QPDF with QPDFWriter if it has - // any reserved objects in it. + // any reserved objects in it. From QPDF 11.4, you can + // call QPDF::newReserved() instead. QPDF_DLL static QPDFObjectHandle newReserved(QPDF* qpdf); |