GRASP rci-qed
Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
cpptoml::parser Class Reference

#include <cpptoml.h>

Public Member Functions

 parser (std::istream &stream)
 
parseroperator= (const parser &parser)=delete
 
std::shared_ptr< tableparse ()
 

Private Types

enum  parse_type {
  parse_type::STRING = 1, parse_type::LOCAL_TIME, parse_type::LOCAL_DATE, parse_type::LOCAL_DATETIME,
  parse_type::OFFSET_DATETIME, parse_type::INT, parse_type::FLOAT, parse_type::BOOL,
  parse_type::ARRAY, parse_type::INLINE_TABLE
}
 

Private Member Functions

void throw_parse_exception (const std::string &err)
 
void parse_table (std::string::iterator &it, const std::string::iterator &end, table *&curr_table)
 
void parse_single_table (std::string::iterator &it, const std::string::iterator &end, table *&curr_table)
 
void parse_table_array (std::string::iterator &it, const std::string::iterator &end, table *&curr_table)
 
void parse_key_value (std::string::iterator &it, std::string::iterator &end, table *curr_table)
 
template<class KeyEndFinder , class KeyPartHandler >
std::string parse_key (std::string::iterator &it, const std::string::iterator &end, KeyEndFinder &&key_end, KeyPartHandler &&key_part_handler)
 
std::string parse_simple_key (std::string::iterator &it, const std::string::iterator &end)
 
std::string parse_bare_key (std::string::iterator &it, const std::string::iterator &end)
 
std::shared_ptr< baseparse_value (std::string::iterator &it, std::string::iterator &end)
 
parse_type determine_value_type (const std::string::iterator &it, const std::string::iterator &end)
 
parse_type determine_number_type (const std::string::iterator &it, const std::string::iterator &end)
 
std::shared_ptr< value< std::string > > parse_string (std::string::iterator &it, std::string::iterator &end)
 
std::shared_ptr< value< std::string > > parse_multiline_string (std::string::iterator &it, std::string::iterator &end, char delim)
 
std::string string_literal (std::string::iterator &it, const std::string::iterator &end, char delim)
 
std::string parse_escape_code (std::string::iterator &it, const std::string::iterator &end)
 
std::string parse_unicode (std::string::iterator &it, const std::string::iterator &end)
 
uint32_t parse_hex (std::string::iterator &it, const std::string::iterator &end, uint32_t place)
 
uint32_t hex_to_digit (char c)
 
std::shared_ptr< baseparse_number (std::string::iterator &it, const std::string::iterator &end)
 
std::shared_ptr< value< int64_t > > parse_int (std::string::iterator &it, const std::string::iterator &end, int base=10, const char *prefix="")
 
std::shared_ptr< value< double > > parse_float (std::string::iterator &it, const std::string::iterator &end)
 
std::shared_ptr< value< bool > > parse_bool (std::string::iterator &it, const std::string::iterator &end)
 
std::string::iterator find_end_of_number (std::string::iterator it, std::string::iterator end)
 
std::string::iterator find_end_of_date (std::string::iterator it, std::string::iterator end)
 
std::string::iterator find_end_of_time (std::string::iterator it, std::string::iterator end)
 
local_time read_time (std::string::iterator &it, const std::string::iterator &end)
 
std::shared_ptr< value< local_time > > parse_time (std::string::iterator &it, const std::string::iterator &end)
 
std::shared_ptr< baseparse_date (std::string::iterator &it, const std::string::iterator &end)
 
std::shared_ptr< baseparse_array (std::string::iterator &it, std::string::iterator &end)
 
template<class Value >
std::shared_ptr< arrayparse_value_array (std::string::iterator &it, std::string::iterator &end)
 
template<class Object , class Function >
std::shared_ptr< Object > parse_object_array (Function &&fun, char delim, std::string::iterator &it, std::string::iterator &end)
 
std::shared_ptr< tableparse_inline_table (std::string::iterator &it, std::string::iterator &end)
 
void skip_whitespace_and_comments (std::string::iterator &start, std::string::iterator &end)
 
void consume_whitespace (std::string::iterator &it, const std::string::iterator &end)
 
void consume_backwards_whitespace (std::string::iterator &back, const std::string::iterator &front)
 
void eol_or_comment (const std::string::iterator &it, const std::string::iterator &end)
 
bool is_time (const std::string::iterator &it, const std::string::iterator &end)
 
