aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorJay Berkenbilt <ejb@ql.org>2022-02-06 18:30:18 +0100
committerJay Berkenbilt <ejb@ql.org>2022-02-07 18:53:28 +0100
commitcfaae47dc6704a54e3e84decbfbe8840c33f2fc4 (patch)
tree3f6fe735bbd2e5700c1b60193c9ce6d37abe204d /include
parent3e98fe46a24d8231ed5f962f5b874032e4994f08 (diff)
downloadqpdf-cfaae47dc6704a54e3e84decbfbe8840c33f2fc4.tar.zst
Add getBufferSharedPointer() to Pl_Buffer and QPDFWriter
Diffstat (limited to 'include')
-rw-r--r--include/qpdf/Pl_Buffer.hh6
-rw-r--r--include/qpdf/QPDFWriter.hh11
2 files changed, 13 insertions, 4 deletions
diff --git a/include/qpdf/Pl_Buffer.hh b/include/qpdf/Pl_Buffer.hh
index 656c755c..98c87622 100644
--- a/include/qpdf/Pl_Buffer.hh
+++ b/include/qpdf/Pl_Buffer.hh
@@ -51,10 +51,14 @@ class Pl_Buffer: public Pipeline
// Each call to getBuffer() resets this object -- see notes above.
// The caller is responsible for deleting the returned Buffer
- // object.
+ // object. See also getBufferSharedPointer() and getMallocBuffer().
QPDF_DLL
Buffer* getBuffer();
+ // Same as getBuffer but wraps the result in a shared pointer.
+ QPDF_DLL
+ PointerHolder<Buffer> getBufferSharedPointer();
+
// getMallocBuffer behaves in the same was as getBuffer except the
// buffer is allocated with malloc(), making it suitable for use
// when calling from other languages. If there is no data, *buf is
diff --git a/include/qpdf/QPDFWriter.hh b/include/qpdf/QPDFWriter.hh
index 76f50c96..cb6585f0 100644
--- a/include/qpdf/QPDFWriter.hh
+++ b/include/qpdf/QPDFWriter.hh
@@ -118,13 +118,18 @@ class QPDFWriter
QPDF_DLL
void setOutputMemory();
- // Return the buffer object containing the PDF file. If
+ // Return the buffer object containing the PDF file. If
// setOutputMemory() has been called, this method may be called
- // exactly one time after write() has returned. The caller is
- // responsible for deleting the buffer when done.
+ // exactly one time after write() has returned. The caller is
+ // responsible for deleting the buffer when done. See also
+ // getBufferSharedPointer().
QPDF_DLL
Buffer* getBuffer();
+ // Return getBuffer() in a shared pointer.
+ QPDF_DLL
+ PointerHolder<Buffer> getBufferSharedPointer();
+
// Supply your own pipeline object. Output will be written to
// this pipeline, and QPDFWriter will call finish() on the
// pipeline. It is the caller's responsibility to manage the