diff options
author | Jay Berkenbilt <ejb@ql.org> | 2021-12-10 20:57:11 +0100 |
---|---|---|
committer | Jay Berkenbilt <ejb@ql.org> | 2021-12-10 20:57:35 +0100 |
commit | 1c62c2a3427e92846ddaaae44f864022b2aade4f (patch) | |
tree | fd4d89ad177dcdc170f764637cafcdda5f849bde /libqpdf/qpdf-c.cc | |
parent | 8e0b15333228ab973571eec498af41d3cbb8ab63 (diff) | |
download | qpdf-1c62c2a3427e92846ddaaae44f864022b2aade4f.tar.zst |
C API: expose functions for indirect objects (fixes #588)
Diffstat (limited to 'libqpdf/qpdf-c.cc')
-rw-r--r-- | libqpdf/qpdf-c.cc | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/libqpdf/qpdf-c.cc b/libqpdf/qpdf-c.cc index b7e67e85..1183ffd2 100644 --- a/libqpdf/qpdf-c.cc +++ b/libqpdf/qpdf-c.cc @@ -972,6 +972,12 @@ qpdf_oh qpdf_get_root(qpdf_data qpdf) }); } +qpdf_oh qpdf_get_object_by_id(qpdf_data qpdf, int objid, int generation) +{ + QTC::TC("qpdf", "qpdf-c called qpdf_get_object_by_id"); + return new_object(qpdf, qpdf->qpdf->getObjectByID(objid, generation)); +} + template<class RET> static RET do_with_oh( qpdf_data qpdf, qpdf_oh oh, @@ -1008,6 +1014,15 @@ static void do_with_oh_void( }); } +void qpdf_replace_object(qpdf_data qpdf, int objid, int generation, qpdf_oh oh) +{ + do_with_oh_void( + qpdf, oh, [&qpdf, &objid, &generation](QPDFObjectHandle& o) { + QTC::TC("qpdf", "qpdf-c called qpdf_replace_object"); + qpdf->qpdf->replaceObject(objid, generation, o); + }); +} + QPDF_BOOL qpdf_oh_is_initialized(qpdf_data qpdf, qpdf_oh oh) { QTC::TC("qpdf", "qpdf-c called qpdf_oh_is_initialized"); @@ -1421,6 +1436,16 @@ void qpdf_oh_make_direct(qpdf_data qpdf, qpdf_oh oh) }); } +qpdf_oh qpdf_make_indirect_object(qpdf_data qpdf, qpdf_oh oh) +{ + return do_with_oh<qpdf_oh>( + qpdf, oh, + return_uninitialized(qpdf), + [&qpdf](QPDFObjectHandle& o) { + return new_object(qpdf, qpdf->qpdf->makeIndirectObject(o)); + }); +} + static QPDFObjectHandle qpdf_oh_item_internal(qpdf_data qpdf, qpdf_oh item) { |