Rosetta 3.3
Public Types | Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes
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]
Collaboration diagram for zlib_stream::basic_zip_istream< Elem, Tr, ElemA, ByteT, ByteAT >:
Collaboration graph
[legend]

List of all members.

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 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.
bool is_gzip () const
 returns true if it is a gzip file
void read_footer ()
 reads the gzip footer
bool check_crc () const
 return crc check result
bool check_data_size () const
 return data size check
uLong get_gzip_crc () const
 return the crc value in the file
uLong get_gzip_data_size () const
 return the data size in the file

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;

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

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

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.

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

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_ 
) [static, protected]

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:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines