Rosetta
Public Types | Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | List of all members
zlib_stream::basic_zip_istream< Elem, Tr, ElemA, ByteT, ByteAT > Class Template Reference

A zipper istream. More...

#include <zipstream.hpp>

Inheritance diagram for zlib_stream::basic_zip_istream< Elem, Tr, ElemA, ByteT, ByteAT >:
Inheritance graph
[legend]

Public Types

typedef basic_zip_istreambase< Elem, Tr, ElemA, ByteT, ByteAT > zip_istreambase_type
 
typedef std::basic_istream< Elem, Tr > istream_type
 
typedef std::basic_istream< Elem, Tr > & istream_reference
 
typedef Elem char_type
 
typedef unsigned char byte_type
 
- Public Types inherited from zlib_stream::basic_zip_istreambase< Elem, std::char_traits< Elem >, std::allocator< Elem >, unsigned char, std::allocator< unsigned char > >
typedef std::basic_istream< Elem, std::char_traits< Elem > > & istream_reference
 
typedef basic_unzip_streambuf< Elem, std::char_traits< Elem >, std::allocator< Elem >, unsigned char, std::allocator< unsigned char > > unzip_streambuf_type
 

Public Member Functions

 basic_zip_istream (istream_reference istream_, size_t window_size_=15, size_t read_buffer_size_=default_buffer_size, size_t input_buffer_size_=default_buffer_size)
 Construct a unzipper stream. More...
 
bool is_gzip () const
 returns true if it is a gzip file More...
 
void read_footer ()
 reads the gzip footer More...
 
bool check_crc () const
 return crc check result More...
 
bool check_data_size () const
 return data size check More...
 
uLong get_gzip_crc () const
 return the crc value in the file More...
 
uLong get_gzip_data_size () const
 return the data size in the file More...
 
uLong get_crc () const
 returns the uncompressed data crc More...
 
uLong get_out_size () const
 returns the uncompressed data size More...
 
unzip_streambuf_typerdbuf ()
 returns the underlying unzip istream object More...
 
- Public Member Functions inherited from zlib_stream::basic_zip_istreambase< Elem, std::char_traits< Elem >, std::allocator< Elem >, unsigned char, std::allocator< unsigned char > >
 basic_zip_istreambase (istream_reference ostream_, size_t window_size_, size_t read_buffer_size_, size_t input_buffer_size_)
 
unzip_streambuf_typerdbuf ()
 returns the underlying unzip istream object More...
 
int get_zerr () const
 returns the zlib error state More...
 
uLong get_crc () const
 returns the uncompressed data crc More...
 
uLong get_out_size () const
 returns the uncompressed data size More...
 
uLong get_in_size () const
 returns the compressed data size More...
 

Protected Member Functions

int check_header ()
 

Static Protected Member Functions

static void read_uint32 (istream_reference in_, unsigned long &x_)
 

Protected Attributes

bool m_is_gzip
 
uLong m_gzip_crc
 
uLong m_gzip_data_size
 

Detailed Description

template<typename Elem, typename Tr = std::char_traits< Elem >, typename ElemA = std::allocator< Elem >, typename ByteT = unsigned char, typename ByteAT = std::allocator< ByteT >>
class zlib_stream::basic_zip_istream< Elem, Tr, ElemA, ByteT, ByteAT >

A zipper istream.

Remarks

This class is a istream decorator that behaves 'almost' like any other ostream.

At construction, it takes any istream that shall be used to input of the compressed data.

Simlpe example:

// create a stream on zip string
istringstream istringstream_( ostringstream_.str());
// create unzipper istream
zip_istream unzipper( istringstream_);
// read and unzip
unzipper>>f_r>>d_r>>ui_r>>ul_r>>us_r>>c_r>>dum_r;
basic_zip_istream< char > zip_istream
Definition: zipstream.hpp:647

Member Typedef Documentation

◆ byte_type

template<typename Elem , typename Tr = std::char_traits< Elem >, typename ElemA = std::allocator< Elem >, typename ByteT = unsigned char, typename ByteAT = std::allocator< ByteT >>
typedef unsigned char zlib_stream::basic_zip_istream< Elem, Tr, ElemA, ByteT, ByteAT >::byte_type

◆ char_type

template<typename Elem , typename Tr = std::char_traits< Elem >, typename ElemA = std::allocator< Elem >, typename ByteT = unsigned char, typename ByteAT = std::allocator< ByteT >>
typedef Elem zlib_stream::basic_zip_istream< Elem, Tr, ElemA, ByteT, ByteAT >::char_type

◆ istream_reference

template<typename Elem , typename Tr = std::char_traits< Elem >, typename ElemA = std::allocator< Elem >, typename ByteT = unsigned char, typename ByteAT = std::allocator< ByteT >>
typedef std::basic_istream< Elem, Tr >& zlib_stream::basic_zip_istream< Elem, Tr, ElemA, ByteT, ByteAT >::istream_reference

◆ istream_type

template<typename Elem , typename Tr = std::char_traits< Elem >, typename ElemA = std::allocator< Elem >, typename ByteT = unsigned char, typename ByteAT = std::allocator< ByteT >>
typedef std::basic_istream< Elem, Tr > zlib_stream::basic_zip_istream< Elem, Tr, ElemA, ByteT, ByteAT >::istream_type

◆ zip_istreambase_type

template<typename Elem , typename Tr = std::char_traits< Elem >, typename ElemA = std::allocator< Elem >, typename ByteT = unsigned char, typename ByteAT = std::allocator< ByteT >>
typedef basic_zip_istreambase< Elem, Tr, ElemA, ByteT, ByteAT > zlib_stream::basic_zip_istream< Elem, Tr, ElemA, ByteT, ByteAT >::zip_istreambase_type

Constructor & Destructor Documentation

◆ basic_zip_istream()

template<typename Elem , typename Tr = std::char_traits< Elem >, typename ElemA = std::allocator< Elem >, typename ByteT = unsigned char, typename ByteAT = std::allocator< ByteT >>
zlib_stream::basic_zip_istream< Elem, Tr, ElemA, ByteT, ByteAT >::basic_zip_istream ( istream_reference  istream_,
size_t  window_size_ = 15,
size_t  read_buffer_size_ = default_buffer_size,
size_t  input_buffer_size_ = default_buffer_size 
)
inline

Member Function Documentation

◆ check_crc()

template<typename Elem , typename Tr = std::char_traits< Elem >, typename ElemA = std::allocator< Elem >, typename ByteT = unsigned char, typename ByteAT = std::allocator< ByteT >>
bool zlib_stream::basic_zip_istream< Elem, Tr, ElemA, ByteT, ByteAT >::check_crc ( ) const
inline

return crc check result

Note
When you have finished reading the compressed data, call read_footer to read the uncompressed data crc.
This method compares it to the crc of the uncompressed data.
Returns
true if crc check is succesful

References zlib_stream::basic_zip_istream< Elem, Tr, ElemA, ByteT, ByteAT >::get_crc(), and zlib_stream::basic_zip_istream< Elem, Tr, ElemA, ByteT, ByteAT >::m_gzip_crc.

Referenced by utility::io::izstream::check_crc().

◆ check_data_size()

template<typename Elem , typename Tr = std::char_traits< Elem >, typename ElemA = std::allocator< Elem >, typename ByteT = unsigned char, typename ByteAT = std::allocator< ByteT >>
bool zlib_stream::basic_zip_istream< Elem, Tr, ElemA, ByteT, ByteAT >::check_data_size ( ) const
inline

◆ check_header()

template<typename Elem , typename Tr , typename ElemA , typename ByteT , typename ByteAT >
int zlib_stream::basic_zip_istream< Elem, Tr, ElemA, ByteT, ByteAT >::check_header
protected

◆ get_crc()

