StreamObject Class Reference [Zip Code]

#include <streamObject.h>

Inheritance diagram for StreamObject:

Inheritance graph
[legend]
List of all members.

Detailed Description

Script wrapper for the Stream class.

It is not possible to instantiate StreamObject in script. Instead, it is instantiated in C++ code and returned to script.

This was mainly intended to allow the zip code to provide the stream interface to script.


Public Member Functions

 StreamObject ()
 StreamObject (Stream *stream)
virtual ~StreamObject ()
 DECLARE_CONOBJECT (StreamObject)
virtual bool onAdd ()
 Called when the object is added to the sim.
void setStream (Stream *stream)
 Set the stream to allow reuse of the object.
StreamgetStream ()
 Get the underlying stream. Used with setStream() to support object reuse.
const char * getStatus ()
 Gets a printable string form of the status.
bool isEOS ()
U32 getPosition () const
 Gets the position in the stream.
bool setPosition (const U32 in_newPosition)
 Sets the position of the stream. Returns if the new position is valid or not.
U32 getStreamSize ()
 Gets the size of the stream.
const char * readLine ()
 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.
const char * readString ()
 Reads a string of maximum 255 characters long.
const char * readLongString (U32 maxStringLen)
 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.
void writeString (const char *stringBuf, S32 maxLen=255)
 Writes a string to the stream.
bool copyFrom (StreamObject *other)
 Copy the contents of another stream into this one.

Protected Attributes

StreammStream

Private Types

typedef SimObject Parent


Member Typedef Documentation

typedef SimObject StreamObject::Parent [private]

Reimplemented from SimObject.

Reimplemented in FileStreamObject.


Constructor & Destructor Documentation

StreamObject::StreamObject (  ) 

StreamObject::StreamObject ( Stream stream  ) 

virtual StreamObject::~StreamObject (  )  [virtual]


Member Function Documentation

StreamObject::DECLARE_CONOBJECT ( StreamObject   ) 

virtual bool StreamObject::onAdd (  )  [virtual]

Called when the object is added to the sim.

Reimplemented from SimObject.

Reimplemented in FileStreamObject.

void StreamObject::setStream ( Stream stream  )  [inline]

Set the stream to allow reuse of the object.

Stream* StreamObject::getStream (  )  [inline]

Get the underlying stream. Used with setStream() to support object reuse.

const char* StreamObject::getStatus (  ) 

Gets a printable string form of the status.

bool StreamObject::isEOS (  )  [inline]

U32 StreamObject::getPosition (  )  const [inline]

Gets the position in the stream.

bool StreamObject::setPosition ( const U32  in_newPosition  )  [inline]

Sets the position of the stream. Returns if the new position is valid or not.

U32 StreamObject::getStreamSize (  )  [inline]

Gets the size of the stream.

const char* StreamObject::readLine (  ) 

Reads a line from the stream.

void StreamObject::writeLine ( U8 buffer  )  [inline]

Writes a line to the stream.

const char* StreamObject::readSTString ( bool  casesens = false  )  [inline]

Reads a string and inserts it into the StringTable.

See also:
StringTable

const char* StreamObject::readString (  ) 

Reads a string of maximum 255 characters long.

const char* StreamObject::readLongString ( U32  maxStringLen  ) 

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 StreamObject::writeLongString ( U32  maxStringLen,
const char *  string 
) [inline]

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.

void StreamObject::writeString ( const char *  stringBuf,
S32  maxLen = 255 
) [inline]

Writes a string to the stream.

bool StreamObject::copyFrom ( StreamObject other  )  [inline]

Copy the contents of another stream into this one.


Member Data Documentation