Rosetta
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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, Tr, ElemA, ByteT, ByteAT >
typedef std::basic_istream
< Elem, Tr > & 
istream_reference
 
typedef basic_unzip_streambuf
< Elem, Tr, ElemA, ByteT,
ByteAT > 
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...
 
- Public Member Functions inherited from zlib_stream::basic_zip_istreambase< Elem, Tr, ElemA, ByteT, ByteAT >
 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;

Definition at line 569 of file zipstream.hpp.

Member Typedef Documentation

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

Definition at line 580 of file zipstream.hpp.

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

Definition at line 579 of file zipstream.hpp.

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

Definition at line 578 of file zipstream.hpp.

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

Definition at line 577 of file zipstream.hpp.

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

Definition at line 576 of file zipstream.hpp.

Constructor & Destructor Documentation

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

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

Definition at line 620 of file zipstream.hpp.

References zlib_stream::basic_zip_istreambase< 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().

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
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
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

return the crc value in the file

Definition at line 626 of file zipstream.hpp.

References zlib_stream::basic_zip_istream< Elem, Tr, ElemA, ByteT, ByteAT >::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 >::get_gzip_data_size ( ) const
inline

return the data size in the file

Definition at line 629 of file zipstream.hpp.

References zlib_stream::basic_zip_istream< Elem, Tr, ElemA, ByteT, ByteAT >::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 >>
bool zlib_stream::basic_zip_istream< Elem, Tr, ElemA, ByteT, ByteAT >::is_gzip ( ) const
inline
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

Definition at line 575 of file zipstream.ipp.

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

Definition at line 618 of file zipstream.ipp.

Member Data Documentation

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
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
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: