Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   Related Pages  

zlib Namespace Reference

the zlib wrapper names More...

Compounds

Typedefs

Enumerations

Functions


Detailed Description

the zlib wrapper names

the zlib namespace contains all zlib related classes and functions.


Typedef Documentation

typedef std::vector<unsigned char> zlib::CBuffer
 

this is just a short cut for unsigned char vectors


Function Documentation

void zlib::Compress const CBuffer   input,
CBuffer   output,
int    level = BEST_COMPRESSION
 

compress a vector. the compressed output is placed in another vector.

Parameters:
input  input vector.
output  output vector. it will be resized to the compressed size.
level  compression level.

00076 {
00077     assert( !input.empty( ) ) ;
00078 
00079     Compress( &input[0], input.size( ), output, level ) ;
00080 }

void zlib::Compress CBuffer   buffer,
int    level = BEST_COMPRESSION
 

compress a vector in-place. this function is provided for convinience.

00085 {
00086     assert( !buffer.empty( ) ) ;
00087 
00088     CBuffer result ;
00089     Compress( buffer, result, level ) ;
00090     result.swap( buffer ) ;
00091 }

void zlib::Compress const void *    buffer,
unsigned    size,
CBuffer   output,
int    level = BEST_COMPRESSION
 

compress a raw buffer into a vector. it use a vector as output so that we can save a output size argument.

00097 {
00098     assert( buffer != 0 ) ;
00099     assert( size > 0 ) ;
00100     
00101     // double original size must be enough
00102     CBuffer result( size * 2 ) ;
00103 
00104     unsigned long out_len = result.size( ) ;
00105     int err = compress2( &result[0], &out_len,
00106                          static_cast<const unsigned char*>( buffer ),
00107                          size, level ) ;
00108 
00109     if ( err != Z_OK )
00110         throw CError( err ) ;
00111     else
00112     {
00113         result.resize( out_len ) ;
00114         result.swap( output ) ;
00115     }
00116 }


Generated on Sun Feb 2 09:17:37 2003 for libpdf++ by doxygen1.2.16