#include <gauge3d/files/istream.h>
Inherits GAUGE3D::GObject.
Public Types | |
enum | tSeekType { BEGINNING, CURRENT, END } |
Position to seek relative to. Used by Seek(). More... | |
enum | tReadMode { BINARY, ASCII } |
Read mode specifiers for ReadMode(). More... | |
enum | tEndianness { BIG, LITTLE } |
Endianness specifiers for Endianness(). More... | |
enum | tNumberBase { OCT = 8, DEC = 10, HEX = 16 } |
Number base specifiers for NumberBase(). More... | |
Public Methods | |
GIStream (pGRawIStream streamSource) | |
Create a buffered input stream. More... | |
GIStream (pGRawIStream streamSource,int bufferSize) | |
Create a possibly buffered input stream with a given buffer size. More... | |
~GIStream () | |
Destructor. | |
void | Seek (int pos,tSeekType seekType) |
Seek the stream position. More... | |
int | TellPos () |
Get the distance in bytes between the beginning of the stream and the current position. | |
int | Read (uint64 *target,int num=1) |
Read one or more uint64's into the target buffer. Returns the number successfully read. | |
int | Read (uint32 *target,int num=1) |
Read one or more uint32's into the target buffer. Returns the number successfully read. | |
int | Read (uint16 *target,int num=1) |
Read one or more uint16's into the target buffer. Returns the number successfully read. | |
int | Read (int64 *target,int num=1) |
Read one or more int64's into the target buffer. Returns the number successfully read. | |
int | Read (int32 *target,int num=1) |
Read one or more int32's into the target buffer. Returns the number successfully read. | |
int | Read (int16 *target,int num=1) |
Read one or more int16's into the target buffer. Returns the number successfully read. | |
int | Read (float64 *target,int num=1) |
Read one or more float64's into the target buffer. Returns the number successfully read. | |
int | Read (float32 *target,int num=1) |
Read one or more float32's into the target buffer. Returns the number successfully read. | |
int | Read (char *target,int num=1) |
Read one or more char's into the target buffer. Returns the number successfully read. | |
int | Read (char *target[],int num=1,char *scanCode=NULL,int stringSize=-1) |
Read one or more strings into the target buffer. Returns the number successfully read. More... | |
int | Read (GString *target,int num=1,char *scanCode=NULL) |
Read one or more strings into the target buffer. Returns the number successfully read. More... | |
int | Read (void *target,int num) |
Read num bytes of raw data. | |
char | Peek () |
Check what the next byte in the stream is without extracting it. More... | |
char | Get () |
Get the next byte in the stream. More... | |
bool | WaitForInput (tTime timeout=0.0) |
Wait for input to become available. More... | |
void | ReadMode (tReadMode mode) |
tReadMode | ReadMode () |
Get the current read mode. | |
void | Endianness (tEndianness endianness) |
Set the endianness of the input data. Only applies to binary streams. | |
tEndianness | Endianness () |
Get the endianness of the input data. | |
void | NumberBase (tNumberBase base) |
Set the number base of the input data. Only applies to text streams. | |
tNumberBase | NumberBase () |
Get the number base of the input data. | |
bool | InputAvailable () |
Returns true if input is currently available. More... | |
operator void * () | |
Use to check if the last read operation succeeded. More... | |
Related Functions | |
(Note that these are not member functions.) | |
GIStream & | operator>> (GIStream &is,tType &target) |
The >> operator works the same as it does for C++ istreams. |
GIStream does not provide the stream data itself. It wraps around a GRawIStream. GIStream provides many different ways to read the data, however, whereas GRawIStream only lets you read the data raw.
You can use a GIStream in either binary or text mode. Text mode works like regular C++ istreams, where numbers are read as ASCII, human-readable numbers, etc. In binary mode, on the other hand, the numbers are read in actual binary code, where a 32-bit number should be exactly four bytes in size in the file. Also, when in binary mode you can set whether to expect the data in big-endian or little-endian format. The data will automatically be converted to the host's endianness when read.
|
Position to seek relative to. Used by Seek().
|
|
Read mode specifiers for ReadMode().
|
|
Endianness specifiers for Endianness().
|
|
Number base specifiers for NumberBase().
|
|
Create a buffered input stream.
|
|
Create a possibly buffered input stream with a given buffer size.
|
|
Seek the stream position.
|
|
Read one or more strings into the target buffer. Returns the number successfully read.
|
|
Read one or more strings into the target buffer. Returns the number successfully read.
|
|
Check what the next byte in the stream is without extracting it.
|
|
Get the next byte in the stream.
|
|
Wait for input to become available.
|
|
\breif Set how to interpret the data in the stream (binary or text).
|
|
Returns true if input is currently available.
|
|
Use to check if the last read operation succeeded.
|