diff --git a/include/qpdf/ObjectHandle.hh b/include/qpdf/ObjectHandle.hh index 478efcb..02b6674 100644 --- a/include/qpdf/ObjectHandle.hh +++ b/include/qpdf/ObjectHandle.hh @@ -137,6 +137,8 @@ namespace qpdf std::string description() const; + inline QPDFObjectHandle const& get(std::string const& key) const; + void no_ci_warn_if(bool condition, std::string const& warning) const; void no_ci_stop_if(bool condition, std::string const& warning) const; void no_ci_stop_damaged_if(bool condition, std::string const& warning) const; diff --git a/libqpdf/qpdf/QPDFObjectHandle_private.hh b/libqpdf/qpdf/QPDFObjectHandle_private.hh index 51b7897..cc30057 100644 --- a/libqpdf/qpdf/QPDFObjectHandle_private.hh +++ b/libqpdf/qpdf/QPDFObjectHandle_private.hh @@ -806,6 +806,20 @@ namespace qpdf } } + /// @brief Retrieves the QPDFObjectHandle const& associated with the given key. + /// + /// This method provides a convenience alternative to the direct use of the subscript operator + /// "(*this)[key]" or "oh()[key]" in derived classes, enabling a simplified and readable way to + /// access object handles by key. + /// + /// @param key The string key used to look up the corresponding QPDFObjectHandle. + /// @return A constant reference to the QPDFObjectHandle associated with the specified key. + inline QPDFObjectHandle const& + BaseHandle::get(std::string const& key) const + { + return (*this)[key]; + } + inline bool BaseHandle::null() const {