Files
fx/fx.compression/include/fx/compression/cstream.h
T

60 lines
1.6 KiB
C

#ifndef FX_COMPRESS_CSTREAM_H_
#define FX_COMPRESS_CSTREAM_H_
#include <fx/macros.h>
#include <fx/stream.h>
#include <stdbool.h>
FX_DECLS_BEGIN;
enum fx_compressor_mode;
#define FX_TYPE_CSTREAM (fx_cstream_get_type())
FX_DECLARE_TYPE(fx_cstream);
FX_TYPE_CLASS_DECLARATION_BEGIN(fx_cstream)
FX_TYPE_CLASS_DECLARATION_END(fx_cstream)
FX_API fx_type_id fx_cstream_get_type(void);
FX_API fx_status fx_cstream_open(
fx_stream *endpoint,
fx_type_id compressor_type,
enum fx_compressor_mode mode,
fx_cstream **out);
FX_API fx_status
fx_cstream_read(fx_cstream *stream, void *buf, size_t count, size_t *nr_read);
FX_API fx_status fx_cstream_write(
fx_cstream *stream,
const void *buf,
size_t count,
size_t *nr_written);
FX_API fx_status
fx_cstream_skip(fx_cstream *stream, size_t count, size_t *nr_skipped);
FX_API fx_status fx_cstream_reset(fx_cstream *stream);
FX_API fx_status fx_cstream_begin_compressed_section(
fx_cstream *stream,
size_t *tx_uncompressed_bytes);
FX_API fx_status fx_cstream_end_compressed_section(
fx_cstream *stream,
size_t *tx_compressed_bytes,
size_t *tx_uncompressed_bytes);
FX_API bool fx_cstream_in_compressed_section(const fx_cstream *stream);
FX_API fx_status fx_cstream_tx_bytes(const fx_cstream *stream, size_t *out);
FX_API fx_status fx_cstream_tx_bytes_compressed(
const fx_cstream *stream,
size_t *out);
FX_API fx_status fx_cstream_tx_bytes_uncompressed(
const fx_cstream *stream,
size_t *out);
FX_API fx_status fx_cstream_set_cursor_position(fx_cstream *stream, size_t pos);
FX_API fx_status fx_cstream_restore_cursor_position(fx_cstream *stream);
FX_DECLS_END;
#endif