option< parse_typedate_type (const std::string::iterator &it, const std::string::iterator &end)
 

Private Attributes

std::istream & input_
 
std::string line_
 
std::size_t line_number_ = 0
 

Detailed Description

The parser class.

Member Enumeration Documentation

◆ parse_type

enum cpptoml::parser::parse_type
strongprivate
Enumerator
STRING 
LOCAL_TIME 
LOCAL_DATE 
LOCAL_DATETIME 
OFFSET_DATETIME 
INT 
FLOAT 
BOOL 
ARRAY 
INLINE_TABLE 

Constructor & Destructor Documentation

◆ parser()

cpptoml::parser::parser ( std::istream &  stream)
inline

Parsers are constructed from streams.

Member Function Documentation

◆ consume_backwards_whitespace()

void cpptoml::parser::consume_backwards_whitespace ( std::string::iterator &  back,
const std::string::iterator &  front 
)
inlineprivate

◆ consume_whitespace()

void cpptoml::parser::consume_whitespace ( std::string::iterator &  it,
const std::string::iterator &  end 
)
inlineprivate

◆ date_type()

option<parse_type> cpptoml::parser::date_type ( const std::string::iterator &  it,
const std::string::iterator &  end 
)
inlineprivate

◆ determine_number_type()

parse_type cpptoml::parser::determine_number_type ( const std::string::iterator &  it,
const std::string::iterator &  end 
)
inlineprivate
Here is the call graph for this function:

◆ determine_value_type()

parse_type cpptoml::parser::determine_value_type ( const std::string::iterator &  it,
const std::string::iterator &  end 
)
inlineprivate
Here is the call graph for this function:

◆ eol_or_comment()

void cpptoml::parser::eol_or_comment ( const std::string::iterator &  it,
const std::string::iterator &  end 
)
inlineprivate

◆ find_end_of_date()

std::string::iterator cpptoml::parser::find_end_of_date ( std::string::iterator  it,
std::string::iterator  end 
)
inlineprivate
Here is the call graph for this function:

◆ find_end_of_number()

std::string::iterator cpptoml::parser::find_end_of_number ( std::string::iterator  it,
std::string::iterator  end 
)
inlineprivate
Here is the call graph for this function:

◆ find_end_of_time()

std::string::iterator cpptoml::parser::find_end_of_time ( std::string::iterator  it,
std::string::iterator  end 
)
inlineprivate
Here is the call graph for this function:

◆ hex_to_digit()

uint32_t cpptoml::parser::hex_to_digit ( char  c)
inlineprivate
Here is the call graph for this function:

◆ is_time()

bool cpptoml::parser::is_time ( const std::string::iterator &  it,
const std::string::iterator &  end 
)
inlineprivate

◆ operator=()

parser& cpptoml::parser::operator= ( const parser parser)
delete

◆ parse()

std::shared_ptr<table> cpptoml::parser::parse ( )
inline

Parses the stream this parser was created on until EOF.

Exceptions
parse_exceptionif there are errors in parsing
Here is the call graph for this function:
Here is the caller graph for this function:

◆ parse_array()

std::shared_ptr<base> cpptoml::parser::parse_array ( std::string::iterator &  it,
std::string::iterator &  end 
)
inlineprivate
Here is the call graph for this function:

◆ parse_bare_key()

std::string cpptoml::parser::parse_bare_key ( std::string::iterator &  it,
const std::string::iterator &  end 
)
inlineprivate

◆ parse_bool()

std::shared_ptr<value<bool> > cpptoml::parser::parse_bool ( std::string::iterator &  it,
const std::string::iterator &  end 
)
inlineprivate
Here is the call graph for this function:

◆ parse_date()

std::shared_ptr<base> cpptoml::parser::parse_date ( std::string::iterator &  it,
const std::string::iterator &  end 
)
inlineprivate
Here is the call graph for this function:

◆ parse_escape_code()

std::string cpptoml::parser::parse_escape_code ( std::string::iterator &  it,
const std::string::iterator &  end 
)
inlineprivate

◆ parse_float()

std::shared_ptr<value<double> > cpptoml::parser::parse_float ( std::string::iterator &  it,
const std::string::iterator &  end 
)
inlineprivate

◆ parse_hex()

uint32_t cpptoml::parser::parse_hex ( std::string::iterator &  it,
const std::string::iterator &  end,
uint32_t  place 
)
inlineprivate
Here is the call graph for this function:

