Torque2D Reference
|
Base stream class for streaming data across a specific media. More...
#include <stream.h>
Public Types | |
enum | Status { Ok = 0, IOError, EOS, IllegalCall, Closed, UnknownError } |
Status constantants for the stream. More... | |
enum | Capability { StreamWrite = BIT(0), StreamRead = BIT(1), StreamPosition = BIT(2) } |
Public Member Functions | |
Stream () | |
virtual | ~Stream () |
Stream::Status | getStatus () const |
Gets the status of the stream. More... | |
virtual bool | hasCapability (const Capability) const =0 |
Checks to see if this stream has the capability of a given function. More... | |
virtual U32 | getPosition () const =0 |
Gets the position in the stream. More... | |
virtual bool | setPosition (const U32 in_newPosition)=0 |
Sets the position of the stream. Returns if the new position is valid or not. More... | |
virtual U32 | getStreamSize ()=0 |
Gets the size of the stream. More... | |
void | readLine (U8 *buffer, U32 bufferSize) |
void | writeLine (U8 *buffer) |
writes a line to the stream More... | |
const char * | readSTString (bool casesens=false) |
virtual void | readString (char stringBuf[256]) |
Reads a string of maximum 255 characters long. More... | |
void | readLongString (U32 maxStringLen, char *stringBuf) |
void | writeLongString (U32 maxStringLen, const char *string) |
bool | Put (char character) |
virtual void | writeString (const char *stringBuf, S32 maxLen=255) |
Writes a string to the stream. More... | |
bool | writeFormattedBuffer (const char *format,...) |
bool | writeStringBuffer (const char *buffer) |
Writes a NULL terminated string buffer. More... | |
bool | write (const ColorI &) |
Write an integral color to the stream. More... | |
bool | write (const ColorF &) |
Write a floating point color to the stream. More... | |
bool | read (ColorI *) |
Read an integral color from the stream. More... | |
bool | read (ColorF *) |
Read a floating point color from the stream. More... | |
bool | read (const U32 in_numBytes, void *out_pBuffer) |
bool | write (const U32 in_numBytes, const void *in_pBuffer) |
bool | read (bool *out_pRead) |
bool | write (const bool &in_rWrite) |
bool | copyFrom (Stream *other) |
Copy the contents of another stream into this one. More... | |
void | writeTabs (U32 count) |
Write a number of tabs to this stream. More... | |
Static Public Member Functions | |
static const char * | getStatusString (const Status in_status) |
Gets a printable string form of the status. More... | |
Protected Member Functions | |
void | setStatus (const Status in_newStatus) |
virtual bool | _read (const U32 in_numBytes, void *out_pBuffer)=0 |
virtual bool | _write (const U32 in_numBytes, const void *in_pBuffer)=0 |
Base stream class for streaming data across a specific media.
enum Capability |
enum Status |
Status constantants for the stream.
Enumerator | |
---|---|
Ok |
Ok! |
IOError |
Read or Write error. |
EOS |
End of Stream reached (mostly for reads) |
IllegalCall |
An unsupported operation used. Always w/ accompanied by AssertWarn. |
Closed |
Tried to operate on a closed stream (or detached filter) |
UnknownError |
Catchall. |
Stream | ( | ) |
|
virtual |
|
protectedpure virtual |
Implemented in BitStream, ZipStatFilter, ZipSubWStream, FileStream, BufferStream, ZipSubRStream, ZipCryptRStream, ResizeFilterStream, MemStream, and FilterStream.
|
protectedpure virtual |
Implemented in BitStream, ZipStatFilter, ZipSubWStream, FileStream, BufferStream, MemStream, and FilterStream.
bool copyFrom | ( | Stream * | other | ) |
Copy the contents of another stream into this one.
|
pure virtual |
Gets the position in the stream.
Implemented in BitStream, ZipSubWStream, FileStream, ZipSubRStream, BufferStream, ResizeFilterStream, ZipCryptRStream, MemStream, and FilterStream.
|
inline |
Gets the status of the stream.
|
static |
Gets a printable string form of the status.
|
pure virtual |
Gets the size of the stream.
Implemented in BitStream, ZipSubWStream, ZipSubRStream, FileStream, BufferStream, ResizeFilterStream, MemStream, and FilterStream.
|
pure virtual |
Checks to see if this stream has the capability of a given function.
Implemented in BitStream, ZipSubWStream, FileStream, ZipSubRStream, BufferStream, MemStream, and FilterStream.
|
inline |
bool read | ( | ColorI * | pColor | ) |
Read an integral color from the stream.
bool read | ( | ColorF * | pColor | ) |
Read a floating point color from the stream.
|
inline |
|
inline |
void readLine | ( | U8 * | buffer, |
U32 | bufferSize | ||
) |
Reads a line from the stream.
buffer | buffer to be read into |
bufferSize | max size of the buffer. Will not read more than the "bufferSize" |
void readLongString | ( | U32 | maxStringLen, |
char * | stringBuf | ||
) |
Reads a string that could potentially be more than 255 characters long.
maxStringLen | Maximum length to read. If the string is longer than maxStringLen, only maxStringLen bytes will be read. |
stringBuf | buffer where data is read into |
|
virtual |
Reads a string of maximum 255 characters long.
Reimplemented in BitStream.
const char * readSTString | ( | bool | casesens = false | ) |
Reads a string and inserts it into the StringTable
|
pure virtual |
Sets the position of the stream. Returns if the new position is valid or not.
Implemented in BitStream, ZipSubWStream, FileStream, ZipSubRStream, ZipTempStream, BufferStream, ResizeFilterStream, ZipCryptRStream, MemStream, and FilterStream.
|
inlineprotected |
bool write | ( | const ColorI & | rColor | ) |
Write an integral color to the stream.
bool write | ( | const ColorF & | rColor | ) |
Write a floating point color to the stream.
|
inline |
|
inline |
bool writeFormattedBuffer | ( | const char * | format, |
... | |||
) |
Writes a formatted buffer to the stream. NOTE: A maximum string length of 4K is allowed.
void writeLine | ( | U8 * | buffer | ) |
writes a line to the stream
void writeLongString | ( | U32 | maxStringLen, |
const char * | string | ||
) |
Writes a string to the stream. This function is slightly unstable. Only use this if you have a valid string that is not empty. writeString is safer.
|
virtual |
Writes a string to the stream.
Reimplemented in BitStream.
|
inline |
Writes a NULL terminated string buffer.
|
inline |
Write a number of tabs to this stream.