aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorJay Berkenbilt <ejb@ql.org>2021-01-24 17:48:46 +0100
committerJay Berkenbilt <ejb@ql.org>2021-01-26 15:12:23 +0100
commite7e20772ed29f3eb9756b31fe0bd9bc29a445891 (patch)
tree1f93c433e36ea15e150751ea2c4cba9ee96ac20f /include
parent5816fb44b8ce24e8bb58cb30792e1c763d6cb163 (diff)
downloadqpdf-e7e20772ed29f3eb9756b31fe0bd9bc29a445891.tar.zst
name/number trees: remove
Diffstat (limited to 'include')
-rw-r--r--include/qpdf/QPDFNameTreeObjectHelper.hh11
-rw-r--r--include/qpdf/QPDFNumberTreeObjectHelper.hh11
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