lab_memory
Malevolent Memories
|
Utility functions for reading students/rooms from files. More...
Namespaces | |
fileio_internal | |
Holds variables that only need to be accessed by the namespace itself. | |
Typedefs | |
typedef map< string, vector < string > > | FileMap |
Stores config name options if necessary. More... | |
Functions | |
void | init () |
Sets up the students and rooms variables as empty vectors. More... | |
void | halt () |
Acts as a destructor for the fileio reader. More... | |
void | loadStudents (const string &file) |
Reads the student file into the students vector. More... | |
void | loadRooms (const string &file) |
Reads the rooms file into the rooms vector. More... | |
int | getNumStudents () |
int | getNumRooms () |
bool | areMoreStudents () |
bool | areMoreRooms () |
string | nextStudent () |
Room | nextRoom () |
Room | readRoom (const string &line) |
Reads a line parsed from the rooms file into a list of rooms. More... | |
vector< string > | tokenize (const string &str, char delim) |
Tokenizes a string of delimiter-separated elements. More... | |
void | readFile (const string &file, vector< string > &lines) |
Reads a file into a vector of lines. More... | |
void | readFileGeneric (const string &filename, FileMap *map, vector< string > *lines) |
Utility functions for reading students/rooms from files.
typedef map<string, vector<string> > fileio::FileMap |
Stores config name options if necessary.
void fileio::init | ( | ) |
Sets up the students and rooms variables as empty vectors.
void fileio::halt | ( | ) |
Acts as a destructor for the fileio reader.
void fileio::loadStudents | ( | const string & | file | ) |
Reads the student file into the students vector.
file | The student file |
void fileio::loadRooms | ( | const string & | file | ) |
Reads the rooms file into the rooms vector.
file | The room file |
int fileio::getNumStudents | ( | ) |
int fileio::getNumRooms | ( | ) |
bool fileio::areMoreStudents | ( | ) |
bool fileio::areMoreRooms | ( | ) |
string fileio::nextStudent | ( | ) |
Room fileio::nextRoom | ( | ) |
Tokenizes a string of delimiter-separated elements.
str | The string to tokenize |
delim | Delimiters to tokenize the string by |
Reads a file into a vector of lines.
file | The file to read |
lines | The vector to fill with lines |