Commit edbaeff208d8a34d23b7330b791ac04f78918de7

Authored by m-holger
1 parent 277779a3

Add `nullify` method to `BaseHandle` for setting objects to a mutable null.

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