Generated on for Gecode by doxygen 1.17.0
Gecode::Instance::Input Class Reference

Instance text with a position and line tracking. More...

#include <gecode/instance/eval.hpp>

Public Member Functions

 Input (const std::string &t, const std::string &o)
 Initialize for t from o.
void add_split (const std::string &cs)
 Make the characters cs tokens by themselves, unless they separate tokens.
void add_separators (const std::string &cs)
 Make the characters cs separate tokens like white space.
void advance (size_t p)
 Move forward to p.
bool line_start (void) const
 Test whether only blanks precede the position on its line.
bool starts_with (const std::string &prefix) const
 Test whether the text at the position starts with prefix.
void to_eol (void)
 Move to the end of the current line.
bool is_separator (char c) const
 Test whether c separates tokens.
bool is_split (char c) const
 Test whether c forms a token by itself.
bool in_line (size_t q) const
 Test whether position q is within the current line.
void skip (void)
 Skip white space, comment lines, and everything after a stop line.
bool skip_to_data (void)
 Skip to the next data (see skip), and return whether there is any.
bool skip_to_line_data (void)
 Skip blanks and separators, and return whether data follows on the line.
size_t token_end (void) const
 Return where the token at the position ends.
std::string token (void)
 Read the token at the position.
bool int_token (long long int &v)
 Read the token at the position as an integer v, and return whether it is one.
std::string peek (void)
 Return the next token without consuming it.
std::string rest (void) const
 Return the rest of the current line without trailing blanks.
std::string line_at (size_t s) const
 Return the line starting at s without trailing blanks.
Place here (void) const
 Return the current place.
Place place (size_t q) const
 Return the place of position q, which is not after the current one.
size_t next_data (void)
 Return where the next data starts (see skip), without moving there.

Public Attributes

const std::string & text
 The text.
std::string origin
 Where the text comes from.
Seq< std::string > comments
 Comment line prefixes.
Seq< std::string > stops
 Prefixes of lines that end the data.
size_t pos
 Current position.
int line
 Current line (1-based).
size_t start
 Start of current line.

Detailed Description

Instance text with a position and line tracking.

Definition at line 126 of file eval.hpp.

Constructor & Destructor Documentation

◆ Input()

Gecode::Instance::Input::Input ( const std::string & t,
const std::string & o )
inline

Initialize for t from o.

Definition at line 157 of file eval.hpp.

Member Function Documentation

◆ add_split()

void Gecode::Instance::Input::add_split ( const std::string & cs)
inline

Make the characters cs tokens by themselves, unless they separate tokens.

Definition at line 164 of file eval.hpp.

◆ add_separators()

void Gecode::Instance::Input::add_separators ( const std::string & cs)
inline

Make the characters cs separate tokens like white space.

Definition at line 170 of file eval.hpp.

◆ advance()

void Gecode::Instance::Input::advance ( size_t p)
inline

Move forward to p.

Definition at line 176 of file eval.hpp.

◆ line_start()

bool Gecode::Instance::Input::line_start ( void ) const
inline

Test whether only blanks precede the position on its line.

Definition at line 186 of file eval.hpp.

◆ starts_with()

bool Gecode::Instance::Input::starts_with ( const std::string & prefix) const
inline

Test whether the text at the position starts with prefix.

Definition at line 193 of file eval.hpp.

◆ to_eol()

void Gecode::Instance::Input::to_eol ( void )
inline

Move to the end of the current line.

Definition at line 200 of file eval.hpp.

◆ is_separator()

bool Gecode::Instance::Input::is_separator ( char c) const
inline

Test whether c separates tokens.

Definition at line 205 of file eval.hpp.

◆ is_split()

bool Gecode::Instance::Input::is_split ( char c) const
inline

Test whether c forms a token by itself.

Definition at line 209 of file eval.hpp.

◆ in_line()

bool Gecode::Instance::Input::in_line ( size_t q) const
inline

Test whether position q is within the current line.

Definition at line 213 of file eval.hpp.

◆ skip()

void Gecode::Instance::Input::skip ( void )
inline

Skip white space, comment lines, and everything after a stop line.

Definition at line 217 of file eval.hpp.

◆ skip_to_data()

bool Gecode::Instance::Input::skip_to_data ( void )
inline

Skip to the next data (see skip), and return whether there is any.

Definition at line 246 of file eval.hpp.

◆ skip_to_line_data()

bool Gecode::Instance::Input::skip_to_line_data ( void )
inline

Skip blanks and separators, and return whether data follows on the line.

Definition at line 251 of file eval.hpp.

◆ token_end()

size_t Gecode::Instance::Input::token_end ( void ) const
inline

Return where the token at the position ends.

Definition at line 257 of file eval.hpp.

◆ token()

std::string Gecode::Instance::Input::token ( void )
inline

Read the token at the position.

Definition at line 266 of file eval.hpp.

◆ int_token()

bool Gecode::Instance::Input::int_token ( long long int & v)
inline

Read the token at the position as an integer v, and return whether it is one.

Accepts what parse_int accepts, without making a string.

Definition at line 278 of file eval.hpp.

◆ peek()

std::string Gecode::Instance::Input::peek ( void )
inline

Return the next token without consuming it.

Definition at line 310 of file eval.hpp.

◆ rest()

std::string Gecode::Instance::Input::rest ( void ) const
inline

Return the rest of the current line without trailing blanks.

Definition at line 318 of file eval.hpp.

◆ line_at()

std::string Gecode::Instance::Input::line_at ( size_t s) const
inline

Return the line starting at s without trailing blanks.

Definition at line 325 of file eval.hpp.

◆ here()

Place Gecode::Instance::Input::here ( void ) const
inline

Return the current place.

Definition at line 332 of file eval.hpp.

◆ place()

Place Gecode::Instance::Input::place ( size_t q) const
inline

Return the place of position q, which is not after the current one.

Definition at line 338 of file eval.hpp.

◆ next_data()

size_t Gecode::Instance::Input::next_data ( void )
inline

Return where the next data starts (see skip), without moving there.

Definition at line 351 of file eval.hpp.

Member Data Documentation

◆ text

const std::string& Gecode::Instance::Input::text

The text.

Definition at line 142 of file eval.hpp.

◆ origin

std::string Gecode::Instance::Input::origin

Where the text comes from.

Definition at line 144 of file eval.hpp.

◆ comments

Seq<std::string> Gecode::Instance::Input::comments

Comment line prefixes.

Definition at line 146 of file eval.hpp.

◆ stops

Seq<std::string> Gecode::Instance::Input::stops

Prefixes of lines that end the data.

Definition at line 148 of file eval.hpp.

◆ pos

size_t Gecode::Instance::Input::pos

Current position.

Definition at line 150 of file eval.hpp.

◆ line

int Gecode::Instance::Input::line

Current line (1-based).

Definition at line 152 of file eval.hpp.

◆ start

size_t Gecode::Instance::Input::start

Start of current line.

Definition at line 154 of file eval.hpp.


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