From 11df7809af7131af139be2e76f2db87128700939 Mon Sep 17 00:00:00 2001 From: Jay Berkenbilt Date: Thu, 5 Aug 2010 19:04:22 +0000 Subject: add pipeline-based stream data replacement function git-svn-id: svn+q:///qpdf/trunk@990 71b93d88-0707-0410-a8cf-f5a4172ac649 --- include/qpdf/QPDFObjectHandle.hh | 38 ++++++++++++++++++++++++++++++++++++-- 1 file changed, 36 insertions(+), 2 deletions(-) (limited to 'include') 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 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 provider, + QPDFObjectHandle const& filter, + QPDFObjectHandle const& decode_parms, + size_t length); // return 0 for direct objects QPDF_DLL -- cgit v1.2.3-54-g00ecf