◆ parse_inline_table()

std::shared_ptr<table> cpptoml::parser::parse_inline_table ( std::string::iterator &  it,
std::string::iterator &  end 
)
inlineprivate
Here is the call graph for this function:
Here is the caller graph for this function:

◆ parse_int()

std::shared_ptr<value<int64_t> > cpptoml::parser::parse_int ( std::string::iterator &  it,
const std::string::iterator &  end,
int  base = 10,
const char *  prefix = "" 
)
inlineprivate

◆ parse_key()

template<class KeyEndFinder , class KeyPartHandler >
std::string cpptoml::parser::parse_key ( std::string::iterator &  it,
const std::string::iterator &  end,
KeyEndFinder &&  key_end,
KeyPartHandler &&  key_part_handler 
)
inlineprivate

◆ parse_key_value()

void cpptoml::parser::parse_key_value ( std::string::iterator &  it,
std::string::iterator &  end,
table curr_table 
)
inlineprivate
Here is the call graph for this function:

◆ parse_multiline_string()

std::shared_ptr<value<std::string> > cpptoml::parser::parse_multiline_string ( std::string::iterator &  it,
std::string::iterator &  end,
char  delim 
)
inlineprivate
Here is the call graph for this function:

◆ parse_number()

std::shared_ptr<base> cpptoml::parser::parse_number ( std::string::iterator &  it,
const std::string::iterator &  end 
)
inlineprivate
Here is the call graph for this function:

◆ parse_object_array()

template<class Object , class Function >
std::shared_ptr<Object> cpptoml::parser::parse_object_array ( Function &&  fun,
char  delim,
std::string::iterator &  it,
std::string::iterator &  end 
)
inlineprivate

◆ parse_simple_key()

std::string cpptoml::parser::parse_simple_key ( std::string::iterator &  it,
const std::string::iterator &  end 
)
inlineprivate

◆ parse_single_table()

void cpptoml::parser::parse_single_table ( std::string::iterator &  it,
const std::string::iterator &  end,
table *&  curr_table 
)
inlineprivate
Here is the call graph for this function:

◆ parse_string()

std::shared_ptr<value<std::string> > cpptoml::parser::parse_string ( std::string::iterator &  it,
std::string::iterator &  end 
)
inlineprivate

◆ parse_table()

void cpptoml::parser::parse_table ( std::string::iterator &  it,
const std::string::iterator &  end,
table *&  curr_table 
)
inlineprivate

◆ parse_table_array()

void cpptoml::parser::parse_table_array ( std::string::iterator &  it,
const std::string::iterator &  end,
table *&  curr_table 
)
inlineprivate
Here is the call graph for this function:

◆ parse_time()

std::shared_ptr<value<local_time> > cpptoml::parser::parse_time ( std::string::iterator &  it,
const std::string::iterator &  end 
)
inlineprivate
Here is the call graph for this function:

◆ parse_unicode()

std::string cpptoml::parser::parse_unicode ( std::string::iterator &  it,
const std::string::iterator &  end 
)
inlineprivate

◆ parse_value()

std::shared_ptr<base> cpptoml::parser::parse_value ( std::string::iterator &  it,
std::string::iterator &  end 
)
inlineprivate

◆ parse_value_array()

template<class Value >
std::shared_ptr<array> cpptoml::parser::parse_value_array ( std::string::iterator &  it,
std::string::iterator &  end 
)
inlineprivate
Here is the call graph for this function:

◆ read_time()

local_time cpptoml::parser::read_time ( std::string::iterator &  it,
const std::string::iterator &  end 
)
inlineprivate
Here is the call graph for this function:

◆ skip_whitespace_and_comments()

void cpptoml::parser::skip_whitespace_and_comments ( std::string::iterator &  start,
std::string::iterator &  end 
)
inlineprivate
Here is the call graph for this function:

◆ string_literal()

std::string cpptoml::parser::string_literal ( std::string::iterator &  it,
const std::string::iterator &  end,
char  delim 
)
inlineprivate

◆ throw_parse_exception()

void cpptoml::parser::throw_parse_exception ( const std::string &  err)
inlineprivate

Member Data Documentation

◆ input_

std::istream& cpptoml::parser::input_
private

◆ line_

std::string cpptoml::parser::line_
private

◆ line_number_

std::size_t cpptoml::parser::line_number_ = 0
private

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