From e7ecc348f9c48af9a04a5426ca30b9f414ba12d9 Mon Sep 17 00:00:00 2001 From: Jay Berkenbilt Date: Fri, 25 Feb 2022 11:24:38 -0500 Subject: [PATCH] TODO: clarify fluent interfaces for QPDFObjectHandle --- TODO | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/TODO b/TODO index 6de30079..c658340d 100644 --- a/TODO +++ b/TODO @@ -511,13 +511,17 @@ Comments appear in the code prefixed by "ABI" valid. * Use `= delete` and `= default` for constructors and destructors where possible -* Consider having setters return Class& where possible to allow for - use of fluent interfaces -* Consider having addArrayItem, replaceKey, etc. return the new value - so you can say - auto oh = dict.replaceKey("/Key", QPDFObjectHandle::newSomething()); - But this has to be clean with respect to fluent interfaces, so we - might need something slightly different. +* Having QPDFObjectHandle setters return Class& to allow for + use of fluent interfaces. This includes array and dictionary + mutators. + newDictionary().replaceKey("/X", "1"_qpdf),replaceKey("/Y", "(asdf)"_qpdf); +* Add replaceKeyAndGet, appendItemAndGet, setArrayItemAndGet, + insertItemAndGet that return the new item so you can say + auto oh = dict.replaceKeyAndGet("/Key", QPDFObjectHandle::newSomething()); +* Add getOrInsertKey("/X", oh) that returns the existing value or adds + oh as the new value and returns it. +* Add default values to the getters, like getIntValue(default_value). + If a default value is passed in, you never get a type warning. * Added QPDFObjectHandle::ParserCallbacks::handleWarning but had to revert because it was not binary compatible. Consider re-adding. The commit that added this comment includes the reverting of the change.