Wrapper for compressed file.

Datové struktry

struct  CR_FILE

Definice maker

#define CR_CW_OK   0
#define CR_CW_ERR   -1

Výčty

enum  cr_CompressionType {
  CR_CW_AUTO_DETECT_COMPRESSION, CR_CW_UNKNOWN_COMPRESSION, CR_CW_NO_COMPRESSION, CR_CW_GZ_COMPRESSION,
  CR_CW_BZ2_COMPRESSION, CR_CW_XZ_COMPRESSION
}
enum  cr_OpenMode { CR_CW_MODE_READ, CR_CW_MODE_WRITE }

Funkce

const char * cr_compression_suffix (cr_CompressionType comtype)
cr_CompressionType cr_detect_compression (const char *filename)
CR_FILEcr_open (const char *filename, cr_OpenMode mode, cr_CompressionType comtype)
int cr_read (CR_FILE *cr_file, void *buffer, unsigned int len)
int cr_write (CR_FILE *cr_file, const void *buffer, unsigned int len)
int cr_puts (CR_FILE *cr_file, const char *str)
int cr_printf (CR_FILE *cr_file, const char *format,...)
int cr_close (CR_FILE *cr_file)

Dokumentace k definicím maker

#define CR_CW_ERR   -1

Return value - Error

Definice je uvedena na řádku 62 v souboru compression_wrapper.h.

#define CR_CW_OK   0

Return value - Everything all right

Definice je uvedena na řádku 61 v souboru compression_wrapper.h.


Dokumentace výčtových typů

Compression type.

Hodnoty výčtu:
CR_CW_AUTO_DETECT_COMPRESSION 

Autodetection

CR_CW_UNKNOWN_COMPRESSION 

Unknown compression

CR_CW_NO_COMPRESSION 

No compression

CR_CW_GZ_COMPRESSION 

Gzip compression

CR_CW_BZ2_COMPRESSION 

BZip2 compression

CR_CW_XZ_COMPRESSION 

XZ compression

Definice je uvedena na řádku 33 v souboru compression_wrapper.h.

Open modes.

Hodnoty výčtu:
CR_CW_MODE_READ 

Read mode

CR_CW_MODE_WRITE 

Write mode

Definice je uvedena na řádku 45 v souboru compression_wrapper.h.


Dokumentace funkcí

int cr_close ( CR_FILE cr_file  ) 

Closes the CR_FILE.

Parametry:
cr_file CR_FILE pointer
Návratová hodnota:
CR_CW_OK or CR_CW_ERR
const char* cr_compression_suffix ( cr_CompressionType  comtype  ) 

Returns a common suffix for the specified cr_CompressionType.

Parametry:
comtype compression type
Návratová hodnota:
common file suffix
cr_CompressionType cr_detect_compression ( const char *  filename  ) 

Detect a compression type of the specified file.

Parametry:
filename filename
Návratová hodnota:
detected type of compression
CR_FILE* cr_open ( const char *  filename,
cr_OpenMode  mode,
cr_CompressionType  comtype 
)

Open/Create the specified file.

Parametry:
filename filename
mode open mode
comtype type of compression
Návratová hodnota:
pointer to a CR_FILE or NULL
int cr_printf ( CR_FILE cr_file,
const char *  format,
  ... 
)

Writes a formatted string into the cr_file.

Parametry:
cr_file CR_FILE pointer
format format string
... list of additional arguments as specified in format
Návratová hodnota:
CR_CW_OK or CR_CW_ERR
int cr_puts ( CR_FILE cr_file,
const char *  str 
)

Writes the string pointed by str into the cr_file.

Parametry:
cr_file CR_FILE pointer
str null terminated ('') string
Návratová hodnota:
number of uncompressed bytes writed or CR_CW_ERR
int cr_read ( CR_FILE cr_file,
void *  buffer,
unsigned int  len 
)

Reads an array of len bytes from the CR_FILE.

Parametry:
cr_file CR_FILE pointer
buffer target buffer
len number of bytes to read
Návratová hodnota:
CR_CW_OK or CR_CW_ERR
int cr_write ( CR_FILE cr_file,
const void *  buffer,
unsigned int  len 
)

Writes the array of len bytes from buffer to the cr_file.

Parametry:
cr_file CR_FILE pointer
buffer source buffer
len number of bytes to read
Návratová hodnota:
number of uncompressed bytes readed (0 = EOF) or CR_CW_ERR

Generováno 24 Sep 2013 pro projekt createrepo_c library programem  doxygen 1.6.1