cpptoml
A C++11 parser for TOML
Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
cpptoml::parser Class Reference

The parser class. More...

#include <cpptoml.h>

Public Member Functions

 parser (std::istream &stream)
 Parsers are constructed from streams.
 
parseroperator= (const parser &parser)=delete
 
std::shared_ptr< tableparse ()
 Parses the stream this parser was created on until EOF. More...
 

Private Types

enum class  parse_type {
  STRING = 1 , LOCAL_TIME , LOCAL_DATE , LOCAL_DATETIME ,
  OFFSET_DATETIME , INT , FLOAT , BOOL ,
  ARRAY , 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_type > date_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 Function Documentation

◆ 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

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