diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/qpdf/Buffer.hh | 7 | ||||
-rw-r--r-- | include/qpdf/Pl_Buffer.hh | 8 | ||||
-rw-r--r-- | include/qpdf/QPDF.hh | 2 |
3 files changed, 14 insertions, 3 deletions
diff --git a/include/qpdf/Buffer.hh b/include/qpdf/Buffer.hh index c0669c6c..d0e6eda0 100644 --- a/include/qpdf/Buffer.hh +++ b/include/qpdf/Buffer.hh @@ -24,6 +24,7 @@ #include <cstddef> #include <memory> +#include <string> class Buffer { @@ -35,11 +36,15 @@ class Buffer // object is destroyed. QPDF_DLL Buffer(size_t size); + QPDF_DLL + Buffer(std::string&& content); // Create a Buffer object whose memory is owned by the caller and will not be freed when the // Buffer is destroyed. QPDF_DLL Buffer(unsigned char* buf, size_t size); + QPDF_DLL + Buffer(std::string& content); [[deprecated("Move Buffer or use Buffer::copy instead")]] QPDF_DLL Buffer(Buffer const&); [[deprecated("Move Buffer or use Buffer::copy instead")]] QPDF_DLL Buffer& @@ -75,8 +80,10 @@ class Buffer private: Members(size_t size, unsigned char* buf, bool own_memory); + Members(std::string&& content); Members(Members const&) = delete; + std::string str; bool own_memory; size_t size; unsigned char* buf; diff --git a/include/qpdf/Pl_Buffer.hh b/include/qpdf/Pl_Buffer.hh index 5030e10e..5def8b4f 100644 --- a/include/qpdf/Pl_Buffer.hh +++ b/include/qpdf/Pl_Buffer.hh @@ -33,7 +33,7 @@ #include <qpdf/PointerHolder.hh> // unused -- remove in qpdf 12 (see #785) #include <memory> -#include <vector> +#include <string> class QPDF_DLL_CLASS Pl_Buffer: public Pipeline { @@ -64,6 +64,10 @@ class QPDF_DLL_CLASS Pl_Buffer: public Pipeline QPDF_DLL void getMallocBuffer(unsigned char** buf, size_t* len); + // Same as getBuffer but returns the result as a string. + QPDF_DLL + std::string getString(); + private: class QPDF_DLL_PRIVATE Members { @@ -78,7 +82,7 @@ class QPDF_DLL_CLASS Pl_Buffer: public Pipeline Members(Members const&) = delete; bool ready{true}; - std::vector<unsigned char> data; + std::string data; }; std::shared_ptr<Members> m; diff --git a/include/qpdf/QPDF.hh b/include/qpdf/QPDF.hh index 2ca6005c..ffe07559 100644 --- a/include/qpdf/QPDF.hh +++ b/include/qpdf/QPDF.hh @@ -1133,7 +1133,7 @@ class QPDF Pipeline*& pipeline, QPDFObjGen const& og, QPDFObjectHandle& stream_dict, - std::vector<std::shared_ptr<Pipeline>>& heap); + std::unique_ptr<Pipeline>& heap); // Methods to support object copying void reserveObjects(QPDFObjectHandle foreign, ObjCopier& obj_copier, bool top); |