diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/qpdf/QPDFNameTreeObjectHelper.hh | 11 | ||||
-rw-r--r-- | include/qpdf/QPDFNumberTreeObjectHelper.hh | 11 |
2 files changed, 22 insertions, 0 deletions
diff --git a/include/qpdf/QPDFNameTreeObjectHelper.hh b/include/qpdf/QPDFNameTreeObjectHelper.hh index ebc84735..aa1955ed 100644 --- a/include/qpdf/QPDFNameTreeObjectHelper.hh +++ b/include/qpdf/QPDFNameTreeObjectHelper.hh @@ -125,6 +125,11 @@ class QPDFNameTreeObjectHelper: public QPDFObjectHelper QPDF_DLL void insertAfter(std::string const& key, QPDFObjectHandle value); + // Remove the current item and advance the iterator to the + // next item. + QPDF_DLL + void remove(); + private: iterator(std::shared_ptr<NNTreeIterator> const&); std::shared_ptr<NNTreeIterator> impl; @@ -152,6 +157,12 @@ class QPDFNameTreeObjectHelper: public QPDFObjectHelper QPDF_DLL iterator insert(std::string const& key, QPDFObjectHandle value); + // Remove an item. Return true if the item was found and removed; + // otherwise return false. If value is not null, initialize it to + // the value that was removed. + QPDF_DLL + bool remove(std::string const& key, QPDFObjectHandle* value = nullptr); + // Return the contents of the name tree as a map. Note that name // trees may be very large, so this may use a lot of RAM. It is // more efficient to use QPDFNameTreeObjectHelper's iterator. diff --git a/include/qpdf/QPDFNumberTreeObjectHelper.hh b/include/qpdf/QPDFNumberTreeObjectHelper.hh index 040dc3b1..70695327 100644 --- a/include/qpdf/QPDFNumberTreeObjectHelper.hh +++ b/include/qpdf/QPDFNumberTreeObjectHelper.hh @@ -144,6 +144,11 @@ class QPDFNumberTreeObjectHelper: public QPDFObjectHelper QPDF_DLL void insertAfter(numtree_number key, QPDFObjectHandle value); + // Remove the current item and advance the iterator to the + // next item. + QPDF_DLL + void remove(); + private: iterator(std::shared_ptr<NNTreeIterator> const&); std::shared_ptr<NNTreeIterator> impl; @@ -170,6 +175,12 @@ class QPDFNumberTreeObjectHelper: public QPDFObjectHelper QPDF_DLL iterator insert(numtree_number key, QPDFObjectHandle value); + // Remove an item. Return true if the item was found and removed; + // otherwise return false. If value is not null, initialize it to + // the value that was removed. + QPDF_DLL + bool remove(numtree_number key, QPDFObjectHandle* value = nullptr); + // Return the contents of the number tree as a map. Note that // number trees may be very large, so this may use a lot of RAM. // It is more efficient to use QPDFNumberTreeObjectHelper's |