Public Member Functions | Private Member Functions | Private Attributes
Clasp::StreamSource Class Reference

#include <parser.h>

List of all members.

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.
StreamSourceoperator++ ()
 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

StreamSourceoperator= (const StreamSource &)
 StreamSource (const std::istream &)
void underflow ()

Private Attributes

char buffer_ [2048]
std::istream & in_
unsigned line_
unsigned pos_

Detailed Description

Wrapps an std::istream and provides basic functions for extracting numbers and strings.

Definition at line 165 of file parser.h.


Constructor & Destructor Documentation

Clasp::StreamSource::StreamSource ( std::istream &  is) [explicit]

Definition at line 56 of file parser.cpp.

Clasp::StreamSource::StreamSource ( const std::istream &  ) [private]

Member Function Documentation

void Clasp::StreamSource::error ( const char *  err) const [inline]

Definition at line 206 of file parser.h.

unsigned Clasp::StreamSource::line ( ) const [inline]

Returns the number of matched EOLs + 1.

Definition at line 204 of file parser.h.

bool Clasp::StreamSource::match ( char  c) [inline]

Consumes next character if equal to c.

Definition at line 189 of file parser.h.

Consumes next character(s) if equal to EOL.

Consumes the next character if it is either '
' or '' and increments the internal line counter.

Note:
If next char is '', the function will also consume a following '
' (i.e. matchEol also matches CR/LF).

Definition at line 97 of file parser.cpp.

char Clasp::StreamSource::operator* ( ) [inline]

Returns the character at the current reading-position.

Definition at line 169 of file parser.h.

StreamSource& Clasp::StreamSource::operator++ ( ) [inline]

Advances the current reading-position.

Definition at line 174 of file parser.h.

StreamSource& Clasp::StreamSource::operator= ( const StreamSource ) [private]
bool Clasp::StreamSource::parseInt ( int &  val)

Reads a base-10 integer.

Precondition:
system uses ASCII

Definition at line 82 of file parser.cpp.

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]

Definition at line 183 of file parser.h.

bool Clasp::StreamSource::parseInt64 ( int64 &  val)

Definition at line 68 of file parser.cpp.

bool Clasp::StreamSource::skipSpace ( ) [inline]

Skips horizontal white-space.

Definition at line 200 of file parser.h.

bool Clasp::StreamSource::skipWhite ( ) [inline]

Skips horizontal and vertical white-space.

Definition at line 202 of file parser.h.

void Clasp::StreamSource::underflow ( ) [private]

Definition at line 60 of file parser.cpp.


Member Data Documentation

char Clasp::StreamSource::buffer_[2048] [private]

Definition at line 211 of file parser.h.

std::istream& Clasp::StreamSource::in_ [private]

Definition at line 212 of file parser.h.

unsigned Clasp::StreamSource::line_ [private]

Definition at line 214 of file parser.h.

unsigned Clasp::StreamSource::pos_ [private]

Definition at line 213 of file parser.h.


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


clasp
Author(s): Benjamin Kaufmann
autogenerated on Thu Aug 27 2015 12:41:41