MCPcopy Create free account
hub / github.com/EmmyLua/EmmyLuaDebugger / value

Function value

third-party/nlohmann/include/nlohmann/json.hpp:2157–2173  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2155 detail::is_getable<basic_json_t, ValueType>::value
2156 && !std::is_same<value_t, ValueType>::value, int >::type = 0 >
2157 ValueType value(const typename object_t::key_type& key, const ValueType& default_value) const
2158 {
2159 // at only works for objects
2160 if (JSON_HEDLEY_LIKELY(is_object()))
2161 {
2162 // if key is found, return value and given default value otherwise
2163 const auto it = find(key);
2164 if (it != end())
2165 {
2166 return it->template get<ValueType>();
2167 }
2168
2169 return default_value;
2170 }
2171
2172 JSON_THROW(type_error::create(306, "cannot use value() with " + std::string(type_name()), *this));
2173 }
2174
2175 /// @brief access specified object element with default value
2176 /// @sa https://json.nlohmann.me/api/basic_json/value/

Callers

nothing calls this directly

Calls 5

is_objectFunction · 0.85
findFunction · 0.85
endFunction · 0.85
createFunction · 0.85
type_nameFunction · 0.85

Tested by

no test coverage detected