From cdc46d78f441526d566c9da195e79b900617bb13 Mon Sep 17 00:00:00 2001 From: Masamichi Hosoda Date: Wed, 2 Oct 2019 20:30:53 +0900 Subject: Add QPDFObject::getParsedOffset() --- include/qpdf/QPDFObject.hh | 5 +++++ include/qpdf/QPDFObjectHandle.hh | 9 +++++++++ 2 files changed, 14 insertions(+) (limited to 'include') diff --git a/include/qpdf/QPDFObject.hh b/include/qpdf/QPDFObject.hh index 9878804b..9ff636a9 100644 --- a/include/qpdf/QPDFObject.hh +++ b/include/qpdf/QPDFObject.hh @@ -23,6 +23,7 @@ #define QPDFOBJECT_HH #include +#include #include #include @@ -92,6 +93,9 @@ class QPDFObject bool getDescription(QPDF*&, std::string&); bool hasDescription(); + void setParsedOffset(qpdf_offset_t offset); + qpdf_offset_t getParsedOffset(); + protected: virtual void releaseResolved() {} @@ -108,6 +112,7 @@ class QPDFObject Members(); QPDF* owning_qpdf; std::string object_description; + qpdf_offset_t parsed_offset; }; PointerHolder m; }; diff --git a/include/qpdf/QPDFObjectHandle.hh b/include/qpdf/QPDFObjectHandle.hh index 08782a89..26c74e8d 100644 --- a/include/qpdf/QPDFObjectHandle.hh +++ b/include/qpdf/QPDFObjectHandle.hh @@ -341,6 +341,14 @@ class QPDFObjectHandle StringDecrypter* decrypter, QPDF* context); + // Return the offset where the object was found when parsed. A + // negative value means that the object was created without + // parsing. If the object is in a stream, the offset is from the + // beginning of the stream. Otherwise, the offset is from the + // beginning of the file. + QPDF_DLL + qpdf_offset_t getParsedOffset(); + // Older method: stream_or_array should be the value of /Contents // from a page object. It's more convenient to just call // QPDFPageObjectHelper::parsePageContents on the page object, and @@ -1050,6 +1058,7 @@ class QPDFObjectHandle QPDFTokenizer& tokenizer, bool& empty, StringDecrypter* decrypter, QPDF* context, bool content_stream); + void setParsedOffset(qpdf_offset_t offset); void parseContentStream_internal( std::string const& description, ParserCallbacks* callbacks); -- cgit v1.2.3-54-g00ecf