MCPcopy Create free account
hub / github.com/OpenFodder/openfodder / empty

Function empty

Source/Utils/json.hpp:21420–21448  ·  view source on GitHub ↗

! @brief checks whether the container is empty. Checks if a JSON value has no elements (i.e. whether its @ref size is `0`). @return The return value depends on the different types and is defined as follows: Value type | return value ----------- | ------------- null | `true` boolean

Source from the content-addressed store, hash-verified

21418 @since version 1.0.0
21419 */
21420 bool empty() const noexcept
21421 {
21422 switch (m_type)
21423 {
21424 case value_t::null:
21425 {
21426 // null values are empty
21427 return true;
21428 }
21429
21430 case value_t::array:
21431 {
21432 // delegate call to array_t::empty()
21433 return m_value.array->empty();
21434 }
21435
21436 case value_t::object:
21437 {
21438 // delegate call to object_t::empty()
21439 return m_value.object->empty();
21440 }
21441
21442 default:
21443 {
21444 // all other types are nonempty
21445 return false;
21446 }
21447 }
21448 }
21449
21450 /*!
21451 @brief returns the number of elements

Callers 4

parent_pointerMethod · 0.70
pop_backMethod · 0.70
json_pointerClass · 0.70
json_pointer topFunction · 0.70

Calls 1

emptyMethod · 0.45

Tested by

no test coverage detected