Scid  4.7.0
Public Member Functions | List of all members
pgn_impl::InputMemory Class Reference

#include <pgn_lexer.h>

Public Member Functions

 InputMemory (const char *begin, const char *end)
 
char sbumpc ()
 Reads one character and advances the input sequence by one character. More...
 
void sungetc ()
 Makes the most recently extracted character available again. More...
 
bool eof () const
 Returns true if there are no chars available. More...
 
std::size_t n_read () const
 Returns the number of chars read. More...
 
bool first_column () const
 Returns true if the most recently extracted character was the first character of the line. More...
 
bool last_column () const
 Returns true if the most recently extracted character was the last character of the line. More...
 
std::pair< const char *, const char * > read_line ()
 Returns the range of chars: [curr_char, '
'). More...
 
std::pair< const char *, const char * > read_until (char delim)
 Returns the range of chars: [curr_char, delim). More...
 
template<typename Cond >
std::pair< const char *, const char * > read_while (Cond cond)
 Returns the range of chars: [curr_char, cond == true]. More...
 
template<typename Cond >
std::pair< const char *, const char * > read_token (Cond cond)
 Returns the range of chars: [last_extracted_char, cond == true]. More...
 

Detailed Description

Definition at line 286 of file pgn_lexer.h.

Constructor & Destructor Documentation

◆ InputMemory()

pgn_impl::InputMemory::InputMemory ( const char *  begin,
const char *  end 
)
inline

Definition at line 292 of file pgn_lexer.h.

Member Function Documentation

◆ eof()

bool pgn_impl::InputMemory::eof ( ) const
inline

Returns true if there are no chars available.

Definition at line 308 of file pgn_lexer.h.

◆ first_column()

bool pgn_impl::InputMemory::first_column ( ) const
inline

Returns true if the most recently extracted character was the first character of the line.

Definition at line 315 of file pgn_lexer.h.

◆ last_column()

bool pgn_impl::InputMemory::last_column ( ) const
inline

Returns true if the most recently extracted character was the last character of the line.

Definition at line 319 of file pgn_lexer.h.

◆ n_read()

std::size_t pgn_impl::InputMemory::n_read ( ) const
inline

Returns the number of chars read.

Definition at line 311 of file pgn_lexer.h.

◆ read_line()

std::pair<const char*, const char*> pgn_impl::InputMemory::read_line ( )
inline

Returns the range of chars: [curr_char, '
').

The '
' char is left as the next character to extract.

Definition at line 323 of file pgn_lexer.h.

◆ read_token()

template<typename Cond >
std::pair<const char*, const char*> pgn_impl::InputMemory::read_token ( Cond  cond)
inline

Returns the range of chars: [last_extracted_char, cond == true].

cond is not applied to last_extracted_char.

Definition at line 349 of file pgn_lexer.h.

◆ read_until()

std::pair<const char*, const char*> pgn_impl::InputMemory::read_until ( char  delim)
inline

Returns the range of chars: [curr_char, delim).

The delim char is skipped.

Definition at line 331 of file pgn_lexer.h.

◆ read_while()

template<typename Cond >
std::pair<const char*, const char*> pgn_impl::InputMemory::read_while ( Cond  cond)
inline

Returns the range of chars: [curr_char, cond == true].

Definition at line 340 of file pgn_lexer.h.

◆ sbumpc()

char pgn_impl::InputMemory::sbumpc ( )
inline

Reads one character and advances the input sequence by one character.

Definition at line 296 of file pgn_lexer.h.

◆ sungetc()

void pgn_impl::InputMemory::sungetc ( )
inline

Makes the most recently extracted character available again.

Definition at line 302 of file pgn_lexer.h.


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