libmspack

- Main Page
- Data Structures
- Files

- Data Structures
- Data Structure Index
- Data Fields

Data Fields
mskwaj_decompressor Struct Reference

A decompressor for KWAJ compressed files. More...

`#include <mspack.h>`

## Data Fields

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

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

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:

  self | a self-referential pointer to the mskwaj_decompressor instance being called
  kwaj | the KWAJ file to close

See also:
  open()

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:

  self | a self-referential pointer to the mskwaj_decompressor instance being called
  input | the filename of the input KWAJ file. This is passed directly to mspack_system::open().
  output | the 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

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:

  self | a self-referential pointer to the mskwaj_decompressor instance being called
  kwaj | the KWAJ file to extract data from
  filename | the 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

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:

  self | a self-referential pointer to the mskwaj_decompressor instance being called

Returns:
  the most recent error code

See also:
  open(), search()

struct mskwajd_header*(* mskwaj_decompressor::open)(struct mskwaj_decompressor *self, const char *filename)`[read]`

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:

  self | a self-referential pointer to the mskwaj_decompressor instance being called
  filename | the 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:

- mspack.h

All Data Structures Files Functions Variables Defines