CrystalSpace

Public API Reference

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


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,
size_t  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.

size_t csDataStream::GetLength  ) 
 

Return the length of the stream.

size_t csDataStream::GetPosition  ) 
 

Return the current position.

bool csDataStream::GetString char *  buf,
size_t  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.

size_t csDataStream::Read void *  buf,
size_t  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 size_t  pos  ) 
 

Set the current position.

void csDataStream::Skip size_t  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.4.4