CoinFileInput Class Reference

Abstract base class for file input classes. More...

#include <CoinFileIO.hpp>

Inheritance diagram for CoinFileInput:

Inheritance graph
[legend]
Collaboration diagram for CoinFileInput:

Collaboration graph
[legend]
List of all members.

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 CoinFileInputcreate (const std::string &fileName)
 Factory method, that creates a CoinFileInput (more precisely a subclass of it) for the file specified.

Detailed Description

Abstract base class for file input classes.

Definition at line 34 of file CoinFileIO.hpp.


Constructor & Destructor Documentation

CoinFileInput::CoinFileInput ( const std::string &  fileName  ) 

Constructor (don't use this, use the create method instead).

Parameters:
fileName The name of the file used by this object.

virtual CoinFileInput::~CoinFileInput (  )  [virtual]

Destructor.


Member Function Documentation

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.

Parameters:
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.

Parameters:
buffer Address of a buffer to store the data into.
size Number of bytes to read (buffer should be large enough).
Returns:
Number of bytes read.

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.

Parameters:
buffer The buffer to put the string into.
size The size of the buffer in characters.
Returns:
buffer on success, or 0 if no characters have been read.


The documentation for this class was generated from the following file:
Generated on Thu May 15 22:00:29 2008 by  doxygen 1.4.7