25 #ifndef GZIPINDEX_HPP__
26 #define GZIPINDEX_HPP__
34 #include <boost/iostreams/concepts.hpp>
35 #include <boost/iostreams/traits.hpp>
51 void z_error(
const std::string &msg);
91 void locate(
const uint64_t uncompressed_pos);
110 CHK_CRC32=0,CHK_ALR32=1,CHK_UNKNOWN
120 uint64_t m_inf_offset;
122 uint64_t m_def_offset;
125 uint64_t m_blocksize;
127 uint64_t m_totalsize;
129 uint64_t m_deflatedsize;
133 std::vector<uint64_t> m_syncofs;
135 std::vector<uint64_t> m_chksums;
144 mdparser(
gzxindex*
const t):that(t),fmtinit(false) {}
145 void operator()(
const std::string& md);
150 static bool get_gzxblock(std::string& buf,std::istream& is);
152 void parse(std::istream& in);
153 bool read_record(std::istream& is,
const std::streampos endofs=0);
156 gzxindex(gzxindex* nxt);
158 void parse_old(std::istream& in);
163 gzxindex(
const uint64_t blocksize,
const ChkType check);
165 gzxindex(std::istream *
const is);
168 void append(uint64_t syncoff,uint64_t chksum);
169 void set_totals(
const uint64_t inflated,
const uint64_t deflated);
170 void write_record(std::ostream& os)
const;
182 iterator
begin()
const;
185 void print(std::ostream &os)
const;
196 static const int WINDOWBITS=15;
198 static const int MEMLEVEL=8;
223 void deflate_block();
238 STGY_DEFAULT=Z_DEFAULT_STRATEGY,
239 STGY_FILTERED=Z_FILTERED,
240 STGY_HUFFMAN=Z_HUFFMAN_ONLY,
246 gzxdeflater(std::ostream& os,
const bool syncblocks=
true,
247 const size_t bs=131072,
const HeaderType ht=HEADER_GZIP,
257 void write(
const char* s,
size_t n);
265 :
public boost::iostreams::sink
274 std::streamsize write(
const char* s,std::streamsize n);
280 :
public boost::iostreams::stream<gzxdeflater_sink>
288 gzx_ostream(std::ostream* os,
const bool syncblocks=
true,
289 const size_t bs=131072);
301 static const int WINDOWBITS=15;
303 static const size_t BUFSIZE=8192;
342 void inflate_start(
const size_t defl_pos=0);
348 gzxinflater(std::istream& is,
const bool raw_seekable=
true);
356 std::streamsize
read(
char* s,
size_t n);
359 std::streampos
seek(int64_t ofs,std::ios_base::seekdir way);
366 :
public boost::iostreams::device<boost::iostreams::input_seekable>
376 std::streamsize
read(
char* s,std::streamsize n);
378 std::streampos seek(boost::iostreams::stream_offset off,
379 std::ios_base::seekdir way);
384 :
public boost::iostreams::stream<gzxinflater_source>
392 gzx_istream(std::istream* is,
const bool raw_seekable=
true);
398 static std::string inflate(
const std::string& zdata);
403 #endif // GZIPINDEX_HPP__