seal::TextFile Class Reference

#include <textfile.h>

Inheritance diagram for seal::TextFile:

seal::Vector< T > seal::List< T > seal::RandomAccess< T > seal::Collection< T >

List of all members.

Public Member Functions

 TextFile (void)
 TextFile (const TextFile &t)
 TextFile (const std::string &filename, char lineDelimiter= '\n', char wordDelimiter= ' ')
void loadFile (const std::string &filename, char lineDelimiter= '\n', char wordDelimiter= ' ')
void writeFile (const std::string &filename)
char getLineDelimiter (void)
char getWordDelimiter (void)


Detailed Description

This class encapsulates a text file. The facilities provided by this class include line by line access to the lines of text file, word by word access to the words of a text file, insertion and deletion of lines and words etc.

Each line of a text file is stored as a seal::TextLine object. seal::TextLine is a typedef provided in the SEAL library. The user specify the line delimiting character. By default a '
' is used as a line delimiter.

Each word of a seal::TextLine object is a stored as a std::string object. The user can specify the word delimiting character. By default, white space is assumed to be the word delimiter.

Note that a TextFile object is a seal::Vector of seal::TextLine objects. Hence, one can insert, push and pop lines as desired. Note also that a seal::TextLine object is a seal::Vector of std::String objects. Hence, one can insety, push and pop words as desired.


Constructor & Destructor Documentation

seal::TextFile::TextFile ( void   ) 

Constructor. Creates an empty object.

seal::TextFile::TextFile ( const TextFile t  ) 

Copy constructor.

seal::TextFile::TextFile ( const std::string &  filename,
char  lineDelimiter = '\n',
char  wordDelimiter = ' ' 
)

Constructor. Initialises the object with the lines of a file specified as the argument to the constructor.

Parameters:
filename The name of the file which has to be loaded.
lineDelimiter The line delimiting character.
wordDelimiter The word delimiting character.


Member Function Documentation

void seal::TextFile::loadFile ( const std::string &  filename,
char  lineDelimiter = '\n',
char  wordDelimiter = ' ' 
)

This function loads in a new file. The old file in memory destroyed.

Parameters:
filename The name of the file which has to be loaded.
lineDelimiter The line delimiting character.
wordDelimiter The word delimiting character.

void seal::TextFile::writeFile ( const std::string &  filename  ) 

Writes the contents of the TextFile object as is into a file.

Parameters:
filename The file into which the contents of the TextFile will be written into.

char seal::TextFile::getLineDelimiter ( void   )  [inline]

Returns the line delimiting character.

char seal::TextFile::getWordDelimiter ( void   )  [inline]

Returns the word delimiting character.


The documentation for this class was generated from the following file:

Generated on Sat May 16 21:35:21 2009 for SEAL by  doxygen 1.5.5