UltraScan III
List of all members | Classes | Public Types | Public Member Functions | Private Types | Private Member Functions | Private Attributes
US_Gzip Class Reference

#include "us_gzip.h"

Collaboration diagram for US_Gzip:
Collaboration graph
[legend]

Classes

struct  config
 For definition of different compression levels. More...
 
struct  ct_data
 
struct  huft
 
struct  tree_desc
 

Public Types

typedef struct US_Gzip::config config
 For definition of different compression levels. More...
 

Public Member Functions

 US_Gzip ()
 
int gzip (const QString &)
 
int gunzip (const QString &)
 
QString explain (const int)
 

Private Types

typedef ush Pos
 
typedef unsigned IPos
 
typedef struct US_Gzip::ct_data ct_data
 
typedef struct US_Gzip::tree_desc tree_desc
 

Private Member Functions

int treat_file (const QString &, bool)
 
QString make_ofname (const QString &, bool)
 
int huft_build (unsigned *, unsigned, unsigned, ush *, ush *, struct huft **, int *)
 
int huft_free (struct huft *)
 
int inflate_codes (struct huft *, struct huft *, int, int)
 
int inflate_stored (void)
 
int inflate_fixed (void)
 
int inflate_dynamic (void)
 
int inflate_block (int *)
 
int inflate (void)
 
int fill_inbuf (int)
 
void flush_window (void)
 
ulg updcrc (uch *, unsigned)
 
void write_buf (int, void *, unsigned)
 
char * base_name (char *)
 
void flush_outbuf (void)
 
off_t deflate (void)
 
void lm_init (void)
 
int file_read (char *, unsigned int)
 
void fill_window (void)
 
int longest_match (IPos)
 
void ct_init (void)
 
int ct_tally (int, int)
 
off_t flush_block (char *, ulg, int)
 
void bi_init (void)
 
void build_tree (tree_desc *)
 
int build_bl_tree (void)
 
void copy_block (char *, unsigned, int)
 
void send_bits (int, int)
 
void compress_block (ct_data *, ct_data *)
 
void send_all_trees (int, int, int)
 
void send_tree (ct_data *, int)
 
void init_block (void)
 
void bi_windup (void)
 
unsigned bi_reverse (unsigned, int)
 
void gen_bitlen (tree_desc *)
 
void gen_codes (ct_data *, int)
 
void pqdownheap (ct_data *, int)
 
void scan_tree (ct_data *, int)
 

Private Attributes

off_t bytes_in
 
off_t bytes_out
 
ulg bb
 
unsigned bk
 
unsigned outcnt
 
unsigned inptr
 
unsigned hufts
 
unsigned insize
 
unsigned crc
 
int ifd
 
int ofd
 
uch inbuf [INBUFSIZ+INBUF_EXTRA]
 
uch outbuf [OUTBUFSIZ+OUTBUF_EXTRA]
 
uch window [2L *WSIZE]
 
long block_start
 
unsigned ins_h
 
unsigned lookahead
 
int eofile
 
unsigned int max_lazy_match
 
unsigned max_chain_length
 
unsigned int prev_length
 
unsigned strstart
 
unsigned match_start
 
unsigned good_match
 
int nice_match
 
ush tab_prefix [1L<< BITS]
 
unsigned short bi_buf
 
int bi_valid
 
unsigned last_lit
 
ct_data dyn_ltree [HEAP_SIZE]
 
ct_data dyn_dtree [2 *D_CODES+1]
 
ct_data static_ltree [L_CODES+2]
 
ct_data static_dtree [D_CODES]
 
ct_data bl_tree [2 *BL_CODES+1]
 
uch length_code [MAX_MATCH-MIN_MATCH+1]
 
uch dist_code [512]
 
unsigned last_dist
 
unsigned last_flags
 
uch flags
 
uch flag_bit
 
ush d_buf [DIST_BUFSIZE]
 
uch flag_buf [LIT_BUFSIZE/8]
 
tree_desc l_desc
 
tree_desc d_desc
 
tree_desc bl_desc
 
ulg opt_len
 
ulg static_len
 
off_t compressed_len
 
int * file_method
 
