diff options
author | Jay Berkenbilt <ejb@ql.org> | 2010-08-05 21:04:22 +0200 |
---|---|---|
committer | Jay Berkenbilt <ejb@ql.org> | 2010-08-05 21:04:22 +0200 |
commit | 11df7809af7131af139be2e76f2db87128700939 (patch) | |
tree | de549eec5d64837384f60d319ce072d1455baaa8 /include | |
parent | 98765c3b5ceecb2c2540405eab1dd7ae1f02ec31 (diff) | |
download | qpdf-11df7809af7131af139be2e76f2db87128700939.tar.zst |
add pipeline-based stream data replacement function
git-svn-id: svn+q:///qpdf/trunk@990 71b93d88-0707-0410-a8cf-f5a4172ac649
Diffstat (limited to 'include')
-rw-r--r-- | include/qpdf/QPDFObjectHandle.hh | 38 |
1 files changed, 36 insertions, 2 deletions
diff --git a/include/qpdf/QPDFObjectHandle.hh b/include/qpdf/QPDFObjectHandle.hh index a7b8b991..e8d24d40 100644 --- a/include/qpdf/QPDFObjectHandle.hh +++ b/include/qpdf/QPDFObjectHandle.hh @@ -195,8 +195,42 @@ class QPDFObjectHandle // decryption filters have been applied, is as presented. QPDF_DLL void replaceStreamData(PointerHolder<Buffer> data, - QPDFObjectHandle filter, - QPDFObjectHandle decode_parms); + QPDFObjectHandle const& filter, + QPDFObjectHandle const& decode_parms); + + class StreamDataProvider + { + public: + QPDF_DLL + virtual ~StreamDataProvider() + { + } + // See replaceStreamData below for details on how to override + // this method. + virtual void provideStreamData(int objid, int generation, + Pipeline* pipeline) = 0; + }; + // As above, replace this stream's stream data. Instead of + // directly providing a buffer with the stream data, call the + // given provider's provideStreamData method. The method is to + // write the unencrypted, raw stream data to the provided + // pipeline. The stream's /Length key will be set to the length + // as provided. This must match the number of bytes written to + // the pipeline. The provider must write exactly the same data to + // the pipeline every time it is called. The method is invoked + // with the object ID and generation number, which are just there + // to be available to the handler in case it is useful for + // indexing purposes. This makes it easier to reuse the same + // StreamDataProvider object for multiple streams. Although it is + // more complex to use this form of replaceStreamData, it makes it + // possible to avoid allocating memory for the stream data. + // Example programs are provided that use both forms of + // replaceStreamData. + QPDF_DLL + void replaceStreamData(PointerHolder<StreamDataProvider> provider, + QPDFObjectHandle const& filter, + QPDFObjectHandle const& decode_parms, + size_t length); // return 0 for direct objects QPDF_DLL |