MCPcopy Create free account
hub / github.com/InkboxSoftware/all-screen-keyboard / size

Function size

keyboard/src/json.hpp:23094–23129  ·  view source on GitHub ↗

@brief returns the number of elements @sa https://json.nlohmann.me/api/basic_json/size/

Source from the content-addressed store, hash-verified

23092 /// @brief returns the number of elements
23093 /// @sa https://json.nlohmann.me/api/basic_json/size/
23094 size_type size() const noexcept
23095 {
23096 switch (m_data.m_type)
23097 {
23098 case value_t::null:
23099 {
23100 // null values are empty
23101 return 0;
23102 }
23103
23104 case value_t::array:
23105 {
23106 // delegate call to array_t::size()
23107 return m_data.m_value.array->size();
23108 }
23109
23110 case value_t::object:
23111 {
23112 // delegate call to object_t::size()
23113 return m_data.m_value.object->size();
23114 }
23115
23116 case value_t::string:
23117 case value_t::boolean:
23118 case value_t::number_integer:
23119 case value_t::number_unsigned:
23120 case value_t::number_float:
23121 case value_t::binary:
23122 case value_t::discarded:
23123 default:
23124 {
23125 // all other types have size 1
23126 return 1;
23127 }
23128 }
23129 }
23130
23131 /// @brief returns the maximum possible number of elements
23132 /// @sa https://json.nlohmann.me/api/basic_json/max_size/

Callers 2

eraseFunction · 0.85
max_sizeFunction · 0.85

Calls 1

sizeMethod · 0.80

Tested by

no test coverage detected