X-Git-Url: http://git.tdb.fi/?p=libs%2Fcore.git;a=blobdiff_plain;f=source%2Fio%2Fzlibcompressed.h;h=eb35f6ce1b8c7c7b33e25cf86f39d36f83b8f782;hp=fb12d61a4eff0fdcb07386582b759c302fc361dd;hb=HEAD;hpb=99b9121e2158603372c7313400283b622e6754d8 diff --git a/source/io/zlibcompressed.h b/source/io/zlibcompressed.h index fb12d61..1dc1569 100644 --- a/source/io/zlibcompressed.h +++ b/source/io/zlibcompressed.h @@ -4,21 +4,21 @@ #include #include #include +#include #include "base.h" namespace Msp { namespace IO { -class zlib_error: public std::runtime_error +class MSPCORE_API zlib_error: public std::runtime_error { private: - int code_; + int m_code; public: zlib_error(const std::string &, int); - virtual ~zlib_error() throw() = default; - int code() const throw() { return code_; } + int code() const noexcept { return m_code; } }; /** @@ -28,17 +28,17 @@ operates on top of another I/O object. To ensure proper termination of the compressed data stream, the ZlibCompressed object must be destroyed before the underlying object is closed. */ -class ZlibCompressed: public Base, public sigc::trackable +class MSPCORE_API ZlibCompressed: public Base, public sigc::trackable { private: struct Private; Base &below; std::size_t buffer_size = 1024; - unsigned char *in_buffer = 0; - unsigned char *out_buffer = 0; + unsigned char *in_buffer = nullptr; + unsigned char *out_buffer = nullptr; bool stream_end = false; - Private *priv = 0; + Private *priv = nullptr; public: /** Creates a zlib de/compression object. The underlying object must be @@ -50,15 +50,15 @@ public: write, and compatible with the underlying object. */ ZlibCompressed(Base &, Mode, unsigned level = 9); - virtual ~ZlibCompressed(); + ~ZlibCompressed() override; - virtual void set_block(bool); - virtual void set_inherit(bool); + void set_block(bool) override; + void set_inherit(bool) override; void flush(); protected: - virtual std::size_t do_write(const char *, std::size_t); + std::size_t do_write(const char *, std::size_t) override; private: /** Compresses data and writes it to the underlying object. Returns true if @@ -68,9 +68,9 @@ private: bool compress_data(int flush_mode); public: - virtual std::size_t do_read(char *, std::size_t); + std::size_t do_read(char *, std::size_t) override; - virtual const Handle &get_handle(Mode); + const Handle &get_handle(Mode) override; }; } // namespace IO