MCPcopy Create free account
hub / github.com/CppCXY/EmmyLuaCodeStyle / empty

Function empty

3rd/nlohmann_json/single_include/nlohmann/json.hpp:22636–22671  ·  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 | `false` string

Source from the content-addressed store, hash-verified

22634 @since version 1.0.0
22635 */
22636 bool empty() const noexcept
22637 {
22638 switch (m_type)
22639 {
22640 case value_t::null:
22641 {
22642 // null values are empty
22643 return true;
22644 }
22645
22646 case value_t::array:
22647 {
22648 // delegate call to array_t::empty()
22649 return m_value.array->empty();
22650 }
22651
22652 case value_t::object:
22653 {
22654 // delegate call to object_t::empty()
22655 return m_value.object->empty();
22656 }
22657
22658 case value_t::string:
22659 case value_t::boolean:
22660 case value_t::number_integer:
22661 case value_t::number_unsigned:
22662 case value_t::number_float:
22663 case value_t::binary:
22664 case value_t::discarded:
22665 default:
22666 {
22667 // all other types are nonempty
22668 return false;
22669 }
22670 }
22671 }
22672
22673 /*!
22674 @brief returns the number of elements

Callers 4

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

Calls 1

emptyMethod · 0.45

Tested by

no test coverage detected