lt_ioCStream.h File Reference

#include "lt_base.h"
#include "lt_lib_io.h"
#include "lt_ioCallbackStreamTypes.h"

Include dependency graph for lt_ioCStream.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

C functions for operating on streams
These functions are C-callable analogues to the member functions in the LTIOStreamInf class.

LT_STATUS lt_ioCStreamDestroy (LTIOStreamH stream)
 destructor for C stream
LT_STATUS lt_ioCStreamOpen (LTIOStreamH stream)
 open C stream
LT_STATUS lt_ioCStreamClose (LTIOStreamH stream)
 close C stream
lt_uint32 lt_ioCStreamRead (LTIOStreamH stream, lt_uint8 *buf, lt_uint32 len)
 read C stream
lt_uint32 lt_ioCStreamWrite (LTIOStreamH stream, const lt_uint8 *buf, lt_uint32 len)
 write C stream
LT_STATUS lt_ioCStreamSeek (LTIOStreamH stream, lt_int64 offset, LTIOSeekDir dir)
 seek for C stream
lt_int64 lt_ioCStreamTell (LTIOStreamH stream)
 tell for C stream
lt_uint8 lt_ioCStreamIsEOF (LTIOStreamH stream)
 is end-of-file? for C stream
lt_uint8 lt_ioCStreamIsOpen (LTIOStreamH stream)
 is open? for C stream
LTIOStreamH lt_ioCStreamDuplicate (LTIOStreamH stream)
 duplicate C stream
LTIOStreamH lt_ioCallbackStreamCreate (LTIOCallbackStream_Open open, LTIOCallbackStream_Close close, LTIOCallbackStream_Read read, LTIOCallbackStream_Write write, LTIOCallbackStream_Seek seek, LTIOCallbackStream_Tell tell, LTIOCallbackStream_IsEOF isEOF, LTIOCallbackStream_IsOpen isOpen, LTIOCallbackStream_Duplicate duplicate, void *userData)
 create callback stream


Function Documentation

Create an LTIOCallbackStream, via C API. The parameters correspond to those used in LTIOCallbackStream::initialize().

Parameters:
open user's open function
close user's close function
read user's read function
write user's write function
seek user's seek function
tell user's tell function
isEOF user's isEOF function
isOpen user's isOpen function
duplicate user's duplicate function
userData user's stream data
Returns:
the created stream
Examples:
UsingCStream.c.

LT_STATUS lt_ioCStreamClose ( LTIOStreamH  stream  ) 

Closes a C stream. Note that lt_ioCStreamDestroy() must be called once the stream is no longer needed.

This function is equivalent to LTIOStreamInf::close().

Parameters:
stream stream to be closed
Returns:
success/failure code
Examples:
UsingCStream.c.

LT_STATUS lt_ioCStreamDestroy ( LTIOStreamH  stream  ) 

This function must be called once the stream is no longer needed to free up the stream's allocated resources, i.e. it calls the destructor of the underlying LTIOCallbackStream.

Parameters:
stream stream to be freed
Returns:
success/failure code

LTIOStreamH lt_ioCStreamDuplicate ( LTIOStreamH  stream  ) 

Duplicate a C stream.

This function is equivalent to LTIOStreamInf::duplicate().

Parameters:
stream stream to duplicate
Returns:
the new stream (or NULL if cannot duplicate)
Examples:
UsingCStream.c.

lt_uint8 lt_ioCStreamIsEOF ( LTIOStreamH  stream  ) 

Check for EOF on a C stream.

This function is equivalent to LTIOStreamInf::isEOF().

Parameters:
stream stream to query
Returns:
true (1), iff the stream is at EOF

lt_uint8 lt_ioCStreamIsOpen ( LTIOStreamH  stream  ) 

Check for open on a C stream.

This function is equivalent to LTIOStreamInf::isOpen().

Parameters:
stream stream to query
Returns:
true (1) iff the stream is open

LT_STATUS lt_ioCStreamOpen ( LTIOStreamH  stream  ) 

Opens a previously-created C stream.

This function is equivalent to LTIOStreamInf::open().

Parameters:
stream stream to be opened
Returns:
success/failure code
Examples:
UsingCStream.c.

lt_uint32 lt_ioCStreamRead ( LTIOStreamH  stream,
lt_uint8 buf,
lt_uint32  len 
)

Read from a C stream.

This function is equivalent to LTIOStreamInf::read().

Parameters:
stream stream to read from
buf buffer to read into
len number of bytes to read
Returns:
number of bytes read
Examples:
UsingCStream.c.

LT_STATUS lt_ioCStreamSeek ( LTIOStreamH  stream,
lt_int64  offset,
LTIOSeekDir  dir 
)

Seek on a C stream.

This function is equivalent to LTIOStreamInf::seek().

Parameters:
stream stream to be seek on
offset distance to seek
dir seek direction
Returns:
success/failure code
Examples:
UsingCStream.c.

lt_int64 lt_ioCStreamTell ( LTIOStreamH  stream  ) 

Tell on a C stream.

This function is equivalent to LTIOStreamInf::tell().

Parameters:
stream stream to get offset of
Returns:
stream's current offset
Examples:
UsingCStream.c.

lt_uint32 lt_ioCStreamWrite ( LTIOStreamH  stream,
const lt_uint8 buf,
lt_uint32  len 
)

Write to a C stream.

This function is equivalent to LTIOStreamInf::write().

Parameters:
stream stream to be written to
buf buffer to write from
len number of bytes to write
Returns:
number of bytes written


LizardTech