2
1
mirror of https://github.com/qpdf/qpdf.git synced 2024-11-11 15:40:58 +00:00

TODO: clarify fluent interfaces for QPDFObjectHandle

This commit is contained in:
Jay Berkenbilt 2022-02-25 11:24:38 -05:00
parent 527810e939
commit e7ecc348f9

18
TODO
View File

@ -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.