#include <CoinFileIO.hpp>
Inheritance diagram for CoinFileInput:
Public Member Functions | |
CoinFileInput (const std::string &fileName) | |
Constructor (don't use this, use the create method instead). | |
virtual | ~CoinFileInput () |
Destructor. | |
virtual int | read (void *buffer, int size)=0 |
Read a block of data from the file, similar to fread. | |
virtual char * | gets (char *buffer, int size)=0 |
Reads up to (size-1) characters an stores them into the buffer, similar to fgets. | |
Static Public Member Functions | |
static CoinFileInput * | create (const std::string &fileName) |
Factory method, that creates a CoinFileInput (more precisely a subclass of it) for the file specified. |
Definition at line 34 of file CoinFileIO.hpp.
CoinFileInput::CoinFileInput | ( | const std::string & | fileName | ) |
Constructor (don't use this, use the create method instead).
fileName | The name of the file used by this object. |
virtual CoinFileInput::~CoinFileInput | ( | ) | [virtual] |
Destructor.
static CoinFileInput* CoinFileInput::create | ( | const std::string & | fileName | ) | [static] |
Factory method, that creates a CoinFileInput (more precisely a subclass of it) for the file specified.
This method reads the first few bytes of the file and determines if this is a compressed or a plain file and returns the correct subclass to handle it. If the file does not exist or uses a compression not compiled in an exception is thrown.
fileName | The file that should be read. |
virtual int CoinFileInput::read | ( | void * | buffer, | |
int | size | |||
) | [pure virtual] |
Read a block of data from the file, similar to fread.
buffer | Address of a buffer to store the data into. | |
size | Number of bytes to read (buffer should be large enough). |
virtual char* CoinFileInput::gets | ( | char * | buffer, | |
int | size | |||
) | [pure virtual] |
Reads up to (size-1) characters an stores them into the buffer, similar to fgets.
Reading ends, when EOF or a newline occurs or (size-1) characters have been read. The resulting string is terminated with ''. If reading ends due to an encoutered newline, the '
' is put into the buffer, before the '' is appended.
buffer | The buffer to put the string into. | |
size | The size of the buffer in characters. |