CrystalSpace

Public API Reference

Main Page | Modules | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages

csDataStream Class Reference

This class can be used as a wrapper around a data buffer for easy stream-like access. More...

#include <csutil/datastrm.h>

List of all members.

Public Member Functions

 csDataStream (void *buf, int Size, bool DeleteBuffer=true)
 constructor
 ~csDataStream ()
 destructor
int GetPosition ()
 Return the current position.
void SetPosition (int pos)
 Set the current position.
int GetLength ()
 Return the length of the stream.
bool Finished ()
 Returns true if the stream has finished.
void Skip (int num)
 Skip the given amount of bytes.
int Read (void *buf, int NumBytes)
 Read a buffer of data. Returns the number of bytes actually read.
bool ReadInt8 (int8 &val)
 Read a one-byte value. Returns false on EOF.
bool ReadUInt8 (uint8 &val)
 Read an unsigned one-byte value. Returns false on EOF.
bool ReadInt16 (int16 &val)
 Read a two-byte value.
bool ReadUInt16 (uint16 &val)
 Read an unsigned two-byte value. Returns false on EOF.
bool ReadInt32 (int32 &val)
 Read a four-byte value.
bool ReadUInt32 (uint32 &val)
 Read an unsigned four-byte value. Returns false on EOF.
int GetChar ()
 Read a single character. Returns EOF if the stream has finished.
int LookChar ()
 Return the next character (or EOF), but don't move forward.
bool GetString (char *buf, int len, bool OmitNewline=true)
 Read a line of text.
int ReadTextInt ()
 Read an integer value from the stream that is stored as ASCII.
float ReadTextFloat ()
 Read a floating-point value from the stream that is stored as ASCII.
void SkipWhitespace ()
 Skip any whitespace characters.


Detailed Description

This class can be used as a wrapper around a data buffer for easy stream-like access.

Definition at line 30 of file datastrm.h.


Constructor & Destructor Documentation

csDataStream::csDataStream void *  buf,
int  Size,
bool  DeleteBuffer = true
 

constructor

csDataStream::~csDataStream  ) 
 

destructor


Member Function Documentation

bool csDataStream::Finished  ) 
 

Returns true if the stream has finished.

int csDataStream::GetChar  ) 
 

Read a single character. Returns EOF if the stream has finished.

int csDataStream::GetLength  ) 
 

Return the length of the stream.

int csDataStream::GetPosition  ) 
 

Return the current position.

bool csDataStream::GetString char *  buf,
int  len,
bool  OmitNewline = true
 

Read a line of text.

Returns false if the stream has finished. If 'OmitNewline' is true then the newline character will be thrown away.

int csDataStream::LookChar  ) 
 

Return the next character (or EOF), but don't move forward.

int csDataStream::Read void *  buf,
int  NumBytes
 

Read a buffer of data. Returns the number of bytes actually read.

bool csDataStream::ReadInt16 int16 val  ) 
 

Read a two-byte value.

bool csDataStream::ReadInt32 int32 val  ) 
 

Read a four-byte value.

bool csDataStream::ReadInt8 int8 val  ) 
 

Read a one-byte value. Returns false on EOF.

float csDataStream::ReadTextFloat  ) 
 

Read a floating-point value from the stream that is stored as ASCII.

int csDataStream::ReadTextInt  ) 
 

Read an integer value from the stream that is stored as ASCII.

bool csDataStream::ReadUInt16 uint16 val  ) 
 

Read an unsigned two-byte value. Returns false on EOF.

bool csDataStream::ReadUInt32 uint32 val  ) 
 

Read an unsigned four-byte value. Returns false on EOF.

bool csDataStream::ReadUInt8 uint8 val  ) 
 

Read an unsigned one-byte value. Returns false on EOF.

void csDataStream::SetPosition int  pos  ) 
 

Set the current position.

void csDataStream::Skip int  num  ) 
 

Skip the given amount of bytes.

void csDataStream::SkipWhitespace  ) 
 

Skip any whitespace characters.


The documentation for this class was generated from the following file:
Generated for Crystal Space by doxygen 1.3.9.1