2
1
mirror of https://github.com/qpdf/qpdf.git synced 2024-12-22 19:08:59 +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. valid.
* Use `= delete` and `= default` for constructors and destructors * Use `= delete` and `= default` for constructors and destructors
where possible where possible
* Consider having setters return Class& where possible to allow for * Having QPDFObjectHandle setters return Class& to allow for
use of fluent interfaces use of fluent interfaces. This includes array and dictionary
* Consider having addArrayItem, replaceKey, etc. return the new value mutators.
so you can say newDictionary().replaceKey("/X", "1"_qpdf),replaceKey("/Y", "(asdf)"_qpdf);
auto oh = dict.replaceKey("/Key", QPDFObjectHandle::newSomething()); * Add replaceKeyAndGet, appendItemAndGet, setArrayItemAndGet,
But this has to be clean with respect to fluent interfaces, so we insertItemAndGet that return the new item so you can say
might need something slightly different. 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 * Added QPDFObjectHandle::ParserCallbacks::handleWarning but had to
revert because it was not binary compatible. Consider re-adding. The revert because it was not binary compatible. Consider re-adding. The
commit that added this comment includes the reverting of the change. commit that added this comment includes the reverting of the change.