Orcus
Protected Member Functions | Protected Attributes | List of all members
orcus::parser_base Class Reference
Inheritance diagram for orcus::parser_base:
orcus::css::parser_base orcus::csv::parser_base orcus::json::parser_base orcus::sax::parser_base orcus::yaml::parser_base orcus::css_parser< _Handler > orcus::csv_parser< _Handler > orcus::json_parser< _Handler > orcus::sax_parser< _Handler, _Config > orcus::sax_parser< handler_wrapper > orcus::yaml_parser< _Handler >

Protected Member Functions

 parser_base (const char *p, size_t n)
 
bool has_char () const
 
bool has_next () const
 
void next (size_t inc=1)
 
void prev (size_t dec=1)
 
char cur_char () const
 
char next_char () const
 
void skip (const char *chars_to_skip)
 
bool parse_expected (const char *expected)
 
double parse_double ()
 
size_t remaining_size () const
 
std::ptrdiff_t offset () const
 

Protected Attributes

const char * mp_begin
 
const char * mp_char
 
const char * mp_end
 

Member Function Documentation

std::ptrdiff_t orcus::parser_base::offset ( ) const
protected

Return the current offset from the beginning of the character stream.

Returns
current offset from the beginning of the character stream.
double orcus::parser_base::parse_double ( )
protected

Try to parse the next characters as double, or return NaN in case of failure.

Returns
double value on success, or NaN on failure.
bool orcus::parser_base::parse_expected ( const char *  expected)
protected

Parse and check next characters to see if it matches specified character sequence.

Parameters
expectednull-terminated character array to match against.
Returns
true if it matches specified character sequence, false otherwise.
size_t orcus::parser_base::remaining_size ( ) const
protected

Determine the number of characters remaining after the current character. For instance, if the current character is on the last character in the stream, this method will return 0, whereas if it's on the first character, it will return the total length - 1.

Returns
number of characters remaining after the current character.