3 #ifndef INCLUDE_NN_NLIB_ZLIBOUTPUTSTREAM_H_
4 #define INCLUDE_NN_NLIB_ZLIBOUTPUTSTREAM_H_
16 typedef void* (*ReallocFunc)(
void* p,
size_t n);
26 buffer_size(64 * 1024),
27 level(Z_DEFAULT_COMPRESSION),
32 buffer_size(buffer_size_),
39 buffer_size(buffer_size_),
41 realloc_func(realloc_func_) {}
48 typedef ZlibOutputStreamSettings::ReallocFunc ReallocFunc;
52 virtual
errno_t Transform(OutputStream* os, const
void* p,
size_t nBytes,
54 virtual
void* GetWorkBuffer(
size_t* n)
NLIB_NOEXCEPT NLIB_OVERRIDE;
62 ReallocFunc m_Realloc;
63 unsigned char* m_BufIn;
64 unsigned char* m_BufOut;
68 bool m_IsInternalBuffer;
69 unsigned char m_BaseBuf[256];
81 return this->Init(settings);
84 return m_Transform.Init(settings);
94 #endif // INCLUDE_NN_NLIB_ZLIBOUTPUTSTREAM_H_
#define NLIB_NOEXCEPT
Defines noexcept geared to the environment, or the equivalent.
errno_t Init() noexcept
Initializes using the default settings.
#define NLIB_FINAL
Defines final if it is available for use. If not, holds an empty string.
#define NLIB_DISALLOW_COPY_AND_ASSIGN(TypeName)
Prohibits use of the copy constructor and assignment operator for the class specified by TypeName...
#define NLIB_OVERRIDE
Defines override if it is available for use. If not, holds an empty string.
void * buf_out
The buffer set for z_stream::next_out.
void * buf_in
The buffer set for z_stream::next_in.
The class for holding the OutputTransform derived class.
#define NLIB_CEXPR
Defines constexpr if it is available for use. If not, holds an empty string.
size_t buffer_size
The size of ZlibOutputStreamSettings::buf_in and ZlibOutputStreamSettings::buf_out.
ReallocFunc realloc_func
The realloc function or its equivalent that ZlibOutputStream uses internally.
constexpr ZlibOutputStreamSettings() noexcept
Instantiates the object with default parameters (default constructor). Sets the default values...
constexpr ZlibOutputStreamSettings(void *buf_in_, void *buf_out_, size_t buffer_size_, int level_) noexcept
Sets the individual data members.
The structure that stores the various ZlibOutputStream settings. At construction time, the default settings are stored.
The class that uses zlib to decompress data and write the data to a stream.
int level
The compression setting to pass to the deflateInit2 function of zlib.
errno_t Init(const ZlibOutputStreamSettings &settings) noexcept
Configures the buffer and the other settings to use for streaming according to the values specified i...
constexpr ZlibOutputStreamSettings(void *buf_in_, void *buf_out_, size_t buffer_size_, int level_, ReallocFunc realloc_func_) noexcept
Sets the individual data members.