A toolkit for working with phylogenetic data.
v0.19.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
JsonReader Class Reference

#include <genesis/utils/formats/json/reader.hpp>

Detailed Description

Read Json data into a JsonDocument.

This class provides functions for parsing json data into a JsonDocument. The parsing works this way: Each JsonDocument is also a Json object, and can contain other objects, arrays, or simple value types. The parsing here is thus splitted in different functions, being recursively called for every level of nesting within objects and arrays.

Definition at line 59 of file utils/formats/json/reader.hpp.

Public Member Functions

 JsonReader ()=default
 
 JsonReader (JsonReader const &)=default
 
 JsonReader (JsonReader &&)=default
 
 ~JsonReader ()=default
 
JsonDocument from_file (const std::string &filename) const
 Take a JSON document file path and parse its contents into a JsonDocument. More...
 
JsonDocument from_stream (std::istream &input_stream) const
 Read from a stream containing a JSON document and parse its contents into a JsonDocument. More...
 
JsonDocument from_string (const std::string &json) const
 Take a string containing a JSON document and parse its contents into a JsonDocument. More...
 
JsonReaderoperator= (JsonReader const &)=default
 
JsonReaderoperator= (JsonReader &&)=default
 
JsonDocument parse (InputStream &input_stream) const
 
JsonDocument parse_array (InputStream &input_stream) const
 
JsonDocument parse_number (InputStream &input_stream) const
 
JsonDocument parse_object (InputStream &input_stream) const
 
JsonDocument parse_value (InputStream &input_stream) const
 

Constructor & Destructor Documentation

JsonReader ( )
default
~JsonReader ( )
default
JsonReader ( JsonReader const &  )
default
JsonReader ( JsonReader &&  )
default

Member Function Documentation

JsonDocument from_file ( const std::string &  filename) const

Take a JSON document file path and parse its contents into a JsonDocument.

If the file does not exists, the function throws.

Definition at line 61 of file utils/formats/json/reader.cpp.

JsonDocument from_stream ( std::istream &  input_stream) const

Read from a stream containing a JSON document and parse its contents into a JsonDocument.

Definition at line 55 of file utils/formats/json/reader.cpp.

JsonDocument from_string ( const std::string &  json) const

Take a string containing a JSON document and parse its contents into a JsonDocument.

Definition at line 67 of file utils/formats/json/reader.cpp.

JsonReader& operator= ( JsonReader const &  )
default
JsonReader& operator= ( JsonReader &&  )
default
JsonDocument parse ( InputStream input_stream) const

Definition at line 81 of file utils/formats/json/reader.cpp.

JsonDocument parse_array ( InputStream input_stream) const

Definition at line 159 of file utils/formats/json/reader.cpp.

JsonDocument parse_number ( InputStream input_stream) const

Definition at line 260 of file utils/formats/json/reader.cpp.

JsonDocument parse_object ( InputStream input_stream) const

Definition at line 205 of file utils/formats/json/reader.cpp.

JsonDocument parse_value ( InputStream input_stream) const

Definition at line 97 of file utils/formats/json/reader.cpp.


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