#include <textfile.h>
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) |
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.
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.
filename | The name of the file which has to be loaded. | |
lineDelimiter | The line delimiting character. | |
wordDelimiter | The word delimiting character. |
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.
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 | ) |
char seal::TextFile::getLineDelimiter | ( | void | ) | [inline] |
Returns the line delimiting character.
char seal::TextFile::getWordDelimiter | ( | void | ) | [inline] |
Returns the word delimiting character.