aboutsummaryrefslogtreecommitdiffstats
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
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.
-rw-r--r--include/qpdf/QPDFObjectHandle.hh40
-rw-r--r--libqpdf/QPDF.cc1
-rw-r--r--libqpdf/QPDFObjectHandle.cc31
-rw-r--r--qpdf/test_renumber.cc2
4 files changed, 38 insertions, 36 deletions
diff --git a/include/qpdf/QPDFObjectHandle.hh b/include/qpdf/QPDFObjectHandle.hh
index 02f83363..058c11f3 100644
--- a/include/qpdf/QPDFObjectHandle.hh
+++ b/include/qpdf/QPDFObjectHandle.hh
@@ -35,12 +35,11 @@
#include <qpdf/Buffer.hh>
#include <qpdf/InputSource.hh>
+#include <qpdf/JSON.hh>
#include <qpdf/PointerHolder.hh>
#include <qpdf/QPDFObjGen.hh>
#include <qpdf/QPDFTokenizer.hh>
-#include <qpdf/QPDFObject.hh>
-
class Pipeline;
class QPDF;
class QPDF_Array;
@@ -55,6 +54,7 @@ class QPDF_Real;
class QPDF_Reserved;
class QPDF_Stream;
class QPDF_String;
+class QPDFObject;
class QPDFTokenizer;
class QPDFExc;
class Pl_QPDFTokenizer;
@@ -973,7 +973,7 @@ class QPDFObjectHandle
// null for a direct object if allow_nullptr is set to true or
// throws a runtime error otherwise.
QPDF_DLL
- inline QPDF* getOwningQPDF(
+ QPDF* getOwningQPDF(
bool allow_nullptr = true, std::string const& error_msg = "") const;
// Create a shallow copy of an object as a direct object, but do not
@@ -1315,7 +1315,7 @@ class QPDFObjectHandle
// QPDFObjGen instead.
QPDF_DLL
- inline QPDFObjGen getObjGen() const;
+ QPDFObjGen getObjGen() const;
QPDF_DLL
inline int getObjectID() const;
QPDF_DLL
@@ -1616,7 +1616,7 @@ class QPDFObjectHandle
void shallowCopyInternal(QPDFObjectHandle& oh, bool first_level_only);
void releaseResolved();
- inline void setParsedOffset(qpdf_offset_t offset);
+ void setParsedOffset(qpdf_offset_t offset);
void parseContentStream_internal(
std::string const& description, ParserCallbacks* callbacks);
static void parseContentStream_data(
@@ -1852,12 +1852,6 @@ class QPDFObjectHandle::QPDFArrayItems
QPDFObjectHandle oh;
};
-inline QPDFObjGen
-QPDFObjectHandle::getObjGen() const
-{
- return isInitialized() ? obj->getObjGen() : QPDFObjGen();
-}
-
inline int
QPDFObjectHandle::getObjectID() const
{
@@ -1882,28 +1876,4 @@ QPDFObjectHandle::isInitialized() const
return obj != nullptr;
}
-// Indirect object accessors
-inline 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;
-}
-
-inline 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);
- }
-}
-
#endif // QPDFOBJECTHANDLE_HH
diff --git a/libqpdf/QPDF.cc b/libqpdf/QPDF.cc
index 9593c44f..98ad2267 100644
--- a/libqpdf/QPDF.cc
+++ b/libqpdf/QPDF.cc
@@ -21,6 +21,7 @@
#include <qpdf/Pl_OStream.hh>
#include <qpdf/QPDFExc.hh>
#include <qpdf/QPDFLogger.hh>
+#include <qpdf/QPDFObject.hh>
#include <qpdf/QPDF_Array.hh>
#include <qpdf/QPDF_Dictionary.hh>
#include <qpdf/QPDF_Null.hh>
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(
diff --git a/qpdf/test_renumber.cc b/qpdf/test_renumber.cc
index 1ef519d6..7edec21b 100644
--- a/qpdf/test_renumber.cc
+++ b/qpdf/test_renumber.cc
@@ -1,7 +1,7 @@
#include <qpdf/Buffer.hh>
+#include <qpdf/Constants.h>
#include <qpdf/QPDF.hh>
#include <qpdf/QPDFObjGen.hh>
-#include <qpdf/QPDFObject.hh>
#include <qpdf/QPDFObjectHandle.hh>
#include <qpdf/QPDFWriter.hh>
#include <qpdf/QPDFXRefEntry.hh>