Guitar
Classes | Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
jstream::Reader Class Reference

#include <jstream.h>

Collaboration diagram for jstream::Reader:
Collaboration graph
[legend]

Classes

struct  Error
 
struct  ParserData
 
struct  StateItem
 

Public Member Functions

 Reader (std::string_view const &sv)
 
 Reader (char const *begin, char const *end)
 
 Reader (char const *ptr, int len=-1)
 
 Reader (Reader &&r)
 
Readeroperator= (Reader &&r)
 
 Reader (Reader const &r)=delete
 
Readeroperator= (Reader const &r)=delete
 
void allow_comment (bool allow)
 
void allow_ambiguous_comma (bool allow)
 
void allow_unquoted_key (bool allow)
 
void allow_hexadicimal (bool allow)
 
void allow_special_constant (bool allow)
 
void allow_key_in_array (bool allow)
 
void reset ()
 
void hold ()
 
void nest (std::function< void()> callback_fn={})
 
bool next ()
 
StateType state () const
 
bool has_error () const
 
std::vector< Error > const & errors () const
 
bool is_start_object () const
 
bool is_end_object () const
 
bool is_start_array () const
 
bool is_end_array () const
 
bool is_constant () const
 
bool is_structure () const
 
bool is_value () const
 
std::string key () const
 
std::string string () const
 
StateType symbol () const
 
bool isnull () const
 
bool isfalse () const
 
bool istrue () const
 
bool isnumber () const
 
bool isstring () const
 
double number () const
 
bool isarray () const
 
int depth () const
 
std::string path () const
 
std::string_view extract ()
 
bool match (std::string_view path, bool match_end_structure=false) const
 
bool match_start_object (char const *path) const
 
bool match_end_object (char const *path) const
 
bool match_start_array (char const *path) const
 
bool match_end_array (char const *path) const
 
uintptr_t tell () const
 
std::string_view extract (uintptr_t begin, uintptr_t end)
 

Private Member Functions

int scan_space (char const *begin, char const *end)
 
int parse_symbol (char const *begin, char const *end, std::string *out)
 
int parse_number (char const *begin, char const *end, double *out)
 
int parse_string (char const *begin, char const *end, std::string *out)
 
void push_error (std::string const &what)
 
void push_state (StateItem s)
 
bool pop_state ()
 
void parse (char const *begin, char const *end)
 
void parse (std::string_view const &sv)
 
void parse (char const *ptr, int len=-1)
 
bool _internal_next ()
 

Static Private Member Functions

static std::string to_stdstr (std::vector< char > const &vec)
 
static void _init (ParserData *d)
 

Private Attributes

ParserData d
 

Constructor & Destructor Documentation

◆ Reader() [1/5]

jstream::Reader::Reader ( std::string_view const &  sv)
inline
Here is the call graph for this function:

◆ Reader() [2/5]

jstream::Reader::Reader ( char const *  begin,
char const *  end 
)
inline
Here is the call graph for this function:

◆ Reader() [3/5]

jstream::Reader::Reader ( char const *  ptr,
int  len = -1 
)
inline
Here is the call graph for this function:

◆ Reader() [4/5]

jstream::Reader::Reader ( Reader &&  r)
inline
Here is the call graph for this function:

◆ Reader() [5/5]

jstream::Reader::Reader ( Reader const &  r)
delete

Member Function Documentation

◆ _init()

static void jstream::Reader::_init ( ParserData d)
inlinestaticprivate

◆ _internal_next()

bool jstream::Reader::_internal_next ( )
inlineprivate
Here is the call graph for this function:

◆ allow_ambiguous_comma()

void jstream::Reader::allow_ambiguous_comma ( bool  allow)
inline

◆ allow_comment()

void jstream::Reader::allow_comment ( bool  allow)
inline

◆ allow_hexadicimal()

void jstream::Reader::allow_hexadicimal ( bool  allow)
inline

◆ allow_key_in_array()

void jstream::Reader::allow_key_in_array ( bool  allow)
inline

◆ allow_special_constant()

void jstream::Reader::allow_special_constant ( bool  allow)
inline

◆ allow_unquoted_key()

void jstream::Reader::allow_unquoted_key ( bool  allow)
inline

◆ depth()

int jstream::Reader::depth ( ) const
inline

◆ errors()

std::vector<Error> const& jstream::Reader::errors ( ) const
inline

◆ extract() [1/2]

std::string_view jstream::Reader::extract ( )
inline

◆ extract() [2/2]

std::string_view jstream::Reader::extract ( uintptr_t  begin,
uintptr_t  end 
)
inline

◆ has_error()

bool jstream::Reader::has_error ( ) const
inline

◆ hold()

void jstream::Reader::hold ( )
inline

◆ is_constant()

