MARLEY (Model of Argon Reaction Low Energy Yields)  v1.2.0
A Monte Carlo event generator for tens-of-MeV neutrino interactions
Classes | Public Types | Public Member Functions | Static Public Member Functions | List of all members
marley::JSON Class Reference

Classes

class  JSONConstWrapper
 
class  JSONWrapper
 

Public Types

enum class  DataType {
  Null , Object , Array , String ,
  Floating , Integral , Boolean
}
 

Public Member Functions

 JSON (const JSON &other)
 
 JSON (const std::string &s)
 
 JSON (JSON &&other)
 
 JSON (std::initializer_list< JSON > list)
 
 JSON (std::nullptr_t)
 
template<typename T >
 JSON (T b, typename std::enable_if< std::is_same< T, bool >::value >::type *=0)
 
template<typename T >
 JSON (T f, typename std::enable_if< std::is_floating_point< T >::value >::type *=0)
 
template<typename T >
 JSON (T i, typename std::enable_if< std::is_integral< T >::value &&!std::is_same< T, bool >::value >::type *=0)
 
template<typename T >
void append (T arg)
 
template<typename T , typename... U>
void append (T arg, U... args)
 
JSONWrapper< std::deque< JSON > > array_range ()
 
JSONConstWrapper< std::deque< JSON > > array_range () const
 
JSONat (const std::string &key)
 
const JSONat (const std::string &key) const
 
JSONat (unsigned index)
 
const JSONat (unsigned index) const
 
std::string dump_string (const int indent_step=-1) const
 
bool get_bool (const std::string &key)
 
bool get_bool (const std::string &key, bool default_value)
 
double get_double (const std::string &key)
 
double get_double (const std::string &key, double default_value)
 
long get_long (const std::string &key)
 
long get_long (const std::string &key, long default_value)
 
marley::JSON get_object (const std::string &key, bool throw_error=true)
 
std::string get_string (const std::string &key)
 
std::string get_string (const std::string &key, const std::string &default_value)
 
bool has_key (const std::string &key) const
 
bool is_array () const
 
bool is_bool () const
 
bool is_float () const
 
bool is_integer () const
 
bool is_null () const
 Functions for getting primitives from the JSON object.
 
bool is_object () const
 
bool is_string () const
 
int length () const
 
JSONWrapper< std::map< std::string, JSON > > object_range ()
 
JSONConstWrapper< std::map< std::string, JSON > > object_range () const
 
JSONoperator= (const JSON &other)
 
JSONoperator= (JSON &&other)
 
template<typename T >
std::enable_if< std::is_same< T, bool >::value, JSON & >::type operator= (T b)
 
template<typename T >
std::enable_if< std::is_floating_point< T >::value, JSON & >::type operator= (T f)
 
template<typename T >
std::enable_if< std::is_integral< T >::value &&!std::is_same< T, bool >::value, JSON & >::type operator= (T i)
 
template<typename T >
std::enable_if< std::is_convertible< T, std::string >::value, JSON & >::type operator= (T s)
 
JSONoperator[] (const std::string &key)
 
JSONoperator[] (unsigned index)
 
void print (std::ostream &out, const unsigned int indent_step, bool pretty, const unsigned int current_indent=0) const
 
int size () const
 
bool to_bool () const
 
bool to_bool (bool &ok) const
 
bool to_bool_or_throw () const
 
double to_double () const
 
double to_double (bool &ok) const
 
double to_double_or_throw () const
 
long to_long () const
 
long to_long (bool &ok) const
 
long to_long_or_throw () const
 
std::string to_string () const
 
std::string to_string (bool &ok) const
 
std::string to_string_or_throw () const
 
DataType type () const
 

Static Public Member Functions

static JSON array ()
 
template<typename... T>
static JSON array (T... args)
 
static JSON load (const std::string &s)
 
static JSON load (std::istream &is)
 
static JSON load_file (const std::string &s)
 
static JSON make (DataType type)
 
static JSON object ()
 

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