|
Torque2D Reference
|
Base stream class for streaming data across a specific media. More...
#include <stream.h>
Inheritance diagram for Stream: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. | |
| virtual bool | hasCapability (const Capability) const =0 |
| Checks to see if this stream has the capability of a given function. | |
| virtual U32 | getPosition () const =0 |
| Gets the position in the stream. | |
| virtual bool | setPosition (const U32 in_newPosition)=0 |
| Sets the position of the stream. Returns if the new position is valid or not. | |
| virtual U32 | getStreamSize ()=0 |
| Gets the size of the stream. | |
| void | readLine (U8 *buffer, U32 bufferSize) |
| void | writeLine (U8 *buffer) |
| writes a line to the stream | |
| const char * | readSTString (bool casesens=false) |
| virtual void | readString (char stringBuf[256]) |
| Reads a string of maximum 255 characters long. | |
| 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. | |
| bool | writeFormattedBuffer (const char *format,...) |
| bool | writeStringBuffer (const char *buffer) |
| Writes a NULL terminated string buffer. | |
| bool | write (const ColorI &) |
| Write an integral color to the stream. | |
| bool | write (const ColorF &) |
| Write a floating point color to the stream. | |
| bool | read (ColorI *) |
| Read an integral color from the stream. | |
| bool | read (ColorF *) |
| Read a floating point color from the stream. | |
| bool | write (const NetAddress &) |
| Write a network address to the stream. | |
| bool | read (NetAddress *) |
| Read a network address from the stream. | |
| bool | write (const NetSocket &) |
| Write a network socket to the stream. | |
| bool | read (NetSocket *) |
| Read a network socket from the stream. | |
| 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. | |
| void | writeTabs (U32 count) |
| Write a number of tabs to this stream. | |
Static Public Member Functions | |
| static const char * | getStatusString (const Status in_status) |
| Gets a printable string form of the status. | |
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 BufferStream, FileStream, FilterStream, MemStream, ResizeFilterStream, ZipCryptRStream, ZipSubRStream, ZipSubWStream, ZipStatFilter, and BitStream.
|
protectedpure virtual |
Implemented in BufferStream, FileStream, FilterStream, MemStream, ZipSubWStream, ZipStatFilter, and BitStream.
| bool copyFrom | ( | Stream * | other | ) |
Copy the contents of another stream into this one.
|
pure virtual |
Gets the position in the stream.
Implemented in BitStream, BufferStream, FileStream, FilterStream, MemStream, ResizeFilterStream, ZipCryptRStream, ZipSubRStream, and ZipSubWStream.
|
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, BufferStream, FileStream, FilterStream, MemStream, ResizeFilterStream, ZipSubRStream, and ZipSubWStream.
|
pure virtual |
Checks to see if this stream has the capability of a given function.
Implemented in BufferStream, FileStream, BitStream, FilterStream, MemStream, ZipSubRStream, and ZipSubWStream.
|
inline |
|
inline |
| bool read | ( | ColorF * | pColor | ) |
Read a floating point color from the stream.
| bool read | ( | ColorI * | pColor | ) |
Read an integral color from the stream.
|
inline |
| bool read | ( | NetAddress * | na | ) |
Read a network address from the stream.
| bool read | ( | NetSocket * | so | ) |
Read a network socket from the stream.
| 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 BufferStream, FileStream, ZipTempStream, BitStream, FilterStream, MemStream, ResizeFilterStream, ZipCryptRStream, ZipSubRStream, and ZipSubWStream.
|
inlineprotected |
|
inline |
| bool write | ( | const ColorF & | rColor | ) |
Write a floating point color to the stream.
| bool write | ( | const ColorI & | rColor | ) |
Write an integral color to the stream.
| bool write | ( | const NetAddress & | na | ) |
Write a network address to the stream.
| bool write | ( | const NetSocket & | so | ) |
Write a network socket to the stream.
|
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.