Home | Namespaces | Hierarchy | Alphabetical List | Class list | Files | Namespace Members | Class members | File members |
#include <DataStream.h>
Public Member Functions | |
DataStream () | |
virtual bool | eof ()=0 |
Returns true if the buffer pointer has reached the end of the buffer. | |
virtual std::string | getLine (bool trimAfter=true) |
virtual u32 | read (void *buffer, u32 size, u32 count)=0 |
virtual u32 | read (void *buffer, u32 size)=0 |
virtual u32 | readLine (char *buffer, u32 size, const std::string &delim="\n") |
virtual void | seek (u32 pos)=0 |
Repositions the internal read pointer to a specified byte. | |
u32 | size () const |
Returns the size of the allocated chunk in bytes. | |
virtual void | skip (s32 offset)=0 |
virtual u32 | skipLine (const std::string &delim="\n") |
Skip a single line from the stream. | |
virtual u32 | tell () const =0 |
Returns the current byte offset from beginning. | |
virtual | ~DataStream () |
Protected Attributes | |
u32 | mSize |
General purpose class used for encapsulating a stream of data.
This class simply wraps a stream of data. It provides extra info about the size of the data contained within it, simple close method, and simple stream-like 'read' methods for parsing through the data stream.
resource::DataStream::DataStream | ( | ) |
References mSize.
resource::DataStream::~DataStream | ( | ) | [virtual] |
virtual bool resource::DataStream::eof | ( | ) | [pure virtual] |
Returns true if the buffer pointer has reached the end of the buffer.
Implemented in resource::MemoryDataStream, and resource::FileDataStream.
std::string resource::DataStream::getLine | ( | bool | trimAfter = true | ) | [virtual] |
Returns a String containing the next line of data, optionally trimmed for whitespace. This is a convenience method for text streams only, allowing you to retrieve a String object containing the next line of data.
References GAME_STREAM_TEMP_SIZE, read(), skip(), and core::stringTrim().
Referenced by resource::Serializer::readString().
Reads the data stream into a buffer.
buffer,: | Pointer to buffer to read into |
size,: | Number of bytes to read |
Implemented in resource::MemoryDataStream, and resource::FileDataStream.
Referenced by getLine(), resource::MemoryDataStream::MemoryDataStream(), resource::Serializer::readBools(), resource::Serializer::readFloats(), readLine(), resource::Serializer::readLongs(), resource::Serializer::readShorts(), and skipLine().
Implemented in resource::MemoryDataStream, and resource::FileDataStream.
u32 resource::DataStream::readLine | ( | char * | buffer, |
u32 | size, | ||
const std::string & | delim = "\n" |
||
) | [virtual] |
Reads a line from the data stream into a buffer.
buffer,: | Pointer to buffer to read into |
size,: | Max number of bytes to read |
delim,: | The delimiter to stop at |
Reimplemented in resource::MemoryDataStream.
References GAME_STREAM_TEMP_SIZE, read(), and skip().
virtual void resource::DataStream::seek | ( | u32 | pos | ) | [pure virtual] |
Repositions the internal read pointer to a specified byte.
Implemented in resource::MemoryDataStream, and resource::FileDataStream.
u32 resource::DataStream::size | ( | ) | const |
Returns the size of the allocated chunk in bytes.
References mSize.
Referenced by resource::Resource::initProperties(), resource::Resource::load(), resource::MemoryDataStream::MemoryDataStream(), and resource::MemoryDataStream::read().
virtual void resource::DataStream::skip | ( | s32 | offset | ) | [pure virtual] |
Moves the internal read pointer backwards or forwards by the number of bytes specified. The sign of the parameter determines the direction of the skip.
Implemented in resource::MemoryDataStream, and resource::FileDataStream.
Referenced by getLine(), readLine(), and skipLine().
u32 resource::DataStream::skipLine | ( | const std::string & | delim = "\n" | ) | [virtual] |
Skip a single line from the stream.
Reimplemented in resource::MemoryDataStream.
References GAME_STREAM_TEMP_SIZE, read(), and skip().
virtual u32 resource::DataStream::tell | ( | ) | const [pure virtual] |
Returns the current byte offset from beginning.
Implemented in resource::MemoryDataStream, and resource::FileDataStream.
u32 resource::DataStream::mSize [protected] |
The KG Game Engine
Documentation © 2006-2011 by Kat'Oun. Generated on Sat Jul 2 2011 00:50:09 by
Doxygen
(1.7.4)
|