int base_length [LENGTH_CODES]
 
int base_dist [D_CODES]
 
int heap [2 *L_CODES+1]
 
int heap_len
 
int heap_max
 
uch depth [2 *L_CODES+1]
 
ush bl_count [MAX_BITS+1]
 

Detailed Description

A class to provide gzip compression and decompression. It is limited to level 9 compression. This is a port of the GPLed verion of gzip for Qt4.

Definition at line 34 of file us_gzip.h.

Member Typedef Documentation

For definition of different compression levels.

typedef struct US_Gzip::ct_data US_Gzip::ct_data
private
typedef unsigned US_Gzip::IPos
private

Definition at line 134 of file us_gzip.h.

typedef ush US_Gzip::Pos
private

Definition at line 133 of file us_gzip.h.

typedef struct US_Gzip::tree_desc US_Gzip::tree_desc
private

Constructor & Destructor Documentation

US_Gzip::US_Gzip ( )

Definition at line 196 of file us_gzip.cpp.

Member Function Documentation

char * US_Gzip::base_name ( char *  fname)
private

Definition at line 1673 of file us_gzip.cpp.

void US_Gzip::bi_init ( void  )
private

Definition at line 2197 of file us_gzip.cpp.

unsigned US_Gzip::bi_reverse ( unsigned  code,
int  len 
)
private

Definition at line 2614 of file us_gzip.cpp.

void US_Gzip::bi_windup ( void  )
private

Definition at line 2632 of file us_gzip.cpp.

int US_Gzip::build_bl_tree ( void  )
private

Definition at line 2785 of file us_gzip.cpp.

void US_Gzip::build_tree ( tree_desc desc)
private

Definition at line 2694 of file us_gzip.cpp.

void US_Gzip::compress_block ( ct_data ltree,
ct_data dtree 
)
private

Definition at line 2525 of file us_gzip.cpp.

void US_Gzip::copy_block ( char *  buf,
unsigned  len,
int  header 
)
private

Definition at line 2651 of file us_gzip.cpp.

void US_Gzip::ct_init ( void  )
private

Definition at line 2248 of file us_gzip.cpp.

int US_Gzip::ct_tally ( int  dist,
int  lc 
)
private

Definition at line 2328 of file us_gzip.cpp.

off_t US_Gzip::deflate ( void  )
private

Definition at line 1764 of file us_gzip.cpp.

QString US_Gzip::explain ( const int  error)

Explain an error

Parameters
errorThe error code that was returned gzip or gunzip
Returns
A string that corresponds to the error code

Definition at line 3187 of file us_gzip.cpp.

int US_Gzip::file_read ( char *  buf,
unsigned int  size 
)
private

Definition at line 1977 of file us_gzip.cpp.

int US_Gzip::fill_inbuf ( int  eof_ok)
private

Definition at line 1558 of file us_gzip.cpp.

void US_Gzip::fill_window ( void  )
private

Definition at line 2003 of file us_gzip.cpp.

off_t US_Gzip::flush_block ( char *  buf,
ulg  stored_len,
int  eof 
)
private

Definition at line 2390 of file us_gzip.cpp.

void US_Gzip::flush_outbuf ( void  )
private

Definition at line 1695 of file us_gzip.cpp.

void US_Gzip::flush_window ( void  )
private

Definition at line 1594 of file us_gzip.cpp.

void US_Gzip::gen_bitlen ( tree_desc desc)
private

Definition at line 2823 of file us_gzip.cpp.

void US_Gzip::gen_codes ( ct_data tree,
int  max_code 
)
private

Definition at line 2927 of file us_gzip.cpp.

int US_Gzip::gunzip ( const QString &  filename)

Decompress a file

Parameters
filenameThe file to be compressed.
Returns
An error code. Zero for no error

Definition at line 207 of file us_gzip.cpp.

int US_Gzip::gzip ( const QString &  filename)

Compress a file

Parameters
filenameThe file to be compressed.
Returns
An error code. Zero for no error

Definition at line 201 of file us_gzip.cpp.

int US_Gzip::huft_build ( unsigned *  b,
unsigned  n,
unsigned  s,
ush d,
ush e,
struct huft **  t,
int *  m 
)
private

