Commit 9a6cfda219d111c8f6bfa7dee28aad0409c0ad37
Committed by
GitHub
Merge pull request #1583 from m-holger/null
Add `nullify` method to `BaseHandle` for setting objects to a mutable…
Showing
2 changed files
with
10 additions
and
0 deletions
include/qpdf/ObjectHandle.hh
| ... | ... | @@ -130,6 +130,8 @@ namespace qpdf |
| 130 | 130 | inline void assign(qpdf_object_type_e required, BaseHandle const& other); |
| 131 | 131 | inline void assign(qpdf_object_type_e required, BaseHandle&& other); |
| 132 | 132 | |
| 133 | + inline void nullify(); | |
| 134 | + | |
| 133 | 135 | std::string description() const; |
| 134 | 136 | |
| 135 | 137 | void no_ci_warn_if(bool condition, std::string const& warning) const; | ... | ... |
libqpdf/qpdf/QPDFObjectHandle_private.hh
| ... | ... | @@ -812,6 +812,14 @@ namespace qpdf |
| 812 | 812 | return !obj || type_code() == ::ot_null; |
| 813 | 813 | } |
| 814 | 814 | |
| 815 | + inline void | |
| 816 | + BaseHandle::nullify() | |
| 817 | + { | |
| 818 | + if (obj) { | |
| 819 | + obj = QPDFObject::create<QPDF_Null>(); | |
| 820 | + } | |
| 821 | + } | |
| 822 | + | |
| 815 | 823 | inline qpdf_offset_t |
| 816 | 824 | BaseHandle::offset() const |
| 817 | 825 | { | ... | ... |