#include <stdexcept>
#include <string>
#include <sigc++/trackable.h>
+#include <msp/core/mspcore_api.h>
#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; }
};
/**
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
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
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