diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/qpdf/QPDF.hh | 3 | ||||
-rw-r--r-- | include/qpdf/QPDFObjectHandle.hh | 39 |
2 files changed, 17 insertions, 25 deletions
diff --git a/include/qpdf/QPDF.hh b/include/qpdf/QPDF.hh index 7c389c1d..12d41eff 100644 --- a/include/qpdf/QPDF.hh +++ b/include/qpdf/QPDF.hh @@ -49,6 +49,7 @@ class QPDF_Stream; class BitStream; class BitWriter; class QPDFLogger; +class QPDFParser; class QPDF { @@ -881,7 +882,7 @@ class QPDF // resolution class ParseGuard { - friend class QPDFObjectHandle; + friend class QPDFParser; private: ParseGuard(QPDF* qpdf) : diff --git a/include/qpdf/QPDFObjectHandle.hh b/include/qpdf/QPDFObjectHandle.hh index 4b054928..c1bed81f 100644 --- a/include/qpdf/QPDFObjectHandle.hh +++ b/include/qpdf/QPDFObjectHandle.hh @@ -49,9 +49,12 @@ class QPDFTokenizer; class QPDFExc; class Pl_QPDFTokenizer; class QPDFMatrix; +class QPDFParser; class QPDFObjectHandle { + friend class QPDFParser; + public: // This class is used by replaceStreamData. It provides an // alternative way of associating stream data with a stream. See @@ -1563,15 +1566,6 @@ class QPDFObjectHandle QPDFObjectHandle(QPDF*, QPDFObjGen const& og); QPDFObjectHandle(std::shared_ptr<QPDFObject> const&); - enum parser_state_e { - st_top, - st_start, - st_stop, - st_eof, - st_dictionary, - st_array - }; - // Private object factory methods static QPDFObjectHandle newIndirect(QPDF*, QPDFObjGen const& og); static QPDFObjectHandle newStream( @@ -1593,21 +1587,8 @@ class QPDFObjectHandle bool stop_at_streams); void shallowCopyInternal(QPDFObjectHandle& oh, bool first_level_only); void releaseResolved(); - static void setObjectDescriptionFromInput( - QPDFObjectHandle, - QPDF*, - std::string const&, - std::shared_ptr<InputSource>, - qpdf_offset_t); - static QPDFObjectHandle parseInternal( - std::shared_ptr<InputSource> input, - std::string const& object_description, - QPDFTokenizer& tokenizer, - bool& empty, - StringDecrypter* decrypter, - QPDF* context, - bool content_stream); - void setParsedOffset(qpdf_offset_t offset); + + inline void setParsedOffset(qpdf_offset_t offset); void parseContentStream_internal( std::string const& description, ParserCallbacks* callbacks); static void parseContentStream_data( @@ -1891,4 +1872,14 @@ QPDFObjectHandle::getOwningQPDF( return this->qpdf; } +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 (this->obj.get()) { + this->obj->setParsedOffset(offset); + } +} + #endif // QPDFOBJECTHANDLE_HH |