Entire Class Index | Main Class Index | Cross Index | Global Index

# Class CL_OutputSource

Interface to write data to different types of output sources.
Contained in: global
Derived from: none
Derived by: CL_OutputSource_File CL_OutputSource_Memory CL_OutputSource_NetPacket CL_OutputSource_NetStream CL_OutputSource_Socket CL_OutputSource_Socket CL_OutputSource_Zipped
Group: Core (I/O Data)

#include <ClanLib/core.h>

### public function member index:

### Construction:

`` | `CL_OutputSource` | `()`;
``virtual`` | `~CL_OutputSource` | `()`;

### Attributes:

``virtual` `int`` | `tell` | `() `const``;
``virtual` `int`` | `size` | `() `const``;

### Operations:

``virtual` `void`` | `set_system_mode` | `()`;
``virtual` `void`` | `set_big_endian_mode` | `()`;
``virtual` `void`` | `set_little_endian_mode` | `()`;
``virtual` `void`` | `write_int32` | `(`int` `data`)`;
``virtual` `void`` | `write_uint32` | `(`unsigned` `int` `data`)`;
``virtual` `void`` | `write_short16` | `(`short` `data`)`;
``virtual` `void`` | `write_ushort16` | `(`unsigned` `short` `data`)`;
``virtual` `void`` | `write_char8` | `(`char` `data`)`;
``virtual` `void`` | `write_uchar8` | `(`unsigned` `char` `data`)`;
``virtual` `void`` | `write_float32` | `(`float` `data`)`;
``virtual` `void`` | `write_bool8` | `(`bool` `data`)`;
``virtual` `void`` | `write_string` | `(`const` `std::string`& `str`)`;
``virtual` `int`` | `write` | `(`const` `void`* `data`, `int` `size`)`;
``virtual` `void`` | `open` | `()`;
``virtual` `void`` | `close` | `()`;
``virtual` `CL_OutputSource`*` | `clone` | `()`;

## Description:

CL_OutputSource is used to write data to different types of input sources. In most cases, this is regular files and ClanLib zlib compressed datafiles.
To access some system specific output source types, such as datafiles and regular ones, use the static create functions in the CL_OutputSourceProvider class.
CL_OutputSourceProvider - Interface to open output sources with.

## Function Member Descriptions:

CL_OutputSource::CL_OutputSource - Output Source Constructor
`` `CL_OutputSource` `()`;

CL_OutputSource::clone - Make a copy of the current outputsource, standing at the same position.
``virtual` `CL_OutputSource`*` `clone` `()`;

> Returns - The copy of the output source.

CL_OutputSource::close - Closes the output source.
``virtual` `void`` `close` `()`;

CL_OutputSource::open - Opens the output source. By default, it is open.
``virtual` `void`` `open` `()`;

CL_OutputSource::set_big_endian_mode - Changes output data endianess to big endian mode.
``virtual` `void`` `set_big_endian_mode` `()`;

CL_OutputSource::set_little_endian_mode - Changes output data endianess to little endian mode. This is the default setting.
``virtual` `void`` `set_little_endian_mode` `()`;

CL_OutputSource::set_system_mode - Changes output data endianess to the local systems mode.
``virtual` `void`` `set_system_mode` `()`;

CL_OutputSource::size - Returns the size of the output source
``virtual` `int`` `size` `() `const``;

> Returns - Size of the output source.

CL_OutputSource::tell - Returns current position in output source.
``virtual` `int`` `tell` `() `const``;

> Returns - Current position in source.

CL_OutputSource::write - Writes larger amounts of data (no endian and 64 bit conversion):
``virtual` `int`` `write` `(`const` `void`* `data`, `int` `size`)`;

> data - Points to the array from which to write.
> size - Number of bytes to write.
> Returns - Num bytes actually written.

CL_OutputSource::write_bool8 - Writes a bool to output source.
``virtual` `void`` `write_bool8` `(`bool` `data`)`;

CL_OutputSource::write_char8 - Writes a signed 8 bit integer (char) to output source.
``virtual` `void`` `write_char8` `(`char` `data`)`;

CL_OutputSource::write_float32 - Writes an ieee format floating point to output source.
``virtual` `void`` `write_float32` `(`float` `data`)`;

CL_OutputSource::write_int32 - Writes a signed 32 bit integer to output source.
``virtual` `void`` `write_int32` `(`int` `data`)`;

CL_OutputSource::write_short16 - Writes a signed 16 bit integer (short) to output source.
``virtual` `void`` `write_short16` `(`short` `data`)`;

CL_OutputSource::write_string - Writes a string to the output source.
The binary format written to the output source is first an uint32 telling the length of the string, and then the string itself.
``virtual` `void`` `write_string` `(`const` `std::string`& `str`)`;

CL_OutputSource::write_uchar8 - Writes an unsigned 8 bit integer (char) to output source.
``virtual` `void`` `write_uchar8` `(`unsigned` `char` `data`)`;

CL_OutputSource::write_uint32 - Writes an unsigned 32 bit integer to output source.
``virtual` `void`` `write_uint32` `(`unsigned` `int` `data`)`;

CL_OutputSource::write_ushort16 - Writes an unsigned 16 bit integer (short) to output source.
``virtual` `void`` `write_ushort16` `(`unsigned` `short` `data`)`;

CL_OutputSource::~CL_OutputSource - Output Source Destructor
``virtual`` `~CL_OutputSource` `()`;

## Variable Member Descriptions: