|
Cthulhu
0.2.10
Cthulhu compiler collection
|
a json value a json node from a parsed json document More...
#include <json.hpp>
Public Member Functions | |
| constexpr | Json (json_t *ast) |
| constexpr | Json () |
| CT_PUREFN bool | is_string () const |
| check if the value is a string More... | |
| CT_PUREFN bool | is_integer () const |
| check if the value is an integer More... | |
| CT_PUREFN bool | is_float () const |
| check if the value is a float More... | |
| CT_PUREFN bool | is_bool () const |
| check if the value is a boolean More... | |
| CT_PUREFN bool | is_array () const |
| check if the value is an array More... | |
| CT_PUREFN bool | is_object () const |
| check if the value is an object More... | |
| CT_PUREFN bool | is_null () const |
| check if the value is null More... | |
| constexpr CT_PUREFN bool | is_valid () const |
| check if the value is valid this should always be checked before using any other methods More... | |
| constexpr | operator bool () const |
| check if the value is valid More... | |
| CT_PUREFN json_kind_t | get_kind () const |
| get the kind of the value More... | |
| CT_PUREFN bool | is_kind (json_kind_t kind) const |
| check if the value is a specific kind More... | |
| CT_PUREFN std::string_view | as_string () const |
| get the string value More... | |
| void | as_integer (mpz_t integer) const |
| get the integer value More... | |
| CT_PUREFN float | as_float () const |
| get the float value More... | |
| CT_PUREFN bool | as_bool () const |
| get the boolean value More... | |
| CT_PUREFN Array | as_array () const |
| get the array value More... | |
| CT_PUREFN Object | as_object () const |
| get the object value More... | |
| CT_PUREFN size_t | length () const |
| get the length of an array More... | |
| Json | get (const char *key) const |
| get a value from an object by key More... | |
| Json | get (size_t index) const |
| get a value from an array by index More... | |
| constexpr json_t * | get_ast () const |
| get the underlying ast node More... | |
| Json | operator[] (const char *key) const |
| get a value from an object by key same as get(const char*) More... | |
| Json | operator[] (size_t index) const |
| get a value from an array by index same as get(size_t) More... | |
| template<typename F > | |
| auto | visit (F &&func) const |
| visit the value calls the appropriate function for the value kind More... | |
Friends | |
| class | JsonParser |
| class | Object |
| class | Array |
| class | ObjectIterator |
| class | ArrayIterator |
a json value a json node from a parsed json document
|
inlineconstexpr |
| Array Json::as_array | ( | ) | const |
get the array value
| bool Json::as_bool | ( | ) | const |
| float Json::as_float | ( | ) | const |
| void Json::as_integer | ( | mpz_t | integer | ) | const |
get the integer value
| [out] | integer | the integer output value |
| Object Json::as_object | ( | ) | const |
get the object value
| std::string_view Json::as_string | ( | ) | const |
get the string value
| Json Json::get | ( | const char * | key | ) | const |
get a value from an object by key
| key | the key to access |
key | Json Json::get | ( | size_t | index | ) | const |
get a value from an array by index
index < length| index | the index to access |
index
|
inlineconstexpr |
| json_kind_t Json::get_kind | ( | ) | const |
| bool Json::is_array | ( | ) | const |
| bool Json::is_bool | ( | ) | const |
| bool Json::is_float | ( | ) | const |
| bool Json::is_integer | ( | ) | const |
| bool Json::is_kind | ( | json_kind_t | kind | ) | const |
| bool Json::is_null | ( | ) | const |
| bool Json::is_object | ( | ) | const |
| bool Json::is_string | ( | ) | const |
|
inlineconstexpr |
| size_t Json::length | ( | ) | const |
get the length of an array
|
inlineconstexpr |
check if the value is valid
| true | if the value is valid |
| false | if the value is not valid |
| Json Json::operator[] | ( | const char * | key | ) | const |
| Json Json::operator[] | ( | size_t | index | ) | const |
|
inline |
|
friend |
|
friend |
|
friend |