MCPcopy Create free account
hub / github.com/bytedance/Fastbot_Android / value

Function value

native/thirdpart/json/json.hpp:18003–18019  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

18001 template<class ValueType, typename std::enable_if<
18002 std::is_convertible<basic_json_t, ValueType>::value, int>::type = 0>
18003 ValueType value(const typename object_t::key_type& key, const ValueType& default_value) const
18004 {
18005 // at only works for objects
18006 if (JSON_HEDLEY_LIKELY(is_object()))
18007 {
18008 // if key is found, return value and given default value otherwise
18009 const auto it = find(key);
18010 if (it != end())
18011 {
18012 return *it;
18013 }
18014
18015 return default_value;
18016 }
18017
18018 JSON_THROW(type_error::create(306, "cannot use value() with " + std::string(type_name())));
18019 }
18020
18021 /*!
18022 @brief overload for a default value of type const char*

Callers

nothing calls this directly

Calls 4

is_objectFunction · 0.85
findFunction · 0.85
createFunction · 0.85
endFunction · 0.70

Tested by

no test coverage detected