forgeant docs-test-0
Build LLM-powered agents in C++
Loading...
Searching...
No Matches
forgeant::Json Class Reference

#include <json.hpp>

Public Types

using null_t = std::nullptr_t
 
using boolean_t = bool
 
using integer_t = std::int64_t
 
using number_t = double
 
using string_t = std::string
 
using array_t = std::vector< Json >
 
using object_t = std::map< std::string, Json >
 
using iterator = array_t::iterator
 
using const_iterator = array_t::const_iterator
 

Public Member Functions

 Json ()
 
 Json (std::nullptr_t)
 
template<typename T >
requires std::same_as<T, bool>
 Json (T b)
 
template<typename T >
requires (std::integral<T> && !std::same_as<T, bool>)
 Json (T n)
 
template<typename T >
requires std::floating_point<T>
 Json (T d)
 
 Json (const char *s)
 
 Json (std::string_view sv)
 
 Json (string_t s)
 
 Json (array_t arr)
 
 Json (object_t obj)
 
 Json (const Json &)=default
 
 Json (Json &&) noexcept=default
 
Jsonoperator= (const Json &)=default
 
Jsonoperator= (Json &&) noexcept=default
 
 ~Json ()=default
 
bool is_null () const
 
bool is_boolean () const
 
bool is_number () const
 
bool is_string () const
 
bool is_array () const
 
bool is_object () const
 
Jsonoperator[] (const std::string &key)
 
const Jsonoperator[] (const std::string &key) const
 
Jsonoperator[] (std::size_t index)
 
const Jsonoperator[] (std::size_t index) const
 
Jsonat (const std::string &key)
 
const Jsonat (const std::string &key) const
 
template<typename T >
value (const std::string &key, const T &default_value) const
 
std::string value (const std::string &key, const char *default_value) const
 
bool contains (const std::string &key) const
 
void push_back (Json val)
 
bool empty () const
 
std::size_t size () const
 
iterator begin ()
 
iterator end ()
 
const_iterator begin () const
 
const_iterator end () const
 
template<typename T >
get () const
 
template<typename T >
void get_to (T &val) const
 
bool operator== (const Json &other) const
 
std::string dump () const
 

Static Public Member Functions

static Json parse (std::string_view input)
 
static Json array ()
 
static Json array (std::initializer_list< Json > init)
 
static Json object ()
 
static Json object (std::initializer_list< std::pair< const std::string, Json > > init)
 

Member Typedef Documentation

◆ array_t

using forgeant::Json::array_t = std::vector<Json>

◆ boolean_t

◆ const_iterator

using forgeant::Json::const_iterator = array_t::const_iterator

◆ integer_t

using forgeant::Json::integer_t = std::int64_t

◆ iterator

using forgeant::Json::iterator = array_t::iterator

◆ null_t

using forgeant::Json::null_t = std::nullptr_t

◆ number_t

using forgeant::Json::number_t = double

◆ object_t

using forgeant::Json::object_t = std::map<std::string, Json>

◆ string_t

using forgeant::Json::string_t = std::string

Constructor & Destructor Documentation

◆ Json() [1/12]

forgeant::Json::Json ( )
inline

◆ Json() [2/12]

forgeant::Json::Json ( std::nullptr_t  )
inline

◆ Json() [3/12]

template<typename T >
requires std::same_as<T, bool>
forgeant::Json::Json ( b)
inline

◆ Json() [4/12]

template<typename T >
requires (std::integral<T> && !std::same_as<T, bool>)
forgeant::Json::Json ( n)
inline

◆ Json() [5/12]

template<typename T >
requires std::floating_point<T>
forgeant::Json::Json ( d)
inline

◆ Json() [6/12]

forgeant::Json::Json ( const char *  s)
inline

◆ Json() [7/12]

forgeant::Json::Json ( std::string_view  sv)
inline

◆ Json() [8/12]

forgeant::Json::Json ( string_t  s)
inline

◆ Json() [9/12]

forgeant::Json::Json ( array_t  arr)
inline

◆ Json() [10/12]

forgeant::Json::Json ( object_t  obj)
inline

◆ Json() [11/12]

forgeant::Json::Json ( const Json )
default

◆ Json() [12/12]

forgeant::Json::Json ( Json &&  )
defaultnoexcept

◆ ~Json()

forgeant::Json::~Json ( )
default

Member Function Documentation

◆ array() [1/2]

static Json forgeant::Json::array ( )
inlinestatic

◆ array() [2/2]

static Json forgeant::Json::array ( std::initializer_list< Json init)
inlinestatic

◆ at() [1/2]

Json & forgeant::Json::at ( const std::string &  key)
inline

◆ at() [2/2]

const Json & forgeant::Json::at ( const std::string &  key) const
inline

◆ begin() [1/2]

iterator forgeant::Json::begin ( )
inline

◆ begin() [2/2]

const_iterator forgeant::Json::begin ( ) const
inline

◆ contains()

bool forgeant::Json::contains ( const std::string &  key) const
inline

◆ dump()

std::string forgeant::Json::dump ( ) const

◆ empty()

bool forgeant::Json::empty ( ) const
inline

◆ end() [1/2]

iterator forgeant::Json::end ( )
inline

◆ end() [2/2]

const_iterator forgeant::Json::end ( ) const
inline

◆ get()

template<typename T >
T forgeant::Json::get ( ) const
inline

◆ get_to()

template<typename T >
void forgeant::Json::get_to ( T &  val) const
inline

◆ is_array()

bool forgeant::Json::is_array ( ) const
inline

◆ is_boolean()

bool forgeant::Json::is_boolean ( ) const
inline

◆ is_null()

bool forgeant::Json::is_null ( ) const
inline

◆ is_number()

bool forgeant::Json::is_number ( ) const
inline

◆ is_object()

bool forgeant::Json::is_object ( ) const
inline

◆ is_string()

bool forgeant::Json::is_string ( ) const
inline

◆ object() [1/2]

static Json forgeant::Json::object ( )
inlinestatic

◆ object() [2/2]

static Json forgeant::Json::object ( std::initializer_list< std::pair< const std::string, Json > >  init)
inlinestatic

◆ operator=() [1/2]

Json & forgeant::Json::operator= ( const Json )
default

◆ operator=() [2/2]

Json & forgeant::Json::operator= ( Json &&  )
defaultnoexcept

◆ operator==()

bool forgeant::Json::operator== ( const Json other) const
inline

◆ operator[]() [1/4]

Json & forgeant::Json::operator[] ( const std::string &  key)
inline

◆ operator[]() [2/4]

const Json & forgeant::Json::operator[] ( const std::string &  key) const
inline

◆ operator[]() [3/4]

Json & forgeant::Json::operator[] ( std::size_t  index)
inline

◆ operator[]() [4/4]

const Json & forgeant::Json::operator[] ( std::size_t  index) const
inline

◆ parse()

static Json forgeant::Json::parse ( std::string_view  input)
static

◆ push_back()

void forgeant::Json::push_back ( Json  val)
inline

◆ size()

std::size_t forgeant::Json::size ( ) const
inline

◆ value() [1/2]

std::string forgeant::Json::value ( const std::string &  key,
const char *  default_value 
) const
inline

◆ value() [2/2]

template<typename T >
T forgeant::Json::value ( const std::string &  key,
const T &  default_value 
) const
inline

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