diff options
Diffstat (limited to 'libqpdf/QPDFObjectHandle.cc')
-rw-r--r-- | libqpdf/QPDFObjectHandle.cc | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/libqpdf/QPDFObjectHandle.cc b/libqpdf/QPDFObjectHandle.cc index 08d648bd..c3a7167b 100644 --- a/libqpdf/QPDFObjectHandle.cc +++ b/libqpdf/QPDFObjectHandle.cc @@ -258,6 +258,29 @@ QPDFObjectHandle::getKeys() return dynamic_cast<QPDF_Dictionary*>(obj.getPointer())->getKeys(); } +// Array and Name accessors +bool +QPDFObjectHandle::isOrHasName(std::string const& value) +{ + if (isName() && (getName() == value)) + { + return true; + } + else if (isArray()) + { + int n = getArrayNItems(); + for (int i = 0; i < n; ++i) + { + QPDFObjectHandle item = getArrayItem(0); + if (item.isName() && (item.getName() == value)) + { + return true; + } + } + } + return false; +} + // Dictionary mutators void |