libmspack
Data Fields
mskwaj_decompressor Struct Reference

A decompressor for KWAJ compressed files. More...

#include <mspack.h>

Collaboration diagram for mskwaj_decompressor:
Collaboration graph
[legend]

Data Fields

struct mskwajd_header *(* open )(struct mskwaj_decompressor *self, const char *filename)
 Opens a KWAJ file and reads the header. More...
 
void(* close )(struct mskwaj_decompressor *self, struct mskwajd_header *kwaj)
 Closes a previously opened KWAJ file. More...
 
int(* extract )(struct mskwaj_decompressor *self, struct mskwajd_header *kwaj, const char *filename)
 Extracts the compressed data from a KWAJ file. More...
 
int(* decompress )(struct mskwaj_decompressor *self, const char *input, const char *output)
 Decompresses an KWAJ file to an output file in one step. More...
 
int(* last_error )(struct mskwaj_decompressor *self)
 Returns the error code set by the most recently called method. More...
 

Detailed Description

A decompressor for KWAJ compressed files.

All fields are READ ONLY.

See also
mspack_create_kwaj_decompressor(), mspack_destroy_kwaj_decompressor()

Field Documentation

◆ close

void(* mskwaj_decompressor::close) (struct mskwaj_decompressor *self, struct mskwajd_header *kwaj)

Closes a previously opened KWAJ file.

This closes a KWAJ file and frees the mskwajd_header associated with it. The KWAJ header pointer is now invalid and cannot be used again.

Parameters
selfa self-referential pointer to the mskwaj_decompressor instance being called
kwajthe KWAJ file to close
See also
open()

◆ decompress

int(* mskwaj_decompressor::decompress) (struct mskwaj_decompressor *self, const char *input, const char *output)

Decompresses an KWAJ file to an output file in one step.

This opens an KWAJ file as input, reads the header, then decompresses the compressed data immediately to an output file, finally closing both the input and output file. It is more convenient to use than open() then extract() then close(), if you do not need to know the KWAJ output size or output filename.

Parameters
selfa self-referential pointer to the mskwaj_decompressor instance being called
inputthe filename of the input KWAJ file. This is passed directly to mspack_system::open().
outputthe filename to write the decompressed data to. This is passed directly to mspack_system::open().
Returns
an error code, or MSPACK_ERR_OK if successful

◆ extract

int(* mskwaj_decompressor::extract) (struct mskwaj_decompressor *self, struct mskwajd_header *kwaj, const char *filename)

Extracts the compressed data from a KWAJ file.

This decompresses the compressed KWAJ data stream and writes it to an output file.

Parameters
selfa self-referential pointer to the mskwaj_decompressor instance being called
kwajthe KWAJ file to extract data from
filenamethe filename to write the decompressed data to. This is passed directly to mspack_system::open().
Returns
an error code, or MSPACK_ERR_OK if successful

◆ last_error

int(* mskwaj_decompressor::last_error) (struct mskwaj_decompressor *self)

Returns the error code set by the most recently called method.

This is useful for open() which does not return an error code directly.

Parameters
selfa self-referential pointer to the mskwaj_decompressor instance being called
Returns
the most recent error code
See also
open(), search()

◆ open

struct mskwajd_header*(* mskwaj_decompressor::open) (struct mskwaj_decompressor *self, const char *filename)

Opens a KWAJ file and reads the header.

If the file opened is a valid KWAJ file, all headers will be read and a mskwajd_header structure will be returned.

In the case of an error occuring, NULL is returned and the error code is available from last_error().

The filename pointer should be considered "in use" until close() is called on the KWAJ file.

Parameters
selfa self-referential pointer to the mskwaj_decompressor instance being called
filenamethe filename of the KWAJ compressed file. This is passed directly to mspack_system::open().
Returns
a pointer to a mskwajd_header structure, or NULL on failure
See also
close()

The documentation for this struct was generated from the following file: