#include <DeflateOutputStreamBuffer.h>
Definition at line 20 of file DeflateOutputStreamBuffer.h.
cheprep::DeflateOutputStreamBuffer::DeflateOutputStreamBuffer |
( |
std::streambuf * |
buffer | ) |
|
Definition at line 80 of file DeflateOutputStreamBuffer.cc.
84 #ifndef CHEPREP_NO_ZLIB
88 #endif // CHEPREP_NO_ZLIB
91 #ifndef CHEPREP_NO_ZLIB
99 #endif // CHEPREP_NO_ZLIB
struct internal_state FAR * state
cheprep::DeflateOutputStreamBuffer::~DeflateOutputStreamBuffer |
( |
| ) |
|
|
virtual |
void cheprep::DeflateOutputStreamBuffer::finish |
( |
| ) |
|
Definition at line 129 of file DeflateOutputStreamBuffer.cc.
131 #ifndef CHEPREP_NO_ZLIB
136 zStream.
next_out =
reinterpret_cast<unsigned char *
>(&(out[0]));
140 while ( err ==
Z_OK ) {
150 cerr <<
"ERROR: deflation failed" << endl;
154 cerr <<
"ERROR: deflateEnd failed" << endl;
157 zStreamOpen = false ;
159 #endif // CHEPREP_NO_ZLIB
int ZEXPORT deflateEnd(z_streamp strm)
int ZEXPORT deflate(z_streamp strm, int flush)
bool cheprep::DeflateOutputStreamBuffer::flushOut |
( |
| ) |
|
|
protected |
Definition at line 234 of file DeflateOutputStreamBuffer.cc.
235 int deflatedCount = outSize - zStream.
avail_out;
236 int byteCount = buffer->sputn(&(out[0]), deflatedCount);
238 zStream.
next_out =
reinterpret_cast<unsigned char *
>(&(out[0]));
241 return deflatedCount == byteCount ;
unsigned int cheprep::DeflateOutputStreamBuffer::getCRC |
( |
| ) |
|
|
inlineprotected |
unsigned int cheprep::DeflateOutputStreamBuffer::getSize |
( |
| ) |
|
|
inlineprotected |
void cheprep::DeflateOutputStreamBuffer::init |
( |
bool |
compress | ) |
|
Definition at line 103 of file DeflateOutputStreamBuffer.cc.
106 if (zStreamOpen)
return;
108 zStream.
next_in =
reinterpret_cast<unsigned char *
>(&(in[0]));
111 zStream.
next_out =
reinterpret_cast<unsigned char *
>(&(out[0]));
115 cerr <<
"ERROR: deflateInit2 failed" << endl;
118 setp(&(in[0]), &(in[0])+inSize);
123 #endif // CHEPREP_NO_ZLIB
#define deflateInit2(strm, level, method, windowBits, memLevel, strategy)
int ZEXPORT compress(Bytef *dest, uLongf *destLen, const Bytef *source, uLong sourceLen)
#define Z_DEFAULT_STRATEGY
int cheprep::DeflateOutputStreamBuffer::overflow |
( |
int |
c = EOF | ) |
|
|
protected |
Definition at line 172 of file DeflateOutputStreamBuffer.cc.
174 #ifndef CHEPREP_NO_ZLIB
176 zStream.
avail_in = pptr() - pbase() ;
177 zStream.
next_in =
reinterpret_cast<unsigned char *
>(&(in[0]));
180 unsigned char* buf = zStream.
next_in;
182 crc = crc ^ 0xffffffffUL;
190 crc = crc ^ 0xffffffffUL;
194 zStream.
next_out =
reinterpret_cast<unsigned char *
>(&(out[0]));
207 setp(&(in[0]), &(in[0]) + inSize);
210 cerr <<
"ERROR: deflation failed" << endl;
221 #endif // CHEPREP_NO_ZLIB
222 crc = crc ^ 0xffffffffUL;
223 crc = crctable[(crc ^ c) & 0xff] ^ (crc >> 8);
224 crc = crc ^ 0xffffffffUL;
226 return buffer->sputc((
char)c);
227 #ifndef CHEPREP_NO_ZLIB
229 #endif // CHEPREP_NO_ZLIB
int ZEXPORT deflate(z_streamp strm, int flush)
std::streampos cheprep::DeflateOutputStreamBuffer::pos |
( |
| ) |
|
|
inlineprotected |
void cheprep::DeflateOutputStreamBuffer::putS |
( |
const std::string |
s | ) |
|
|
inlineprotected |
void cheprep::DeflateOutputStreamBuffer::putUB |
( |
unsigned char |
ub | ) |
|
|
inlineprotected |
void cheprep::DeflateOutputStreamBuffer::putUI |
( |
unsigned int |
ui | ) |
|
|
inlineprotected |
Definition at line 39 of file DeflateOutputStreamBuffer.h.
40 unsigned char* ucp =
reinterpret_cast<unsigned char *
>(&ui);
41 unsigned int i = (
static_cast<unsigned int>(ucp[ 3 ]) << 24) +
42 (
static_cast<unsigned int>(ucp[ 2 ]) << 16) +
43 (
static_cast<unsigned int>(ucp[ 1 ]) << 8 ) +
44 (
static_cast<unsigned int>(ucp[ 0 ]));
45 buffer->sputn(reinterpret_cast<char *>(&i),
sizeof(
unsigned int));
void cheprep::DeflateOutputStreamBuffer::putUS |
( |
unsigned short |
us | ) |
|
|
inlineprotected |
Definition at line 48 of file DeflateOutputStreamBuffer.h.
49 unsigned char* ucp =
reinterpret_cast<unsigned char *
>(&
us);
50 unsigned short s = (
static_cast<unsigned short>(ucp[ 1 ]) << 8 ) +
51 (
static_cast<unsigned short>(ucp[ 0 ]));
52 buffer->sputn(reinterpret_cast<char *>(&s),
sizeof(
unsigned short));
static constexpr double us
The documentation for this class was generated from the following files: