clingo
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups
Public Member Functions | List of all members
Clasp::StreamSource Class Reference

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

#include <parser.h>

Collaboration diagram for Clasp::StreamSource:
Collaboration graph

Public Member Functions

 StreamSource (std::istream &is)
 
char operator* ()
 Returns the character at the current reading-position. More...
 
StreamSourceoperator++ ()
 Advances the current reading-position. More...
 
bool parseInt (int &val)
 Reads a base-10 integer. More...
 
bool parseInt64 (int64 &val)
 
bool parseInt (int &val, int min, int max)
 
int parseInt (int min, int max, const char *err)
 
bool match (char c)
 Consumes next character if equal to c. More...
 
bool matchEol ()
 Consumes next character(s) if equal to EOL. More...
 
bool skipSpace ()
 Skips horizontal white-space. More...
 
bool skipWhite ()
 Skips horizontal and vertical white-space. More...
 
unsigned line () const
 Returns the number of matched EOLs + 1. More...
 
void error (const char *err) const
 

Detailed Description

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

Constructor & Destructor Documentation

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

Member Function Documentation

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

Here is the call graph for this function:

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

Returns the number of matched EOLs + 1.

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

Consumes next character if equal to c.

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.

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

Here is the call graph for this function:

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

Returns the character at the current reading-position.

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

Advances the current reading-position.

bool Clasp::StreamSource::parseInt ( int &  val)

Reads a base-10 integer.

Precondition
system uses ASCII

Here is the call graph for this function:

bool Clasp::StreamSource::parseInt ( int &  val,
int  min,
int  max 
)

Here is the call graph for this function:

int Clasp::StreamSource::parseInt ( int  min,
int  max,
const char *  err 
)
inline

Here is the call graph for this function:

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

Here is the call graph for this function:

bool Clasp::StreamSource::skipSpace ( )
inline

Skips horizontal white-space.

Here is the call graph for this function:

bool Clasp::StreamSource::skipWhite ( )
inline

Skips horizontal and vertical white-space.

Here is the call graph for this function:


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