From c810f0f21edf7416c6e7944d6b1619e308c764c3 Mon Sep 17 00:00:00 2001 From: Jay Berkenbilt Date: Sat, 25 Jun 2022 14:50:45 -0400 Subject: TODO: QPDFObject parent idea --- TODO | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'TODO') diff --git a/TODO b/TODO index 270e9df6..645b5d1f 100644 --- a/TODO +++ b/TODO @@ -8,6 +8,29 @@ Before Release: * Stay on top of https://github.com/pikepdf/pikepdf/pull/315 * Release qtest with updates to qtest-driver and copy back into qpdf +Parent pointer idea: + +* Have replaceKey, removeKey, and eraseItem return the old values. The + comments will clarify the difference between these and the andGet + versions. +* Add std::weak_ptr parent to QPDFObject. When adding a + direct object to an array or dictionary, set its parent. When + removing it, clear the parent pointer. +* When a direct object that already has a parent is added to + something, it is a warning and will become an error in qpdf 12. + There needs to be unsafe add methods used by unsafeShallowCopy. + These will add but not modify the parent pointer. + +This allows an object to be moved from one object to another by +removing it, which returns the now orphaned object, and then inserting +it somewhere else. It also doesn't break the pattern of adding a +direct object to something and subsequently mutating it. It just +prevents the same object from being added to more than one thing. + +Note that arrays and dictionaries still need to contain +QPDFObjectHandle because of indirect objects. This only pertains to +direct objects, which are always "resolved" in QPDFObjectHandle. + Next: * JSON v2 fixes -- cgit v1.2.3-54-g00ecf