Reference

CL_InputSource(3)

Interface to read data.

NAME

CL_InputSource - Interface to read data.

DESCRIPTION

CL_InputSource is used to read data from different types of input sources. In most cases, this is regular files and ClanLib zlib compressed datafiles.

To access some system specific input source types, such as datafiles and regular ones, use the static create functions in the CL_InputSourceProvider class.

CLASS MEMBERS

virtual ~CL_InputSource()
virtual void set_system_mode()
virtual void set_big_endian_mode()
virtual void set_little_endian_mode()
virtual int read_int32()
virtual unsigned int read_uint32()
virtual short read_short16()
virtual unsigned short read_ushort16()
virtual char read_char8()
virtual unsigned char read_uchar8()
virtual float read_float32()
virtual int read(
void *data,
int size)

virtual void open()
virtual void close()
virtual CL_InputSource *clone()
enum SeekEnum(
 seek_set,	seek_cur,	seek_end	)

virtual int tell()
virtual void seek(
int pos,
SeekEnum seek_type)

virtual int size()
virtual std::string read_string()
virtual void push_position()
virtual void pop_position()

MEMBERS WITH DESCRIPTIONS

virtual ~CL_InputSource()
Description:

virtual void set_system_mode()
Description:

Changes input data endianess to the local systems mode.

virtual void set_big_endian_mode()
Description:

Changes input data endianess to big endian mode.

virtual void set_little_endian_mode()
Description:

Changes input data endianess to little endian mode. This is the default setting.

virtual int read_int32()
Description:

Reads a signed 32 bit integer from input source.

Return value:

The integer read.

virtual unsigned int read_uint32()
Description:

Reads a unsigned 32 bit integer from input source.

Return value:

The unsigned integer read.

virtual short read_short16()
Description:

Reads a signed 16 bit integer (short) from input source.

Return value:

The short read.

virtual unsigned short read_ushort16()
Description:

Reads a unsigned 16 bit integer (short) from input source.

Return value:

The unsigned short read.

virtual char read_char8()
Description:

Reads a signed 8 bit integer (char) from input source.

Return value:

The char read.

virtual unsigned char read_uchar8()
Description:

Reads a unsigned 8 bit integer (char) from input source.

Return value:

The unsigned char read.

virtual float read_float32()
Description:

Reads an ieee format floating point from input source.

Return value:

The float read.

virtual int read(
void *data,
int size)

Parameters:
data - Points to an array where the read data is stored.
size - Number of bytes to read.

Description:

Reads larger amounts of data (no endian and 64 bit conversion).

Return value:

Num bytes actually read.

virtual void open()
Description:

Opens the input source. By default, it is open.

virtual void close()
Description:

Closes the input source.

virtual CL_InputSource *clone()
Description:

Make a copy of the current InputSource, standing at the same position.

Return value:

The clone of the input source.

enum SeekEnum(
 seek_set,	seek_cur,	seek_end	)

Description:

virtual int tell()
Description:

Returns current position in input source.

Return value:

Current position in input source.

virtual void seek(
int pos,
SeekEnum seek_type)

Parameters:
pos - Position relative to 'seek_type'.
seek_type - Defines what the 'pos' is relative to. Can be either seek_set, seek_cur og seek_end.

Description:

Seeks to the specified position in the input source.

virtual int size()
Description:

Returns the size of the input source

Return value:

Size of the input source.

virtual std::string read_string()
Description:

Reads a string from the input source.

The binary format expected in the input source is first an uint32 telling the length of the string, and then the string itself.

Return value:

The string read.

virtual void push_position()
Description:

Pushes the current input source position. The position can be restored again with pop_position.

virtual void pop_position()
Description:

Pops a previous pushed input source position (returns to the position).

SEE ALSO

CL_InputSourceProvider

Interface to open input sources with.

All ClanLib API classes can be found in clanlib (3).

AUTHORS

Originally written by Magnus Norddahl <[email protected]> and Martin Starch <[email protected]>. ClanLib is now developed by the ClanLib Development team as an Open Source project.

The ClanLib man pages was created using the Perceps documentation system (another excellent piece of Open Source software, available at http://somewhere.in.the.world.org).

See clanlib (3) to find out how to get a full list of contributors and details on how to submit bug reports, comments etc.