ljson namespace

the namespace for ljson

Classes

class array
the class that holds a json array
class error
a class type inspired by std::error_code to handle errors
template <class T = monostate, class E = monostate>
class expected
an implementation of std::expected to allow using ljson with C++20. check the cppreference
class monostate
an implementation of std::monostate to allow using ljson with C++20. check the cppreference
class node
the class that holds a json node which is either ljson::object, ljson::array or ljson::value
class null_type
an empty class to represent a json null value
class object
the class that holds a json object
class value
holds a json value such as <std::string, double, int64_t, bool, null_type, monostate>

Concepts

template <typename allowed_value_types>
concept is_allowed_value_type
puts a constraint on the allowed json types for ljson::value
template <typename container_type>
concept is_key_value_container
concept for enabling ljson::node to accept std key/value containers
template <typename allowed_node_types>
concept is_allowed_node_type
allowed types in ljson::node
template <typename value_type>
concept container_or_node_type
puts a constraint on the allowed types to be inserted into ljson::node which is container_type_concept or is_allowed_node_type
template <typename container_type>
concept is_value_container
concept for enabling ljson::node to accept std array-like containers
template <typename container_type>
concept container_type_concept
puts a constraint on the allowed std container types to be inserted into ljson::node

Enums

enum class error_type { none, key_not_found, filesystem_error, parsing_error, parsing_error_wrong_type, wrong_type, wronge_index }
error values used in ljson::error
enum class node_type { object, array, value }
this enum can be used to explicitly make a node that's either an object, array or value

Functions

template <class E>
auto unexpected(const E& e) →  expected<monostate, E> constexpr
a helper function to construct an unexpected type
auto unexpected(const char* e) →  expected<monostate, std::string> constexpr
a helper function to construct an unexpected type

Enum documentation

enum class ljson::node_type

this enum can be used to explicitly make a node that's either an object, array or value

ljson::node node(ljson::node_type::array);
ljson::node node; // default is ljson::node_type::object

Function documentation

expected<monostate, std::string> ljson::unexpected(const char* e) constexpr

a helper function to construct an unexpected type

ljson::expected<ljson::node, std::string> node = ljson::unexpected("error");