#include <parser.h>
Public Member Functions | |
void | error (const char *err) const |
unsigned | line () const |
Returns the number of matched EOLs + 1. | |
bool | match (char c) |
Consumes next character if equal to c. | |
bool | matchEol () |
Consumes next character(s) if equal to EOL. | |
char | operator* () |
Returns the character at the current reading-position. | |
StreamSource & | operator++ () |
Advances the current reading-position. | |
bool | parseInt (int &val) |
Reads a base-10 integer. | |
bool | parseInt (int &val, int min, int max) |
int | parseInt (int min, int max, const char *err) |
bool | parseInt64 (int64 &val) |
bool | skipSpace () |
Skips horizontal white-space. | |
bool | skipWhite () |
Skips horizontal and vertical white-space. | |
StreamSource (std::istream &is) | |
Private Member Functions | |
StreamSource & | operator= (const StreamSource &) |
StreamSource (const std::istream &) | |
void | underflow () |
Private Attributes | |
char | buffer_ [2048] |
std::istream & | in_ |
unsigned | line_ |
unsigned | pos_ |
Wrapps an std::istream and provides basic functions for extracting numbers and strings.
Clasp::StreamSource::StreamSource | ( | std::istream & | is | ) | [explicit] |
Definition at line 56 of file parser.cpp.
Clasp::StreamSource::StreamSource | ( | const std::istream & | ) | [private] |
void Clasp::StreamSource::error | ( | const char * | err | ) | const [inline] |
unsigned Clasp::StreamSource::line | ( | ) | const [inline] |
bool Clasp::StreamSource::match | ( | char | c | ) | [inline] |
bool Clasp::StreamSource::matchEol | ( | ) |
Consumes next character(s) if equal to EOL.
Consumes the next character if it is either '
' or '' and increments the internal line counter.
Definition at line 97 of file parser.cpp.
char Clasp::StreamSource::operator* | ( | ) | [inline] |
StreamSource& Clasp::StreamSource::operator++ | ( | ) | [inline] |
StreamSource& Clasp::StreamSource::operator= | ( | const StreamSource & | ) | [private] |
bool Clasp::StreamSource::parseInt | ( | int & | val | ) |
bool Clasp::StreamSource::parseInt | ( | int & | val, |
int | min, | ||
int | max | ||
) |
Definition at line 89 of file parser.cpp.
int Clasp::StreamSource::parseInt | ( | int | min, |
int | max, | ||
const char * | err | ||
) | [inline] |
bool Clasp::StreamSource::parseInt64 | ( | int64 & | val | ) |
Definition at line 68 of file parser.cpp.
bool Clasp::StreamSource::skipSpace | ( | ) | [inline] |
bool Clasp::StreamSource::skipWhite | ( | ) | [inline] |
void Clasp::StreamSource::underflow | ( | ) | [private] |
Definition at line 60 of file parser.cpp.
char Clasp::StreamSource::buffer_[2048] [private] |
std::istream& Clasp::StreamSource::in_ [private] |
unsigned Clasp::StreamSource::line_ [private] |
unsigned Clasp::StreamSource::pos_ [private] |