bool jstream::Reader::is_constant ( ) const
inline
Here is the call graph for this function:

◆ is_end_array()

bool jstream::Reader::is_end_array ( ) const
inline
Here is the call graph for this function:

◆ is_end_object()

bool jstream::Reader::is_end_object ( ) const
inline
Here is the call graph for this function:

◆ is_start_array()

bool jstream::Reader::is_start_array ( ) const
inline
Here is the call graph for this function:

◆ is_start_object()

bool jstream::Reader::is_start_object ( ) const
inline
Here is the call graph for this function:

◆ is_structure()

bool jstream::Reader::is_structure ( ) const
inline
Here is the call graph for this function:

◆ is_value()

bool jstream::Reader::is_value ( ) const
inline
Here is the call graph for this function:

◆ isarray()

bool jstream::Reader::isarray ( ) const
inline

◆ isfalse()

bool jstream::Reader::isfalse ( ) const
inline
Here is the call graph for this function:

◆ isnull()

bool jstream::Reader::isnull ( ) const
inline
Here is the call graph for this function:

◆ isnumber()

bool jstream::Reader::isnumber ( ) const
inline
Here is the call graph for this function:

◆ isstring()

bool jstream::Reader::isstring ( ) const
inline
Here is the call graph for this function:

◆ istrue()

bool jstream::Reader::istrue ( ) const
inline
Here is the call graph for this function:

◆ key()

std::string jstream::Reader::key ( ) const
inline

◆ match()

bool jstream::Reader::match ( std::string_view  path,
bool  match_end_structure = false 
) const
inline
Here is the call graph for this function:

◆ match_end_array()

bool jstream::Reader::match_end_array ( char const *  path) const
inline
Here is the call graph for this function:

◆ match_end_object()

bool jstream::Reader::match_end_object ( char const *  path) const
inline
Here is the call graph for this function:

◆ match_start_array()

bool jstream::Reader::match_start_array ( char const *  path) const
inline
Here is the call graph for this function:

◆ match_start_object()

bool jstream::Reader::match_start_object ( char const *  path) const
inline
Here is the call graph for this function:

◆ nest()

void jstream::Reader::nest ( std::function< void()>  callback_fn = {})
inline

◆ next()

bool jstream::Reader::next ( )
inline
Here is the call graph for this function:

◆ number()

double jstream::Reader::number ( ) const
inline

◆ operator=() [1/2]

Reader& jstream::Reader::operator= ( Reader &&  r)
inline
Here is the call graph for this function:

◆ operator=() [2/2]

Reader& jstream::Reader::operator= ( Reader const &  r)
delete

◆ parse() [1/3]

void jstream::Reader::parse ( char const *  begin,
char const *  end 
)
inlineprivate
Here is the call graph for this function:

◆ parse() [2/3]

void jstream::Reader::parse ( char const *  ptr,
int  len = -1 
)
inlineprivate
Here is the call graph for this function:

◆ parse() [3/3]

void jstream::Reader::parse ( std::string_view const &  sv)
inlineprivate
Here is the call graph for this function:

◆ parse_number()

int jstream::Reader::parse_number ( char const *  begin,
char const *  end,
double *  out 
)
inlineprivate
Here is the call graph for this function:

◆ parse_string()

int jstream::Reader::parse_string ( char const *  begin,
char const *  end,
std::string *  out 
)
inlineprivate
Here is the call graph for this function:

◆ parse_symbol()

int jstream::Reader::parse_symbol ( char const *  begin,
char const *  end,
std::string *  out 
)
inlineprivate
Here is the call graph for this function:

◆ path()

std::string jstream::Reader::path ( ) const
inline
Here is the call graph for this function:

◆ pop_state()

bool jstream::Reader::pop_state ( )
inlineprivate
Here is the call graph for this function:

◆ push_error()

void jstream::Reader::push_error ( std::string const &  what)
inlineprivate

◆ push_state()

void jstream::Reader::push_state ( StateItem  s)
inlineprivate
Here is the call graph for this function:

◆ reset()

void jstream::Reader::reset ( )
inline

◆ scan_space()

int jstream::Reader::scan_space ( char const *  begin,
char const *  end 
)
inlineprivate

◆ state()

StateType jstream::Reader::state ( ) const
inline

◆ string()

std::string jstream::Reader::string ( ) const
inline

◆ symbol()

StateType jstream::Reader::symbol ( ) const
inline
Here is the call graph for this function:

◆ tell()

uintptr_t jstream::Reader::tell ( ) const
inline

◆ to_stdstr()

static std::string jstream::Reader::to_stdstr ( std::vector< char > const &  vec)
inlinestaticprivate

Member Data Documentation

◆ d

ParserData jstream::Reader::d
private

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