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

# Class CL_InputSource_Memory

Interface to read data from a memory source.
Contained in: global
Derived from: CL_InputSource
Derived by: CL_InputSource_Raw
Group: Core (I/O Data)

#include <ClanLib/core.h>

### public function member index:

### Construction:

`` | `CL_InputSource_Memory` | `(`std::string` `data`)`;
``virtual`` | `~CL_InputSource_Memory` | `()`;

### Attributes:

``virtual` `int`` | `tell` | `() `const``;
``virtual` `int`` | `size` | `() `const``;
``std::string`` | `get_data` | `() `const``;

### Operations:

``virtual` `int`` | `read` | `(`void`* `data`, `int` `size`)`;
``virtual` `void`` | `open` | `()`;
``virtual` `void`` | `close` | `()`;
``virtual` `CL_InputSource`*` | `clone` | `() `const``;
``virtual` `void`` | `seek` | `(`int` `pos`, `SeekEnum` `seek_type`)`;
``virtual` `void`` | `push_position` | `()`;
``virtual` `void`` | `pop_position` | `()`;

## Description:

CL_InputSource_Memory is used to read data from a memory source.
CL_InputSourceProvider - Interface to open input sources with.

## Function Member Descriptions:

CL_InputSource_Memory::CL_InputSource_Memory - Input Source Memory Constructor
`` `CL_InputSource_Memory` `(`std::string` `data`)`;

CL_InputSource_Memory::clone - Make a copy of the current inputsource, standing at the same position.
``virtual` `CL_InputSource`*` `clone` `() `const``;

> Returns - The copy of the input source.

CL_InputSource_Memory::close - Closes the input source.
``virtual` `void`` `close` `()`;

CL_InputSource_Memory::get_data - Get the pointer to the internal data array in the memory source.
Used to extract the data after usage.
``std::string`` `get_data` `() `const``;

> Returns - Pointer to the data written.

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

CL_InputSource_Memory::pop_position - Pops a previous pushed input source position (returns to the position).
``virtual` `void`` `pop_position` `()`;

CL_InputSource_Memory::push_position - Pushes the current input source position.
The position can be restored again with pop_position.
``virtual` `void`` `push_position` `()`;

CL_InputSource_Memory::read - Reads larger amounts of data (no endian and 64 bit conversion).
``virtual` `int`` `read` `(`void`* `data`, `int` `size`)`;

> data - Points to an array where the read data is stored.
> size - Number of bytes to read.
> Returns - Num bytes actually read.

CL_InputSource_Memory::seek - Seeks to the specified position in the input source.
``virtual` `void`` `seek` `(`int` `pos`, `SeekEnum` `seek_type`)`;

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

CL_InputSource_Memory::size - Returns the size of the input source
``virtual` `int`` `size` `() `const``;

> Returns - Size of the input source.

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

> Returns - Current position in input source.

CL_InputSource_Memory::~CL_InputSource_Memory - Input Source Memory Destructor
``virtual`` `~CL_InputSource_Memory` `()`;

## Variable Member Descriptions: