Torque2D Reference
Public Types | Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | List of all members
BufferStream Class Reference

#include <bufferStream.h>

+ Inheritance diagram for BufferStream:

Public Types

enum  { BUFFER_SIZE = 8 * 1024, BUFFER_INVALID = 0xffffffff }
 
- Public Types inherited from Stream
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

 BufferStream ()
 
virtual ~BufferStream ()
 
virtual bool hasCapability (const Capability i_cap) const
 Checks to see if this stream has the capability of a given function. More...
 
virtual U32 getPosition () const
 Gets the position in the stream. More...
 
virtual bool setPosition (const U32 i_newPosition)
 Sets the position of the stream. Returns if the new position is valid or not. More...
 
virtual U32 getStreamSize ()
 Gets the size of the stream. More...
 
virtual void close ()
 
virtual void open ()
 
U8 * getBuffer ()
 
U32 getBufferLength ()
 
- Public Member Functions inherited from Stream
 Stream ()
 
virtual ~Stream ()
 
Stream::Status getStatus () const
 Gets the status 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...
 

Protected Member Functions

virtual bool _read (const U32 i_numBytes, void *o_pBuffer)
 
virtual bool _write (const U32 i_numBytes, const void *i_pBuffer)
 
void init ()
 
bool fillBuffer (const U32 i_startPosition)
 
void clearBuffer ()
 
void setStatus ()
 
- Protected Member Functions inherited from Stream
void setStatus (const Status in_newStatus)
 

Static Protected Member Functions

static void calcBlockHead (const U32 i_position, U32 *o_blockHead)
 
static void calcBlockBounds (const U32 i_position, U32 *o_blockHead, U32 *o_blockTail)
 

Protected Attributes

U32 mBufferLen
 
U32 mReadPosition
 
U8 mBuffer [BUFFER_SIZE]
 

Additional Inherited Members

- Static Public Member Functions inherited from Stream
static const char * getStatusString (const Status in_status)
 Gets a printable string form of the status. More...
 

Member Enumeration Documentation

anonymous enum
Enumerator
BUFFER_SIZE 
BUFFER_INVALID 

Constructor & Destructor Documentation

~BufferStream ( )
virtual

Member Function Documentation

bool _read ( const U32  i_numBytes,
void *  o_pBuffer 
)
protectedvirtual

Implements Stream.

bool _write ( const U32  i_numBytes,
const void *  i_pBuffer 
)
protectedvirtual

Implements Stream.

static void calcBlockBounds ( const U32  i_position,
U32 *  o_blockHead,
U32 *  o_blockTail 
)
inlinestaticprotected
static void calcBlockHead ( const U32  i_position,
U32 *  o_blockHead 
)
inlinestaticprotected
void clearBuffer ( )
inlineprotected
void close ( )
virtual
bool fillBuffer ( const U32  i_startPosition)
inlineprotected
U8* getBuffer ( )
inline
U32 getBufferLength ( )
inline
virtual U32 getPosition ( ) const
inlinevirtual

Gets the position in the stream.

Implements Stream.

virtual U32 getStreamSize ( )
inlinevirtual

Gets the size of the stream.

Implements Stream.

virtual bool hasCapability ( const Capability  ) const
inlinevirtual

Checks to see if this stream has the capability of a given function.

Implements Stream.

void init ( )
protected
void open ( )
virtual
virtual bool setPosition ( const U32  in_newPosition)
inlinevirtual

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

Implements Stream.

void setStatus ( )
inlineprotected

Member Data Documentation

U8 mBuffer[BUFFER_SIZE]
protected
U32 mBufferLen
protected
U32 mReadPosition
protected

The documentation for this class was generated from the following files: