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

Function empty

3rd/nlohmann_json/include/nlohmann/json.hpp:5135–5170  ·  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

5133 @since version 1.0.0
5134 */
5135 bool empty() const noexcept
5136 {
5137 switch (m_type)
5138 {
5139 case value_t::null:
5140 {
5141 // null values are empty
5142 return true;
5143 }
5144
5145 case value_t::array:
5146 {
5147 // delegate call to array_t::empty()
5148 return m_value.array->empty();
5149 }
5150
5151 case value_t::object:
5152 {
5153 // delegate call to object_t::empty()
5154 return m_value.object->empty();
5155 }
5156
5157 case value_t::string:
5158 case value_t::boolean:
5159 case value_t::number_integer:
5160 case value_t::number_unsigned:
5161 case value_t::number_float:
5162 case value_t::binary:
5163 case value_t::discarded:
5164 default:
5165 {
5166 // all other types are nonempty
5167 return false;
5168 }
5169 }
5170 }
5171
5172 /*!
5173 @brief returns the number of elements

Callers 4

parent_pointerMethod · 0.50
pop_backMethod · 0.50
json_pointerClass · 0.50
topFunction · 0.50

Calls 1

emptyMethod · 0.45

Tested by

no test coverage detected