Definition at line 814 of file us_gzip.cpp.

int US_Gzip::huft_free ( struct huft t)
private

Definition at line 1049 of file us_gzip.cpp.

int US_Gzip::inflate ( void  )
private

Definition at line 1516 of file us_gzip.cpp.

int US_Gzip::inflate_block ( int *  e)
private

Definition at line 1474 of file us_gzip.cpp.

int US_Gzip::inflate_codes ( struct huft tl,
struct huft td,
int  bl,
int  bd 
)
private

Definition at line 1071 of file us_gzip.cpp.

int US_Gzip::inflate_dynamic ( void  )
private

Definition at line 1308 of file us_gzip.cpp.

int US_Gzip::inflate_fixed ( void  )
private

Definition at line 1253 of file us_gzip.cpp.

int US_Gzip::inflate_stored ( void  )
private

Definition at line 1198 of file us_gzip.cpp.

void US_Gzip::init_block ( void  )
private

Definition at line 2502 of file us_gzip.cpp.

void US_Gzip::lm_init ( void  )
private

Definition at line 1881 of file us_gzip.cpp.

int US_Gzip::longest_match ( IPos  cur_match)
private

Definition at line 2067 of file us_gzip.cpp.

QString US_Gzip::make_ofname ( const QString &  filename,
bool  decompress 
)
private

Definition at line 547 of file us_gzip.cpp.

void US_Gzip::pqdownheap ( ct_data tree,
int  k 
)
private

Definition at line 2972 of file us_gzip.cpp.

void US_Gzip::scan_tree ( ct_data tree,
int  max_code 
)
private

Definition at line 3035 of file us_gzip.cpp.

void US_Gzip::send_all_trees ( int  lcodes,
int  dcodes,
int  blcodes 
)
private

Definition at line 3002 of file us_gzip.cpp.

void US_Gzip::send_bits ( int  value,
int  length 
)
private

Definition at line 2587 of file us_gzip.cpp.

void US_Gzip::send_tree ( ct_data tree,
int  max_code 
)
private

Definition at line 3107 of file us_gzip.cpp.

int US_Gzip::treat_file ( const QString &  iname,
bool  decompress 
)
private

Definition at line 213 of file us_gzip.cpp.

ulg US_Gzip::updcrc ( uch s,
unsigned  n 
)
private

Definition at line 1610 of file us_gzip.cpp.

void US_Gzip::write_buf ( int  fd,
void *  buf,
unsigned  cnt 
)
private

Definition at line 1641 of file us_gzip.cpp.

Member Data Documentation

int US_Gzip::base_dist[D_CODES]
private

Definition at line 312 of file us_gzip.h.

int US_Gzip::base_length[LENGTH_CODES]
private

Definition at line 311 of file us_gzip.h.

ulg US_Gzip::bb
private

Definition at line 68 of file us_gzip.h.

unsigned short US_Gzip::bi_buf
private

Definition at line 177 of file us_gzip.h.

int US_Gzip::bi_valid
private

Definition at line 185 of file us_gzip.h.

unsigned US_Gzip::bk
private

Definition at line 69 of file us_gzip.h.

ush US_Gzip::bl_count[MAX_BITS+1]
private

Definition at line 323 of file us_gzip.h.

tree_desc US_Gzip::bl_desc
private

Definition at line 304 of file us_gzip.h.

ct_data US_Gzip::bl_tree[2 *BL_CODES+1]
private

Definition at line 251 of file us_gzip.h.

long US_Gzip::block_start
private

Definition at line 138 of file us_gzip.h.

off_t US_Gzip::bytes_in
private

Definition at line 65 of file us_gzip.h.

off_t US_Gzip::bytes_out
private

Definition at line 66 of file us_gzip.h.

off_t US_Gzip::compressed_len
private

Definition at line 308 of file us_gzip.h.

unsigned US_Gzip::crc
private

Definition at line 76 of file us_gzip.h.

ush US_Gzip::d_buf[DIST_BUFSIZE]
private

Definition at line 275 of file us_gzip.h.

