2 #ifndef CHEPREP_DEFLATEOUTPUTSTREAMBUF_H
3 #define CHEPREP_DEFLATEOUTPUTSTREAMBUF_H
10 #ifndef CHEPREP_NO_ZLIB
12 #endif // CHEPREP_NO_ZLIB
26 void init(
bool compress);
35 #ifndef CHEPREP_NO_ZLIB
37 #endif // CHEPREP_NO_ZLIB
39 inline void putUI(
unsigned int ui) {
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));
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));
55 inline void putUB(
unsigned char ub) {
59 inline void putS(
const std::string
s) {
60 buffer->sputn(s.c_str(), s.length());
63 inline std::streampos
pos() {
64 std::ostream os(buffer);
83 #ifndef CHEPREP_NO_ZLIB
84 static const unsigned int inSize = 1000;
90 std::vector<char>
out;
91 #endif // CHEPREP_NO_ZLIB
99 #endif // CHEPREP_DEFLATEOUTPUTSTREAMBUF_H
static const unsigned int inSize
void putUB(unsigned char ub)
static constexpr double us
void putUI(unsigned int ui)
DeflateOutputStreamBuffer(std::streambuf *buffer)
virtual ~DeflateOutputStreamBuffer()
void putUS(unsigned short us)
static unsigned long crctable[256]
static const unsigned int outSize
void putS(const std::string s)