#include <ZlibStringCompressor.h>
Public Member Functions | |
ZlibStringCompressor (unsigned long bufferSize=0) | |
constructor, with optional bufferSizeArgument; | |
const string | compress (const string &toCompress, int level) |
Compress a string. | |
const string | inflate (const string &compressed) |
Uncompress a string. | |
unsigned long | getBufferSize () |
Find the size of the buffer in bytes (for information);. | |
void | setDebugLevel (int level) |
Level of 0 produces no output. | |
int | getDebugLevel () |
return the value of the debug level. | |
Bytef * | setBufferSize (unsigned long size) |
set the buffer size (in bytes) | |
Static Private Member Functions | |
static void | checkZlibResult (const int result, const char *file, const int line) |
Check return result number from zlib, throwing InvalidArgument if necessary. | |
static unsigned long | findSizeInBytes (const string &s) |
Find the length in bytes of a string. | |
static unsigned long | findRequiredBufferSize (const unsigned long uncompressedSize) |
Find the minimum buffer size for compresses string. | |
Private Attributes | |
long unsigned | m_bufferSize |
size in bytes of the buffer | |
Bytef * | m_buffer |
int | m_debugLevel |
Can also extract a compressed string. The extraction step requires a buffer, so the class has an interal buffer, which it increases in size if necessary, to fit the uncompressed string. Sends mrs messages if it encounters problems with zlib. Designed so that a single instance of this class should be re-used many times, so clients should initiate one and then continue to re-use it for best use of the buffering. Note that returned `strings' are actually references to data held in internal buffers.
Definition at line 22 of file ZlibStringCompressor.h.
|
constructor, with optional bufferSizeArgument;
Definition at line 12 of file ZlibStringCompressor.cpp. References setBufferSize(). Here is the call graph for this function: ![]() |
|
Check return result number from zlib, throwing InvalidArgument if necessary.
Definition at line 35 of file ZlibStringCompressor.cpp. Referenced by compress(), and inflate(). |
|
Compress a string.
Definition at line 50 of file ZlibStringCompressor.cpp. References checkZlibResult(), findRequiredBufferSize(), findSizeInBytes(), getBufferSize(), m_buffer, and setBufferSize(). Here is the call graph for this function: ![]() |
|
Find the minimum buffer size for compresses string.
Referenced by compress(). |
|
Find the length in bytes of a string.
Definition at line 83 of file ZlibStringCompressor.h. Referenced by compress(), and inflate(). |
|
Find the size of the buffer in bytes (for information);.
Definition at line 17 of file ZlibStringCompressor.cpp. References m_bufferSize. Referenced by compress(), and inflate(). |
|
return the value of the debug level.
Definition at line 96 of file ZlibStringCompressor.h. References m_debugLevel. Referenced by setBufferSize(). |
|
Uncompress a string.
Definition at line 76 of file ZlibStringCompressor.cpp. References checkZlibResult(), findSizeInBytes(), getBufferSize(), m_buffer, and setBufferSize(). Here is the call graph for this function: ![]() |
|
set the buffer size (in bytes)
Definition at line 21 of file ZlibStringCompressor.cpp. References getDebugLevel(), m_buffer, and m_bufferSize. Referenced by compress(), inflate(), and ZlibStringCompressor(). Here is the call graph for this function: ![]() |
|
Level of 0 produces no output. Higher levels produce more output. Definition at line 92 of file ZlibStringCompressor.h. References m_debugLevel. |
|
size in bytes of the buffer
Definition at line 65 of file ZlibStringCompressor.h. Referenced by getBufferSize(), and setBufferSize(). |