aboutsummaryrefslogtreecommitdiffstats
path: root/libqpdf/JSON.cc
diff options
context:
space:
mode:
Diffstat (limited to 'libqpdf/JSON.cc')
-rw-r--r--libqpdf/JSON.cc11
1 files changed, 11 insertions, 0 deletions
diff --git a/libqpdf/JSON.cc b/libqpdf/JSON.cc
index f6401642..35b8fd76 100644
--- a/libqpdf/JSON.cc
+++ b/libqpdf/JSON.cc
@@ -410,6 +410,17 @@ JSON::isNull() const
return m->value->type_code == vt_null;
}
+JSON
+JSON::getDictItem(std::string const& key) const
+{
+ if (auto v = dynamic_cast<JSON_dictionary const*>(m->value.get())) {
+ if (auto it = v->members.find(key); it != v->members.end()) {
+ return it->second;
+ }
+ }
+ return makeNull();
+}
+
bool
JSON::forEachDictItem(std::function<void(std::string const& key, JSON value)> fn) const
{