diff options
author | Jay Berkenbilt <ejb@ql.org> | 2021-02-14 20:04:40 +0100 |
---|---|---|
committer | Jay Berkenbilt <ejb@ql.org> | 2021-02-14 20:42:24 +0100 |
commit | efbb21673c59cfbf6a74de6866a59cb2dbb8e59f (patch) | |
tree | 37439ac43400705551107542c9e9939ee8504294 /include | |
parent | e2593e2efe140d47870b0c511cbf5160db080edd (diff) | |
download | qpdf-efbb21673c59cfbf6a74de6866a59cb2dbb8e59f.tar.zst |
Add functional versions of QPDFObjectHandle::replaceStreamData
Also fix a bug in checking consistency of length for stream data
providers. Length should not be checked or recorded if the provider
says it failed to generate the data.
Diffstat (limited to 'include')
-rw-r--r-- | include/qpdf/QPDFObjectHandle.hh | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/include/qpdf/QPDFObjectHandle.hh b/include/qpdf/QPDFObjectHandle.hh index 41646b79..cb4c5be6 100644 --- a/include/qpdf/QPDFObjectHandle.hh +++ b/include/qpdf/QPDFObjectHandle.hh @@ -30,6 +30,7 @@ #include <vector> #include <set> #include <map> +#include <functional> #include <qpdf/QPDFObjGen.hh> #include <qpdf/PointerHolder.hh> @@ -986,6 +987,26 @@ class QPDFObjectHandle QPDFObjectHandle const& filter, QPDFObjectHandle const& decode_parms); + // Starting in qpdf 10.2, you can use C++-11 function objects + // instead of StreamDataProvider. + + // The provider should write the stream data to the pipeline. For + // a one-liner to replace stream data with the contents of a file, + // pass QUtil::file_provider(filename) as provider. + QPDF_DLL + void replaceStreamData(std::function<void(Pipeline*)> provider, + QPDFObjectHandle const& filter, + QPDFObjectHandle const& decode_parms); + // The provider should write the stream data to the pipeline, + // returning true if it succeeded without errors. + QPDF_DLL + void replaceStreamData( + std::function<bool(Pipeline*, + bool suppress_warnings, + bool will_retry)> provider, + QPDFObjectHandle const& filter, + QPDFObjectHandle const& decode_parms); + // Access object ID and generation. For direct objects, return // object ID 0. |