tree_desc US_Gzip::d_desc
private

Definition at line 303 of file us_gzip.h.

uch US_Gzip::depth[2 *L_CODES+1]
private

Definition at line 320 of file us_gzip.h.

uch US_Gzip::dist_code[512]
private

Definition at line 261 of file us_gzip.h.

ct_data US_Gzip::dyn_dtree[2 *D_CODES+1]
private

Definition at line 239 of file us_gzip.h.

ct_data US_Gzip::dyn_ltree[HEAP_SIZE]
private

Definition at line 238 of file us_gzip.h.

int US_Gzip::eofile
private

Definition at line 144 of file us_gzip.h.

int* US_Gzip::file_method
private

Definition at line 309 of file us_gzip.h.

uch US_Gzip::flag_bit
private

Definition at line 269 of file us_gzip.h.

uch US_Gzip::flag_buf[LIT_BUFSIZE/8]
private

Definition at line 289 of file us_gzip.h.

uch US_Gzip::flags
private

Definition at line 268 of file us_gzip.h.

unsigned US_Gzip::good_match
private

Definition at line 166 of file us_gzip.h.

int US_Gzip::heap[2 *L_CODES+1]
private

Definition at line 314 of file us_gzip.h.

int US_Gzip::heap_len
private

Definition at line 315 of file us_gzip.h.

int US_Gzip::heap_max
private

Definition at line 316 of file us_gzip.h.

unsigned US_Gzip::hufts
private

Definition at line 73 of file us_gzip.h.

int US_Gzip::ifd
private

Definition at line 78 of file us_gzip.h.

uch US_Gzip::inbuf[INBUFSIZ+INBUF_EXTRA]
private

Definition at line 108 of file us_gzip.h.

unsigned US_Gzip::inptr
private

Definition at line 72 of file us_gzip.h.

unsigned US_Gzip::ins_h
private

Definition at line 142 of file us_gzip.h.

unsigned US_Gzip::insize
private

Definition at line 74 of file us_gzip.h.

tree_desc US_Gzip::l_desc
private

Definition at line 302 of file us_gzip.h.

unsigned US_Gzip::last_dist
private

Definition at line 266 of file us_gzip.h.

unsigned US_Gzip::last_flags
private

Definition at line 267 of file us_gzip.h.

unsigned US_Gzip::last_lit
private

Definition at line 189 of file us_gzip.h.

uch US_Gzip::length_code[MAX_MATCH-MIN_MATCH+1]
private

Definition at line 258 of file us_gzip.h.

unsigned US_Gzip::lookahead
private

Definition at line 143 of file us_gzip.h.

unsigned US_Gzip::match_start
private

Definition at line 159 of file us_gzip.h.

unsigned US_Gzip::max_chain_length
private

Definition at line 150 of file us_gzip.h.

unsigned int US_Gzip::max_lazy_match
private

Definition at line 145 of file us_gzip.h.

int US_Gzip::nice_match
private

Definition at line 169 of file us_gzip.h.

int US_Gzip::ofd
private

Definition at line 79 of file us_gzip.h.

ulg US_Gzip::opt_len
private

Definition at line 306 of file us_gzip.h.

uch US_Gzip::outbuf[OUTBUFSIZ+OUTBUF_EXTRA]
private

Definition at line 109 of file us_gzip.h.

unsigned US_Gzip::outcnt
private

Definition at line 70 of file us_gzip.h.

unsigned int US_Gzip::prev_length
private

Definition at line 154 of file us_gzip.h.

ct_data US_Gzip::static_dtree[D_CODES]
private

Definition at line 247 of file us_gzip.h.

ulg US_Gzip::static_len
private

Definition at line 307 of file us_gzip.h.

ct_data US_Gzip::static_ltree[L_CODES+2]
private

Definition at line 241 of file us_gzip.h.

unsigned US_Gzip::strstart
private

Definition at line 158 of file us_gzip.h.

ush US_Gzip::tab_prefix[1L<< BITS]
private

Definition at line 175 of file us_gzip.h.

uch US_Gzip::window[2L *WSIZE]
private

Definition at line 110 of file us_gzip.h.


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