Commit 706e37a42c4ab2bae47ead5045a582aed7607f4e

Authored by Jay Berkenbilt
1 parent 259eec3a

Move multiple direct owner notes in TODO

Showing 1 changed file with 27 additions and 25 deletions
... ... @@ -26,31 +26,6 @@ Pending changes:
26 26  
27 27 Soon: Break ground on "Document-level work"
28 28  
29   -Fix Multiple Direct Object Owner Issue
30   -======================================
31   -
32   -These are some ideas I've had, but I'm parking them until I fully
33   -understand m-holger's proposal to split QPDFObject into QPDFObject and
34   -QPDFValue.
35   -
36   -* Add std::weak_ptr<QPDFObject> parent to QPDFObject. When adding a
37   - direct object to an array or dictionary, set its parent. When
38   - removing it, clear the parent pointer.
39   -* When a direct object that already has a parent is added to
40   - something, it is a warning and will become an error in qpdf 12.
41   - There needs to be unsafe add methods used by unsafeShallowCopy.
42   - These will add but not modify the parent pointer.
43   -
44   -This allows an object to be moved from one object to another by
45   -removing it, which returns the now orphaned object, and then inserting
46   -it somewhere else. It also doesn't break the pattern of adding a
47   -direct object to something and subsequently mutating it. It just
48   -prevents the same object from being added to more than one thing.
49   -
50   -Note that arrays and dictionaries still need to contain
51   -QPDFObjectHandle because of indirect objects. This only pertains to
52   -direct objects, which are always "resolved" in QPDFObjectHandle.
53   -
54 29 Possible future JSON enhancements
55 30 =================================
56 31  
... ... @@ -815,3 +790,30 @@ Rejected Ideas
815 790 circular references. It seems to be too much trouble in the library
816 791 and too much toil for library users to be worth the small benefit of
817 792 not having to call resetObjGen in QPDF's destructor.
  793 +
  794 +* Fix Multiple Direct Object Owner Issue
  795 +
  796 + These are some ideas I had before m-holger's changes to split
  797 + QPDFValue from QPDFObject. These notes were written prior to the
  798 + split of QPDFObject into QPDFValueProxy and QPDFValue and don't work
  799 + directly with the new implementation. I think they are still basic
  800 + valid after adjusting to the new structure, but I think they would
  801 + come at too high a performance cost to be worth doing.
  802 +
  803 + * Add std::weak_ptr<QPDFObject> parent to QPDFObject. When adding a
  804 + direct object to an array or dictionary, set its parent. When
  805 + removing it, clear the parent pointer.
  806 + * When a direct object that already has a parent is added to
  807 + something, it is a warning and will become an error in qpdf 12.
  808 + There needs to be unsafe add methods used by unsafeShallowCopy.
  809 + These will add but not modify the parent pointer.
  810 +
  811 + This allows an object to be moved from one object to another by
  812 + removing it, which returns the now orphaned object, and then inserting
  813 + it somewhere else. It also doesn't break the pattern of adding a
  814 + direct object to something and subsequently mutating it. It just
  815 + prevents the same object from being added to more than one thing.
  816 +
  817 + Note that arrays and dictionaries still need to contain
  818 + QPDFObjectHandle because of indirect objects. This only pertains to
  819 + direct objects, which are always "resolved" in QPDFObjectHandle.
... ...