diff options
author | Masamichi Hosoda <trueroad@trueroad.jp> | 2019-10-02 13:30:53 +0200 |
---|---|---|
committer | Jay Berkenbilt <ejb@ql.org> | 2019-10-22 22:19:06 +0200 |
commit | cdc46d78f441526d566c9da195e79b900617bb13 (patch) | |
tree | 989933951a6fd97261b2f8b7788af4f2ce05d714 /include | |
parent | 50b329ee9f13e0c615fa8d1d637597ab3929e433 (diff) | |
download | qpdf-cdc46d78f441526d566c9da195e79b900617bb13.tar.zst |
Add QPDFObject::getParsedOffset()
Diffstat (limited to 'include')
-rw-r--r-- | include/qpdf/QPDFObject.hh | 5 | ||||
-rw-r--r-- | include/qpdf/QPDFObjectHandle.hh | 9 |
2 files changed, 14 insertions, 0 deletions
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 <qpdf/DLL.h> +#include <qpdf/Types.h> #include <qpdf/PointerHolder.hh> #include <qpdf/JSON.hh> @@ -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<Members> 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); |