Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

File Class Reference

The idea is that this class will be used to read in information from text files created by the "save" function in various annie classes. More...

#include <File.h>

List of all members.

Public Member Functions

 File ()
 Creates an empty File object.

 File (std::string filename)
void open (std::string filename)
char readChar ()
 Reads one character from the file.

int readInt ()
 Returns an integer read from the file.

real readDouble ()
 Returns a real read from the file.

std::string readWord ()
 Returns a "word" (a string with no word separators/delimiters) read from the file.

void close ()
 Closes the file.

std::string readLine ()
 Returns a complete line.

bool eof ()


Detailed Description

The idea is that this class will be used to read in information from text files created by the "save" function in various annie classes.

When a file is opened, we check that the first non-commented line contains "ANNIE_FILE <ver>" where is the version number. This has been done to allow for future changes to file formats used by ANNIE. All save functions should save in the same format. Current version is 1.0.

Comments in an ANNIE file are given by a '#'. The rest of the line following '#' is ignored. The member functions of this class return values ignoring any and all comments that may have appeared in between.


Constructor & Destructor Documentation

File  ) 
 

Creates an empty File object.

File std::string  filename  ) 
 

Parameters:
filename The name of the file to be opened.
Exceptions:
Throws an Exception if the first line of the file is not ANNIE_FILE or the version of the ANNIE file is an incorrect one (not supported by this compilation of code)


Member Function Documentation

void close  ) 
 

Closes the file.

bool eof  ) 
 

Returns:
true if the file has reached the end, false otherwise

void open std::string  filename  ) 
 

Parameters:
filename The name of the file to be opened.
Exceptions:
Exception if the first line of the file is not ANNIE_FILE or the version of the ANNIE file is an incorrect one (not supported by this compilation of code)
Exception if another file is already opened and hasn't been closed.

char readChar  ) 
 

Reads one character from the file.

real readDouble  ) 
 

Returns a real read from the file.

int readInt  ) 
 

Returns an integer read from the file.

std::string readLine  ) 
 

Returns a complete line.

std::string readWord  ) 
 

Returns a "word" (a string with no word separators/delimiters) read from the file.


The documentation for this class was generated from the following file:
Generated on Fri Jun 18 13:18:56 2004 for Annie by doxygen 1.3.5