2 #ifndef CHEPREP_DEFLATEOUTPUTSTREAMBUF_H
3 #define CHEPREP_DEFLATEOUTPUTSTREAMBUF_H
10 #ifndef CHEPREP_NO_ZLIB
12 #endif // CHEPREP_NO_ZLIB
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));
48 inline void putUS(
unsigned short us) {
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);
77 static unsigned long crctable[256];
78 std::streambuf *buffer;
83 #ifndef CHEPREP_NO_ZLIB
84 static const unsigned int inSize = 1000;
85 static const unsigned int outSize = 1000;
90 std::vector<char> out;
91 #endif // CHEPREP_NO_ZLIB
99 #endif // CHEPREP_DEFLATEOUTPUTSTREAMBUF_H