Inheritance diagram for Reader< T >:
Public Member Functions | |
Reader () | |
bool | read (istream &in, T *object) |
void | add_reader_function (const string &name, bool(*func)(istream &, T *)) |
bool | was_successful () const |
Private Types | |
typedef map< string, bool(*)(istream &, T *)> | reader_map_t |
Private Member Functions | |
Parsing Functions | |
string | get_next_token (istream &in) |
Skips over comments until it finds a whitespace delimited token. | |
void | ignore_element (istream &in) |
Skips over the next element in the stream in including any comments and line continuations. | |
void | extract_line (istream &in, string &line) |
Extracts an entire line from the stream in and puts it in the string line . This function will collapse multiple lines into one if there are line continuations. | |
Private Attributes | |
bool | read_succeeded |
reader_map_t | reader_map |
A parser class that reads files that are formatted such that each line starts with an identifying token that is followed by data. Blank lines, comments starting with the '#' character, and line continuations with the '\' character are also allowed.
Exactly what actions are performed for each token are customizable using registered callback functions.
The class is templated on a type which is passed as an additional parameter to each callback function. Typically, this type will be the type of a class which has all of the callback functions as static members.
Definition at line 64 of file objreader.C.
|
Definition at line 84 of file objreader.C. |
|
Definition at line 68 of file objreader.C. |
|
Definition at line 154 of file objreader.C. References Reader< T >::reader_map. Referenced by MTLReader::MTLReader(), and OBJReaderImpl::OBJReaderImpl(). |
|
Extracts an entire line from the stream
Definition at line 221 of file objreader.C. Referenced by Reader< T >::read(). |
|
Skips over comments until it finds a whitespace delimited token.
Definition at line 169 of file objreader.C. References eat_line(). Referenced by Reader< T >::read(). |
|
Skips over the next element in the stream
Definition at line 197 of file objreader.C. References eat_line(). Referenced by Reader< T >::read(). |
|
Definition at line 102 of file objreader.C. References Reader< T >::extract_line(), Reader< T >::get_next_token(), Reader< T >::ignore_element(), Reader< T >::read_succeeded, and Reader< T >::reader_map. Referenced by OBJReaderImpl::read(), and MTLReader::read(). |
|
Definition at line 77 of file objreader.C. |
|
Definition at line 82 of file objreader.C. Referenced by Reader< T >::read(), and Reader< OBJReaderImpl >::was_successful(). |
|
Definition at line 85 of file objreader.C. Referenced by Reader< T >::add_reader_function(), and Reader< T >::read(). |