template<typename Elem , typename Tr = std::char_traits< Elem >, typename ElemA = std::allocator< Elem >, typename ByteT = unsigned char, typename ByteAT = std::allocator< ByteT >>
uLong zlib_stream::basic_zip_istreambase< Elem, Tr, ElemA, ByteT, ByteAT >::get_crc
inline

◆ get_gzip_crc()

template<typename Elem , typename Tr = std::char_traits< Elem >, typename ElemA = std::allocator< Elem >, typename ByteT = unsigned char, typename ByteAT = std::allocator< ByteT >>
uLong zlib_stream::basic_zip_istream< Elem, Tr, ElemA, ByteT, ByteAT >::get_gzip_crc ( ) const
inline

◆ get_gzip_data_size()

template<typename Elem , typename Tr = std::char_traits< Elem >, typename ElemA = std::allocator< Elem >, typename ByteT = unsigned char, typename ByteAT = std::allocator< ByteT >>
uLong zlib_stream::basic_zip_istream< Elem, Tr, ElemA, ByteT, ByteAT >::get_gzip_data_size ( ) const
inline

◆ get_out_size()

template<typename Elem , typename Tr = std::char_traits< Elem >, typename ElemA = std::allocator< Elem >, typename ByteT = unsigned char, typename ByteAT = std::allocator< ByteT >>
uLong zlib_stream::basic_zip_istreambase< Elem, Tr, ElemA, ByteT, ByteAT >::get_out_size
inline

◆ is_gzip()

template<typename Elem , typename Tr = std::char_traits< Elem >, typename ElemA = std::allocator< Elem >, typename ByteT = unsigned char, typename ByteAT = std::allocator< ByteT >>
bool zlib_stream::basic_zip_istream< Elem, Tr, ElemA, ByteT, ByteAT >::is_gzip ( ) const
inline

◆ rdbuf()

template<typename Elem , typename Tr = std::char_traits< Elem >, typename ElemA = std::allocator< Elem >, typename ByteT = unsigned char, typename ByteAT = std::allocator< ByteT >>
unzip_streambuf_type* zlib_stream::basic_zip_istreambase< Elem, Tr, ElemA, ByteT, ByteAT >::rdbuf
inline

returns the underlying unzip istream object

Referenced by zlib_stream::basic_zip_istream< Elem, Tr, ElemA, ByteT, ByteAT >::basic_zip_istream().

◆ read_footer()

template<typename Elem , typename Tr , typename ElemA , typename ByteT , typename ByteAT >
void zlib_stream::basic_zip_istream< Elem, Tr, ElemA, ByteT, ByteAT >::read_footer

reads the gzip footer

◆ read_uint32()

template<typename Elem , typename Tr , typename ElemA , typename ByteT , typename ByteAT >
void zlib_stream::basic_zip_istream< Elem, Tr, ElemA, ByteT, ByteAT >::read_uint32 ( istream_reference  in_,
unsigned long &  x_ 
)
staticprotected

References docking::b1, docking::b2, and docking::b3.

Member Data Documentation

◆ m_gzip_crc

template<typename Elem , typename Tr = std::char_traits< Elem >, typename ElemA = std::allocator< Elem >, typename ByteT = unsigned char, typename ByteAT = std::allocator< ByteT >>
uLong zlib_stream::basic_zip_istream< Elem, Tr, ElemA, ByteT, ByteAT >::m_gzip_crc
protected

◆ m_gzip_data_size

template<typename Elem , typename Tr = std::char_traits< Elem >, typename ElemA = std::allocator< Elem >, typename ByteT = unsigned char, typename ByteAT = std::allocator< ByteT >>
uLong zlib_stream::basic_zip_istream< Elem, Tr, ElemA, ByteT, ByteAT >::m_gzip_data_size
protected

◆ m_is_gzip

template<typename Elem , typename Tr = std::char_traits< Elem >, typename ElemA = std::allocator< Elem >, typename ByteT = unsigned char, typename ByteAT = std::allocator< ByteT >>
bool zlib_stream::basic_zip_istream< Elem, Tr, ElemA, ByteT, ByteAT >::m_is_gzip
protected

The documentation for this class was generated from the following files: