aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorm-holger <m-holger@kubitscheck.org>2022-01-21 15:09:06 +0100
committerJay Berkenbilt <jberkenbilt@users.noreply.github.com>2022-01-22 15:10:28 +0100
commit8593b9fdf74e68099a5fe2aa0b6d0b6320781a2d (patch)
treee280ab8d4af58b16f21a4e3fb05342c04e0e3d29 /include
parent370710657a7e7c771668107d1b6407fc350a2891 (diff)
downloadqpdf-8593b9fdf74e68099a5fe2aa0b6d0b6320781a2d.tar.zst
Add new convenience methods QPDFObjectHandle::isNameAndEquals, etc
Add methods isNameAndEquals, isDictionaryOfType, isStreamOfType
Diffstat (limited to 'include')
-rw-r--r--include/qpdf/QPDFObjectHandle.hh16
-rw-r--r--include/qpdf/qpdf-c.h9
2 files changed, 25 insertions, 0 deletions
diff --git a/include/qpdf/QPDFObjectHandle.hh b/include/qpdf/QPDFObjectHandle.hh
index ccc3993e..f540272d 100644
--- a/include/qpdf/QPDFObjectHandle.hh
+++ b/include/qpdf/QPDFObjectHandle.hh
@@ -365,6 +365,22 @@ class QPDFObjectHandle
QPDF_DLL
bool isScalar();
+ // True if the object is a name object representing the provided name.
+ QPDF_DLL
+ bool isNameAndEquals(std::string const& name);
+
+ // True if the object is a dictionary of the specified type and
+ // subtype, if any.
+ QPDF_DLL
+ bool isDictionaryOfType(std::string const& type,
+ std::string const& subtype = "");
+
+ // True if the object is a stream of the specified type and
+ // subtype, if any.
+ QPDF_DLL
+ bool isStreamOfType(std::string const& type,
+ std::string const& subtype = "");
+
// Public factory methods
// Wrap an object in an array if it is not already an array. This
diff --git a/include/qpdf/qpdf-c.h b/include/qpdf/qpdf-c.h
index 7369e616..b62f2e09 100644
--- a/include/qpdf/qpdf-c.h
+++ b/include/qpdf/qpdf-c.h
@@ -676,6 +676,15 @@ extern "C" {
QPDF_BOOL qpdf_oh_is_indirect(qpdf_data qpdf, qpdf_oh oh);
QPDF_DLL
QPDF_BOOL qpdf_oh_is_scalar(qpdf_data qpdf, qpdf_oh oh);
+
+ QPDF_DLL
+ QPDF_BOOL qpdf_oh_is_name_and_equals(
+ qpdf_data qpdf, qpdf_oh oh, char const* name);
+
+ QPDF_DLL
+ QPDF_BOOL qpdf_oh_is_dictionary_of_type(
+ qpdf_data qpdf, qpdf_oh oh, char const* type, char const* subtype);
+
QPDF_DLL
enum qpdf_object_type_e qpdf_oh_get_type_code(qpdf_data qpdf, qpdf_oh oh);
QPDF_DLL