Wrapper class around FILE read and write
1.0.1 Added advance stream function
Definition at line 35 of file CFileStream.hpp.
Exponent::IO::CFileStream::CFileStream | ( | ) |
Construction
Exponent::IO::CFileStream::CFileStream | ( | const CSystemString & | filename, | |
const EStreamMode | status, | |||
const bool | fileIsLittleEndian = true | |||
) |
Construction which opens a binary file
filename | The name of the file | |
status | The status with which to open the file | |
fileIsLittleEndian | If true bytes are little endian order, else big endian |
virtual Exponent::IO::CFileStream::~CFileStream | ( | ) | [virtual] |
Destruction
bool Exponent::IO::CFileStream::advanceStream | ( | const long | amount | ) |
Advance the stream, can be used to move backwards by using a negative value for amount
amount | The amount to move on by |
bool | True if moved, false otherwise |
void Exponent::IO::CFileStream::closeStream | ( | ) |
Close the stream
long Exponent::IO::CFileStream::getStreamPosition | ( | ) |
Get the stream position
long | The current file position, -1 on error |
long Exponent::IO::CFileStream::getStreamSize | ( | ) |
Get the stream size
long | -1 on error or if stream open for write, length in bytes otherwise |
bool Exponent::IO::CFileStream::hasErrorOccurred | ( | ) | const [inline] |
Has an error occurred
bool | True if an error has occurred recently |
Definition at line 315 of file CFileStream.hpp.
References m_errorState.
bool Exponent::IO::CFileStream::hasReachEndOfFile | ( | ) | const |
Have we reached the end of the file
bool | True if reach eof, flse otherwise |
bool Exponent::IO::CFileStream::isStreamOpen | ( | ) | const [inline] |
Is the stream open
bool | True if stream open, false otherwise |
Definition at line 99 of file CFileStream.hpp.
References m_streamIsOpen.
bool Exponent::IO::CFileStream::moveToStreamPosition | ( | const long | position | ) |
Move to a stream postion
position | The position to mvoe to |
bool | True if moved, false otherwise |
bool Exponent::IO::CFileStream::moveToStreamStart | ( | ) |
Move to stream beggining
bool Exponent::IO::CFileStream::openStream | ( | const CSystemString & | path, | |
const EStreamMode | mode, | |||
const bool | fileIsLittleEndian = true | |||
) |
Open the stream
path | The path to the file to read / write | |
mode | The streaming mode to use | |
fileIsLittleEndian | If true bytes are little endian order, else big endian |
bool | True if opened properly, false otherwise |
CFileStream& Exponent::IO::CFileStream::operator<< | ( | const double & | value | ) |
Stream output of a long (64 bit)
value | The value to write |
CFileStream | & A reference to this |
CFileStream& Exponent::IO::CFileStream::operator<< | ( | const float & | value | ) |
Stream output of a long (32 bit)
value | The value to write |
CFileStream | & A reference to this |
CFileStream& Exponent::IO::CFileStream::operator<< | ( | const unsigned long & | value | ) |
Stream output of a long (32 bit)
value | The long to write |
CFileStream | & A reference to this |
CFileStream& Exponent::IO::CFileStream::operator<< | ( | const long & | value | ) |
Stream output of a long (32 bit)
value | The value to write |
CFileStream | & A reference to this |
CFileStream& Exponent::IO::CFileStream::operator<< | ( | const unsigned short & | byte | ) |
Stream output of a character (BYTE)
byte | The character to write |
CFileStream | & A reference to this |
CFileStream& Exponent::IO::CFileStream::operator<< | ( | const short & | byte | ) |
Stream output of a character (BYTE)
byte | The character to write |
CFileStream | & A reference to this |
CFileStream& Exponent::IO::CFileStream::operator<< | ( | const bool & | byte | ) |
Stream output of a character (BYTE)
byte | The bool to write |
CFileStream | & A reference to this |
CFileStream& Exponent::IO::CFileStream::operator<< | ( | const unsigned char & | byte | ) |
Stream output of a character (BYTE)
byte | The character to write |
CFileStream | & A reference to this |
CFileStream& Exponent::IO::CFileStream::operator<< | ( | const char & | byte | ) |
Stream output of a character (BYTE)
byte | The character to write |
CFileStream | & A reference to this |
CFileStream& Exponent::IO::CFileStream::operator>> | ( | double & | value | ) |
Stream output of a long (64 bit)
value | The value to write |
CFileStream | & A reference to this |
CFileStream& Exponent::IO::CFileStream::operator>> | ( | float & | value | ) |
Stream output of a long (32 bit)
value | The value to write |
CFileStream | & A reference to this |
CFileStream& Exponent::IO::CFileStream::operator>> | ( | unsigned long & | value | ) |
Stream output of a long (32 bit)
value | The long to write |
CFileStream | & A reference to this |
CFileStream& Exponent::IO::CFileStream::operator>> | ( | long & | value | ) |
Stream output of a long (32 bit)
value | The value to write |
CFileStream | & A reference to this |
CFileStream& Exponent::IO::CFileStream::operator>> | ( | unsigned short & | byte | ) |
Stream output of a character (BYTE)
byte | The character to write |
CFileStream | & A reference to this |
CFileStream& Exponent::IO::CFileStream::operator>> | ( | short & | byte | ) |
Stream output of a character (BYTE)
byte | The character to write |
CFileStream | & A reference to this |
CFileStream& Exponent::IO::CFileStream::operator>> | ( | bool & | byte | ) |
Stream output of a character (BYTE)
byte | The bool to write |
CFileStream | & A reference to this |
CFileStream& Exponent::IO::CFileStream::operator>> | ( | unsigned char & | byte | ) |
Stream output of a character (BYTE)
byte | The character to write |
CFileStream | & A reference to this |
CFileStream& Exponent::IO::CFileStream::operator>> | ( | char & | byte | ) |
Stream output of a character (BYTE)
byte | The character to write |
CFileStream | & A reference to this |
void Exponent::IO::CFileStream::read16Bits | ( | void * | value | ) | [protected] |
Read a 16 bit value swapping byte order as necessary
value | The value to read |
void Exponent::IO::CFileStream::read32Bits | ( | void * | value | ) | [protected] |
Read a 32 bit value swapping byte order as necessary
value | The value to read |
void Exponent::IO::CFileStream::read64Bits | ( | void * | value | ) | [protected] |
Read a 64 bit value swapping byte order as necessary
value | The value to read |
bool Exponent::IO::CFileStream::readDataFromStream | ( | void * | data, | |
const size_t | numberOfBytes | |||
) |
Read a block of data from the stream
data | The data to read in to on return holds the data. Must be at least numberOfBytes in size | |
numberOfBytes | The size of the data in bytes |
bool | True if read from the stream, false otherwise |
bool Exponent::IO::CFileStream::readShortsFromStream | ( | short * | data, | |
const unsigned long | numberOfElements | |||
) |
Read a block of shorts from the stream
data | The data to read in to, on return holds the data. Must be at least numberOfElements in size | |
numberOfElements | The size of the data in elements |
bool | True if read from the stream, false otherwise |
void Exponent::IO::CFileStream::setStreamEndianess | ( | const bool | fileIsLittleEndian = true |
) |
Set the stream endianess
fileIsLittleEndian | True if little endian, false otherwise |
bool Exponent::IO::CFileStream::swapBits | ( | ) | const [protected] |
Should swap bits
bool | True if bits need to be swapped |
bool Exponent::IO::CFileStream::validForInput | ( | ) |
Valid for output
bool | True if file is open for input, false otherwise |
bool Exponent::IO::CFileStream::validForOutput | ( | ) |
Valid for output
bool | True if file is open for output, false otherwise |
void Exponent::IO::CFileStream::write16Bits | ( | const void * | value | ) | [protected] |
Write a 16 bit value swapping byte order as necessary
value | The value to write |
void Exponent::IO::CFileStream::write32Bits | ( | const void * | value | ) | [protected] |
Write a 32 bit value swapping byte order as necessary
value | The value to write |
void Exponent::IO::CFileStream::write64Bits | ( | const void * | value | ) | [protected] |
Write a 64 bit value swapping byte order as necessary
value | The value to write |
bool Exponent::IO::CFileStream::writeDataToStream | ( | const void * | data, | |
const size_t | numberOfBytes | |||
) |
Write a block of data to the stream
data | The data to write | |
numberOfBytes | The size of the data in bytes |
bool | True if written to the stream, false otherwise |
const unsigned int Exponent::IO::CFileStream::CFILESTREAM_16BIT_SIZE = 2 [static, protected] |
Size of 16 bit
Definition at line 378 of file CFileStream.hpp.
const unsigned int Exponent::IO::CFileStream::CFILESTREAM_32BIT_SIZE = 4 [static, protected] |
Size of eight bit
Definition at line 379 of file CFileStream.hpp.
const unsigned int Exponent::IO::CFileStream::CFILESTREAM_64BIT_SIZE = 8 [static, protected] |
Size of eight bit
Definition at line 380 of file CFileStream.hpp.
const unsigned int Exponent::IO::CFileStream::CFILESTREAM_8BIT_SIZE = 1 [static, protected] |
Size of 8 bit
Definition at line 377 of file CFileStream.hpp.
bool Exponent::IO::CFileStream::m_errorState [protected] |
Has an error occurred
Definition at line 387 of file CFileStream.hpp.
Referenced by hasErrorOccurred().
FILE* Exponent::IO::CFileStream::m_file [protected] |
The file we are writing to
Definition at line 384 of file CFileStream.hpp.
bool Exponent::IO::CFileStream::m_fileIsLittleEndian [protected] |
Are bytes little or big endian
Definition at line 388 of file CFileStream.hpp.
bool Exponent::IO::CFileStream::m_streamIsOpen [protected] |
EStreamMode Exponent::IO::CFileStream::m_streamStatus [protected] |
Status of the stream
Definition at line 385 of file CFileStream.hpp.