Stream Class Reference#include <stream.h>
Inheritance diagram for Stream:
[legend]
Detailed Description
Base stream class for streaming data across a specific media.
|
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) |
| Reads a line from the stream.
|
void | writeLine (U8 *buffer) |
| writes a line to the stream
|
const char * | readSTString (bool casesens=false) |
| Reads a string and inserts it into the StringTable.
|
virtual void | readString (char stringBuf[256]) |
| Reads a string of maximum 255 characters long.
|
void | readLongString (U32 maxStringLen, char *stringBuf) |
| Reads a string that could potentially be more than 255 characters long.
|
void | writeLongString (U32 maxStringLen, const char *string) |
| Writes a string to the stream.
|
virtual void | writeString (const char *stringBuf, S32 maxLen=255) |
| Writes a string to the stream.
|
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 | 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) |
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 |
Private Attributes |
Status | m_streamStatus |
Member Enumeration Documentation
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. |
- Enumerator:
-
StreamWrite |
Can this stream write? |
StreamRead |
Can this stream read? |
StreamPosition |
Can this stream position? |
Constructor & Destructor Documentation
virtual Stream::~Stream |
( |
|
) |
[virtual] |
Member Function Documentation
void Stream::setStatus |
( |
const Status |
in_newStatus |
) |
[inline, protected] |
Gets the status of the stream.
static const char* Stream::getStatusString |
( |
const Status |
in_status |
) |
[static] |
Gets a printable string form of the status.
virtual bool Stream::_read |
( |
const U32 |
in_numBytes, |
|
|
void * |
out_pBuffer | |
|
) |
| | [protected, pure virtual] |
virtual bool Stream::_write |
( |
const U32 |
in_numBytes, |
|
|
const void * |
in_pBuffer | |
|
) |
| | [protected, pure virtual] |
virtual bool Stream::hasCapability |
( |
const |
Capability |
) |
const [pure virtual] |
virtual U32 Stream::getPosition |
( |
|
) |
const [pure virtual] |
virtual bool Stream::setPosition |
( |
const U32 |
in_newPosition |
) |
[pure virtual] |
virtual U32 Stream::getStreamSize |
( |
|
) |
[pure virtual] |
void Stream::readLine |
( |
U8 * |
buffer, |
|
|
U32 |
bufferSize | |
|
) |
| | |
Reads a line from the stream.
- Parameters:
-
| buffer | buffer to be read into |
| bufferSize | max size of the buffer. Will not read more than the "bufferSize" |
void Stream::writeLine |
( |
U8 * |
buffer |
) |
|
writes a line to the stream
const char* Stream::readSTString |
( |
bool |
casesens = false |
) |
|
Reads a string and inserts it into the StringTable.
- See also:
- StringTable
virtual void Stream::readString |
( |
char |
stringBuf[256] |
) |
[virtual] |
Reads a string of maximum 255 characters long.
Reimplemented in BitStream.
void Stream::readLongString |
( |
U32 |
maxStringLen, |
|
|
char * |
stringBuf | |
|
) |
| | |
Reads a string that could potentially be more than 255 characters long.
- Parameters:
-
| 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 |
void Stream::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 void Stream::writeString |
( |
const char * |
stringBuf, |
|
|
S32 |
maxLen = 255 | |
|
) |
| | [virtual] |
Writes a string to the stream.
Reimplemented in BitStream.
bool Stream::write |
( |
const ColorI & |
|
) |
|
Write an integral color to the stream.
bool Stream::write |
( |
const ColorF & |
|
) |
|
Write a floating point color to the stream.
bool Stream::read |
( |
ColorI * |
|
) |
|
Read an integral color from the stream.
bool Stream::read |
( |
ColorF * |
|
) |
|
Read a floating point color from the stream.
bool Stream::read |
( |
const U32 |
in_numBytes, |
|
|
void * |
out_pBuffer | |
|
) |
| | [inline] |
bool Stream::write |
( |
const U32 |
in_numBytes, |
|
|
const void * |
in_pBuffer | |
|
) |
| | [inline] |
bool Stream::read |
( |
bool * |
out_pRead |
) |
[inline] |
bool Stream::write |
( |
const bool & |
in_rWrite |
) |
[inline] |
Field Documentation
|