Stream Class Reference#include <stream.h>
Inheritance diagram for Stream:
[legend]List of all members.
Detailed Description
Base stream class for streaming data across a specific media.
|
Public Types |
| Ok = 0 |
| 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.
|
| StreamWrite = BIT(0) |
| Can this stream write?
|
| StreamRead = BIT(1) |
| Can this stream read?
|
| StreamPosition = BIT(2) |
| Can this stream position?
|
enum | Status {
Ok = 0,
IOError,
EOS,
IllegalCall,
Closed,
UnknownError
} |
| Status constants 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 (const 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.
|
void | write (const String &str) |
void | read (String *str) |
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 RawData &) |
| Write some raw data onto the stream.
|
bool | read (RawData *) |
| Read some raw data from the stream.
|
bool | write (const Torque::ByteBuffer &) |
| Write some raw data onto the stream.
|
bool | read (Torque::ByteBuffer *) |
| Read some raw data 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 |
virtual void | _write (const String &str) |
virtual void | _read (String *str) |
Private Attributes |
Status | m_streamStatus |
Member Enumeration Documentation
Status constants 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 |
( |
|
) |
[inline, 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 void Stream::_write |
( |
const String & |
str |
) |
[protected, virtual] |
virtual void Stream::_read |
( |
String * |
str |
) |
[protected, virtual] |
virtual bool Stream::hasCapability |
( |
const |
Capability |
) |
const [pure virtual] |
Checks to see if this stream has the capability of a given function.
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 |
( |
const 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.
void Stream::write |
( |
const String & |
str |
) |
[inline] |
Write an integral color to the stream.
Write a floating point color to the stream.
Read an integral color from the stream.
Read a floating point color from the stream.
Write a network address to the stream.
Read a network address from the stream.
Write some raw data onto the stream.
Read some raw data from the stream.
Write some raw data onto the stream.
Read some raw data 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] |
Copy the contents of another stream into this one.
void Stream::writeTabs |
( |
U32 |
count |
) |
[inline] |
Write a number of tabs to this stream.
Member Data Documentation
|