diff options
| author | ljfa-ag <ljfa-ag@web.de> | 2015-09-15 23:41:16 +0200 |
|---|---|---|
| committer | ljfa-ag <ljfa-ag@web.de> | 2015-09-15 23:41:16 +0200 |
| commit | 0208032d531ddf2f551a64c21248a992a3d606bf (patch) | |
| tree | 05799f22a7b03b48fe79da9e47d65f35035357ca /include | |
| parent | cfbde1f32cc505adf9822339692331c54e0f3b2f (diff) | |
| parent | edaaac5a6c7d20eb5baa6de27aa79cb50878a10b (diff) | |
| download | Project-Tick-0208032d531ddf2f551a64c21248a992a3d606bf.tar.gz Project-Tick-0208032d531ddf2f551a64c21248a992a3d606bf.zip | |
Merge branch 'zlibstream'
Diffstat (limited to 'include')
| -rw-r--r-- | include/io/izlibstream.h | 10 | ||||
| -rw-r--r-- | include/io/ozlibstream.h | 15 | ||||
| -rw-r--r-- | include/io/zlib_error.h | 4 |
3 files changed, 7 insertions, 22 deletions
diff --git a/include/io/izlibstream.h b/include/io/izlibstream.h index edf632eddf..6d58d56b86 100644 --- a/include/io/izlibstream.h +++ b/include/io/izlibstream.h @@ -47,10 +47,6 @@ public: explicit inflate_streambuf(std::istream& input, size_t bufsize = 32768, int window_bits = 32 + 15); ~inflate_streambuf() noexcept; - //No copying or moving - inflate_streambuf(const inflate_streambuf&) = delete; - inflate_streambuf& operator=(const inflate_streambuf&) = delete; - ///@return the wrapped istream std::istream& get_istr() const { return is; } @@ -80,10 +76,8 @@ public: * @param bufsize the size of the internal buffers */ explicit izlibstream(std::istream& input, size_t bufsize = 32768): - buf(input, bufsize) - { - init(&buf); - } + std::istream(&buf), buf(input, bufsize) + {} ///@return the wrapped istream std::istream& get_istr() const { return buf.get_istr(); } diff --git a/include/io/ozlibstream.h b/include/io/ozlibstream.h index 6ebd3c0dd0..0e19aaaa2b 100644 --- a/include/io/ozlibstream.h +++ b/include/io/ozlibstream.h @@ -20,7 +20,6 @@ #ifndef OZLIBSTREAM_H_INCLUDED #define OZLIBSTREAM_H_INCLUDED -#include "io/zlib_error.h" #include <ostream> #include <vector> #include <zlib.h> @@ -38,14 +37,6 @@ public: explicit deflate_streambuf(std::ostream& output, int level = -1, int window_bits = 15, int mem_level = 8, int strategy = Z_DEFAULT_STRATEGY); ~deflate_streambuf() noexcept; - //Moving - deflate_streambuf(deflate_streambuf&&) noexcept = default; - deflate_streambuf& operator=(deflate_streambuf&&) noexcept = default; - - //No copying - deflate_streambuf(const deflate_streambuf&) = delete; - deflate_streambuf& operator=(const deflate_streambuf&) = delete; - std::ostream& get_ostr() const { return os; } private: @@ -85,10 +76,8 @@ public: * Refer to the zlib documentation of deflateInit2 for a detailed explanation of the arguments. */ explicit ozlibstream(std::ostream& output, int level = -1, int window_bits = 15, int mem_level = 8, int strategy = Z_DEFAULT_STRATEGY): - buf(output, level, window_bits, mem_level, strategy) - { - init(&buf); - } + std::ostream(&buf), buf(output, level, window_bits, mem_level, strategy) + {} ///@return the wrapped ostream std::ostream& get_ostr() const { return buf.get_ostr(); } diff --git a/include/io/zlib_error.h b/include/io/zlib_error.h index ce375a6ccd..1ecb50e553 100644 --- a/include/io/zlib_error.h +++ b/include/io/zlib_error.h @@ -11,7 +11,9 @@ public: const int errcode; explicit zlib_error(const char* msg, int errcode): - std::runtime_error(std::string(zError(errcode)) + ": " + msg), + std::runtime_error(msg + ? std::string(zError(errcode)) + ": " + msg + : zError(errcode)), errcode(errcode) {} }; |
