Commit 6a2456f732ed31e3eaba48ea80979cc104b2655e
1 parent
5901fcad
Comment, ChangeLog, release note for new contribution
Showing
3 changed files
with
16 additions
and
0 deletions
ChangeLog
| 1 | +2022-02-06 Jay Berkenbilt <ejb@ql.org> | |
| 2 | + | |
| 3 | + * From m-holger: add getKeyIfDict(), which calls getKey for | |
| 4 | + dictionaries and returns null if called on null. This is for | |
| 5 | + easier access to optional, lower-level dictionaries. | |
| 6 | + | |
| 1 | 7 | 2022-02-05 Jay Berkenbilt <ejb@ql.org> |
| 2 | 8 | |
| 3 | 9 | * Add several new accessors to QPDFObjectHandle: the bool | ... | ... |
include/qpdf/QPDFObjectHandle.hh
| ... | ... | @@ -810,6 +810,9 @@ class QPDFObjectHandle |
| 810 | 810 | // returned. |
| 811 | 811 | QPDF_DLL |
| 812 | 812 | QPDFObjectHandle getKey(std::string const&); |
| 813 | + // If the object is null, return null. Otherwise, call getKey(). | |
| 814 | + // This makes it easier to access lower-level dictionaries, as in | |
| 815 | + // auto font = page.getKeyIfDict("/Resources").getKeyIfDict("/Font"); | |
| 813 | 816 | QPDF_DLL |
| 814 | 817 | QPDFObjectHandle getKeyIfDict(std::string const&); |
| 815 | 818 | // Return all keys. Keys with null values are treated as if | ... | ... |
manual/release-notes.rst
| ... | ... | @@ -129,6 +129,13 @@ For a detailed list of changes, please see the file |
| 129 | 129 | ``qpdf_oh_is_name_and_equals``. Thanks to M. Holger for the |
| 130 | 130 | contribution. |
| 131 | 131 | |
| 132 | + - New convenience method in ``QPDFObjectHandle``: ``getKeyIfDict`` | |
| 133 | + returns null when called on null and otherwise calls ``getKey``. | |
| 134 | + This makes it easier to access optional, lower-level | |
| 135 | + dictionaries. It is exposed in the C API | |
| 136 | + ``qpdf_oh_get_key_if_dict``. Thanks to M. Holger for the | |
| 137 | + contribution. | |
| 138 | + | |
| 132 | 139 | - New functions added to ``QUtil``: ``make_shared_cstr`` and |
| 133 | 140 | ``make_unique_cstr`` copy ``std::string`` to |
| 134 | 141 | ``std::shared_ptr<char>`` and ``std::unique_ptr<char[]>``. These | ... | ... |