29 const map_t *m_object;
43 Json get(
const char *key)
const;
51 Json operator[](
const char *key)
const;
86 Json get(
size_t index)
const;
94 Json operator[](
size_t index)
const;
99 size_t length()
const;
183 constexpr
operator bool()
const {
return is_valid(); }
203 CT_PUREFN std::string_view as_string()
const;
209 void as_integer(mpz_t integer)
const;
249 Json get(
const char *key)
const;
257 Json get(
size_t index)
const;
270 Json operator[](
const char *key)
const;
278 Json operator[](
size_t index)
const;
289 switch (get_kind()) {
290 case eJsonString:
return func(as_string());
291 case eJsonInteger:
return func(m_ast->
integer);
292 case eJsonFloat:
return func(as_float());
293 case eJsonBoolean:
return func(as_bool());
294 case eJsonArray:
return func(as_array());
295 case eJsonObject:
return func(as_object());
296 case eJsonNull:
return func(
nullptr);
297 default:
CT_NEVER(
"invalid json kind %d", get_kind());
327 bool operator!=(
const ObjectIterator& other)
const;
328 ObjectIterator &operator++();
329 member_t operator*()
const;
331 bool has_next()
const;
350 Json operator*()
const;
an iterator over the values of a json array
logger_t * get_logger() const
get the logger
a json value a json node from a parsed json document
constexpr CT_PUREFN bool is_valid() const
check if the value is valid this should always be checked before using any other methods
auto visit(F &&func) const
visit the value calls the appropriate function for the value kind
constexpr json_t * get_ast() const
get the underlying ast node
constexpr Json(json_t *ast)
an iterator over the members of a json object
#define CT_PUREFN
mark a function as pure, always returns the same value for the same arguments
json_kind_t
the kind of json value
#define CT_NEVER(...)
assert that a code path is never reached
a member of a json object
Json value
the value of the member
std::string_view key
the key of the member
mpz_t integer
the integer value of this node
a key-value pair in a map
A vector with a fixed type size.