Commit f772c43de80e1d1636a61bb88fe12f01281de046

Authored by Jay Berkenbilt
1 parent b6639265

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.
include/qpdf/QPDFObjectHandle.hh
... ... @@ -35,12 +35,11 @@
35 35  
36 36 #include <qpdf/Buffer.hh>
37 37 #include <qpdf/InputSource.hh>
  38 +#include <qpdf/JSON.hh>
38 39 #include <qpdf/PointerHolder.hh>
39 40 #include <qpdf/QPDFObjGen.hh>
40 41 #include <qpdf/QPDFTokenizer.hh>
41 42  
42   -#include <qpdf/QPDFObject.hh>
43   -
44 43 class Pipeline;
45 44 class QPDF;
46 45 class QPDF_Array;
... ... @@ -55,6 +54,7 @@ class QPDF_Real;
55 54 class QPDF_Reserved;
56 55 class QPDF_Stream;
57 56 class QPDF_String;
  57 +class QPDFObject;
58 58 class QPDFTokenizer;
59 59 class QPDFExc;
60 60 class Pl_QPDFTokenizer;
... ... @@ -973,7 +973,7 @@ class QPDFObjectHandle
973 973 // null for a direct object if allow_nullptr is set to true or
974 974 // throws a runtime error otherwise.
975 975 QPDF_DLL
976   - inline QPDF* getOwningQPDF(
  976 + QPDF* getOwningQPDF(
977 977 bool allow_nullptr = true, std::string const& error_msg = "") const;
978 978  
979 979 // Create a shallow copy of an object as a direct object, but do not
... ... @@ -1315,7 +1315,7 @@ class QPDFObjectHandle
1315 1315 // QPDFObjGen instead.
1316 1316  
1317 1317 QPDF_DLL
1318   - inline QPDFObjGen getObjGen() const;
  1318 + QPDFObjGen getObjGen() const;
1319 1319 QPDF_DLL
1320 1320 inline int getObjectID() const;
1321 1321 QPDF_DLL
... ... @@ -1616,7 +1616,7 @@ class QPDFObjectHandle
1616 1616 void shallowCopyInternal(QPDFObjectHandle& oh, bool first_level_only);
1617 1617 void releaseResolved();
1618 1618  
1619   - inline void setParsedOffset(qpdf_offset_t offset);
  1619 + void setParsedOffset(qpdf_offset_t offset);
1620 1620 void parseContentStream_internal(
1621 1621 std::string const& description, ParserCallbacks* callbacks);
1622 1622 static void parseContentStream_data(
... ... @@ -1852,12 +1852,6 @@ class QPDFObjectHandle::QPDFArrayItems
1852 1852 QPDFObjectHandle oh;
1853 1853 };
1854 1854  
1855   -inline QPDFObjGen
1856   -QPDFObjectHandle::getObjGen() const
1857   -{
1858   - return isInitialized() ? obj->getObjGen() : QPDFObjGen();
1859   -}
1860   -
1861 1855 inline int
1862 1856 QPDFObjectHandle::getObjectID() const
1863 1857 {
... ... @@ -1882,28 +1876,4 @@ QPDFObjectHandle::isInitialized() const
1882 1876 return obj != nullptr;
1883 1877 }
1884 1878  
1885   -// Indirect object accessors
1886   -inline QPDF*
1887   -QPDFObjectHandle::getOwningQPDF(
1888   - bool allow_nullptr, std::string const& error_msg) const
1889   -{
1890   - // Will be null for direct objects
1891   - auto result = isInitialized() ? this->obj->getQPDF() : nullptr;
1892   - if (!allow_nullptr && (result == nullptr)) {
1893   - throw std::runtime_error(
1894   - error_msg == "" ? "attempt to use a null qpdf object" : error_msg);
1895   - }
1896   - return result;
1897   -}
1898   -
1899   -inline void
1900   -QPDFObjectHandle::setParsedOffset(qpdf_offset_t offset)
1901   -{
1902   - // This is called during parsing on newly created direct objects,
1903   - // so we can't call dereference() here.
1904   - if (isInitialized()) {
1905   - this->obj->setParsedOffset(offset);
1906   - }
1907   -}
1908   -
1909 1879 #endif // QPDFOBJECTHANDLE_HH
... ...
libqpdf/QPDF.cc
... ... @@ -21,6 +21,7 @@
21 21 #include <qpdf/Pl_OStream.hh>
22 22 #include <qpdf/QPDFExc.hh>
23 23 #include <qpdf/QPDFLogger.hh>
  24 +#include <qpdf/QPDFObject.hh>
24 25 #include <qpdf/QPDF_Array.hh>
25 26 #include <qpdf/QPDF_Dictionary.hh>
26 27 #include <qpdf/QPDF_Null.hh>
... ...
libqpdf/QPDFObjectHandle.cc
... ... @@ -7,6 +7,7 @@
7 7 #include <qpdf/QPDFExc.hh>
8 8 #include <qpdf/QPDFLogger.hh>
9 9 #include <qpdf/QPDFMatrix.hh>
  10 +#include <qpdf/QPDFObject.hh>
10 11 #include <qpdf/QPDFPageObjectHelper.hh>
11 12 #include <qpdf/QPDFParser.hh>
12 13 #include <qpdf/QPDF_Array.hh>
... ... @@ -2770,6 +2771,36 @@ QPDFObjectHandle::QPDFArrayItems::end()
2770 2771 return iterator(oh, false);
2771 2772 }
2772 2773  
  2774 +QPDFObjGen
  2775 +QPDFObjectHandle::getObjGen() const
  2776 +{
  2777 + return isInitialized() ? obj->getObjGen() : QPDFObjGen();
  2778 +}
  2779 +
  2780 +// Indirect object accessors
  2781 +QPDF*
  2782 +QPDFObjectHandle::getOwningQPDF(
  2783 + bool allow_nullptr, std::string const& error_msg) const
  2784 +{
  2785 + // Will be null for direct objects
  2786 + auto result = isInitialized() ? this->obj->getQPDF() : nullptr;
  2787 + if (!allow_nullptr && (result == nullptr)) {
  2788 + throw std::runtime_error(
  2789 + error_msg == "" ? "attempt to use a null qpdf object" : error_msg);
  2790 + }
  2791 + return result;
  2792 +}
  2793 +
  2794 +void
  2795 +QPDFObjectHandle::setParsedOffset(qpdf_offset_t offset)
  2796 +{
  2797 + // This is called during parsing on newly created direct objects,
  2798 + // so we can't call dereference() here.
  2799 + if (isInitialized()) {
  2800 + this->obj->setParsedOffset(offset);
  2801 + }
  2802 +}
  2803 +
2773 2804 QPDFObjectHandle operator""_qpdf(char const* v, size_t len)
2774 2805 {
2775 2806 return QPDFObjectHandle::parse(
... ...
qpdf/test_renumber.cc
1 1 #include <qpdf/Buffer.hh>
  2 +#include <qpdf/Constants.h>
2 3 #include <qpdf/QPDF.hh>
3 4 #include <qpdf/QPDFObjGen.hh>
4   -#include <qpdf/QPDFObject.hh>
5 5 #include <qpdf/QPDFObjectHandle.hh>
6 6 #include <qpdf/QPDFWriter.hh>
7 7 #include <qpdf/QPDFXRefEntry.hh>
... ...