Torque2D Reference
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | List of all members
FileStream Class Reference

#include <fileStream.h>

+ Inheritance diagram for FileStream:

Public Types

enum  AccessMode { Read = File::Read , Write = File::Write , ReadWrite = File::ReadWrite , WriteAppend = File::WriteAppend }
 
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

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

Protected Member Functions

 FileStream (const FileStream &i_fileStrm)
 
FileStreamoperator= (const FileStream &i_fileStrm)
 
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

File mFile
 
U32 mStreamCaps
 
U8 mBuffer [BUFFER_SIZE]
 
U32 mBuffHead
 
U32 mBuffPos
 
U32 mBuffTail
 
bool mDirty
 
bool mEOF
 

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.
 

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
BUFFER_SIZE 
BUFFER_INVALID 

◆ AccessMode

enum AccessMode
Enumerator
Read 
Write 
ReadWrite 
WriteAppend 

Constructor & Destructor Documentation

◆ FileStream() [1/2]

FileStream ( const FileStream i_fileStrm)
protected

◆ FileStream() [2/2]

◆ ~FileStream()

~FileStream ( )
virtual

Member Function Documentation

◆ _read()

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

Implements Stream.

◆ _write()

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

Implements Stream.

◆ calcBlockBounds()

void calcBlockBounds ( const U32  i_position,
U32 *  o_blockHead,
U32 *  o_blockTail 
)
staticprotected

◆ calcBlockHead()

void calcBlockHead ( const U32  i_position,
U32 *  o_blockHead 
)
staticprotected

◆ clearBuffer()

void clearBuffer ( )
protected

◆ close()

void close ( )
virtual

Reimplemented in ZipTempStream.

◆ fillBuffer()

bool fillBuffer ( const U32  i_startPosition)
protected

◆ Flush()

bool Flush ( )

◆ getPosition()

U32 getPosition ( ) const
virtual

Gets the position in the stream.

Implements Stream.

◆ getStreamSize()

U32 getStreamSize ( )
virtual

Gets the size of the stream.

Implements Stream.

◆ hasCapability()

bool hasCapability ( const Capability  ) const
virtual

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

Implements Stream.

◆ init()

void init ( )
protected

◆ open()

bool open ( const char *  i_pFilename,
AccessMode  i_openMode 
)
virtual

Reimplemented in ZipTempStream.

◆ operator=()

FileStream & operator= ( const FileStream i_fileStrm)
protected

◆ setPosition()

bool setPosition ( const U32  in_newPosition)
virtual

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

Implements Stream.

Reimplemented in ZipTempStream.

◆ setStatus()

void setStatus ( )
protected

Member Data Documentation

◆ mBuffer

U8 mBuffer[BUFFER_SIZE]
protected

◆ mBuffHead

U32 mBuffHead
protected

◆ mBuffPos

U32 mBuffPos
protected

◆ mBuffTail

U32 mBuffTail
protected

◆ mDirty

bool mDirty
protected

◆ mEOF

bool mEOF
protected

◆ mFile

File mFile
protected

◆ mStreamCaps

U32 mStreamCaps
protected

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