aboutsummaryrefslogtreecommitdiffstats
path: root/libqpdf/QPDFObjectHandle.cc
diff options
context:
space:
mode:
authorJay Berkenbilt <ejb@ql.org>2022-09-01 23:41:30 +0200
committerJay Berkenbilt <ejb@ql.org>2022-09-02 00:19:47 +0200
commitf772c43de80e1d1636a61bb88fe12f01281de046 (patch)
treea52bc0508e77f882b2e2f63ec5012808063fce37 /libqpdf/QPDFObjectHandle.cc
parentb66392653871f834d7b78aa423ca279e4828951a (diff)
downloadqpdf-f772c43de80e1d1636a61bb88fe12f01281de046.tar.zst
Stop including QPDFObject.hh from other than private files
This required moving some newly inlined functions back to the cc file, but that seems to have had no measurable performance impact.
Diffstat (limited to 'libqpdf/QPDFObjectHandle.cc')
-rw-r--r--libqpdf/QPDFObjectHandle.cc31
1 files changed, 31 insertions, 0 deletions
diff --git a/libqpdf/QPDFObjectHandle.cc b/libqpdf/QPDFObjectHandle.cc
index cb1e9e45..a1019955 100644
--- a/libqpdf/QPDFObjectHandle.cc
+++ b/libqpdf/QPDFObjectHandle.cc
@@ -7,6 +7,7 @@
#include <qpdf/QPDFExc.hh>
#include <qpdf/QPDFLogger.hh>
#include <qpdf/QPDFMatrix.hh>
+#include <qpdf/QPDFObject.hh>
#include <qpdf/QPDFPageObjectHelper.hh>
#include <qpdf/QPDFParser.hh>
#include <qpdf/QPDF_Array.hh>
@@ -2770,6 +2771,36 @@ QPDFObjectHandle::QPDFArrayItems::end()
return iterator(oh, false);
}
+QPDFObjGen
+QPDFObjectHandle::getObjGen() const
+{
+ return isInitialized() ? obj->getObjGen() : QPDFObjGen();
+}
+
+// Indirect object accessors
+QPDF*
+QPDFObjectHandle::getOwningQPDF(
+ bool allow_nullptr, std::string const& error_msg) const
+{
+ // Will be null for direct objects
+ auto result = isInitialized() ? this->obj->getQPDF() : nullptr;
+ if (!allow_nullptr && (result == nullptr)) {
+ throw std::runtime_error(
+ error_msg == "" ? "attempt to use a null qpdf object" : error_msg);
+ }
+ return result;
+}
+
+void
+QPDFObjectHandle::setParsedOffset(qpdf_offset_t offset)
+{
+ // This is called during parsing on newly created direct objects,
+ // so we can't call dereference() here.
+ if (isInitialized()) {
+ this->obj->setParsedOffset(offset);
+ }
+}
+
QPDFObjectHandle operator""_qpdf(char const* v, size_t len)
{
return QPDFObjectHandle::parse(