Commit e7ecc348f9c48af9a04a5426ca30b9f414ba12d9
1 parent
527810e9
TODO: clarify fluent interfaces for QPDFObjectHandle
Showing
1 changed file
with
11 additions
and
7 deletions
TODO
| ... | ... | @@ -511,13 +511,17 @@ Comments appear in the code prefixed by "ABI" |
| 511 | 511 | valid. |
| 512 | 512 | * Use `= delete` and `= default` for constructors and destructors |
| 513 | 513 | where possible |
| 514 | -* Consider having setters return Class& where possible to allow for | |
| 515 | - use of fluent interfaces | |
| 516 | -* Consider having addArrayItem, replaceKey, etc. return the new value | |
| 517 | - so you can say | |
| 518 | - auto oh = dict.replaceKey("/Key", QPDFObjectHandle::newSomething()); | |
| 519 | - But this has to be clean with respect to fluent interfaces, so we | |
| 520 | - might need something slightly different. | |
| 514 | +* Having QPDFObjectHandle setters return Class& to allow for | |
| 515 | + use of fluent interfaces. This includes array and dictionary | |
| 516 | + mutators. | |
| 517 | + newDictionary().replaceKey("/X", "1"_qpdf),replaceKey("/Y", "(asdf)"_qpdf); | |
| 518 | +* Add replaceKeyAndGet, appendItemAndGet, setArrayItemAndGet, | |
| 519 | + insertItemAndGet that return the new item so you can say | |
| 520 | + auto oh = dict.replaceKeyAndGet("/Key", QPDFObjectHandle::newSomething()); | |
| 521 | +* Add getOrInsertKey("/X", oh) that returns the existing value or adds | |
| 522 | + oh as the new value and returns it. | |
| 523 | +* Add default values to the getters, like getIntValue(default_value). | |
| 524 | + If a default value is passed in, you never get a type warning. | |
| 521 | 525 | * Added QPDFObjectHandle::ParserCallbacks::handleWarning but had to |
| 522 | 526 | revert because it was not binary compatible. Consider re-adding. The |
| 523 | 527 | commit that added this comment includes the reverting of the change. | ... | ... |