MCPcopy Create free account
hub / github.com/ceph/ceph / get_value_via_strmap

Function get_value_via_strmap

src/common/str_map.cc:168–184  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

166}
167
168std::string get_value_via_strmap(
169 const string& conf_string,
170 std::string_view default_key)
171{
172 auto mp = get_str_map(conf_string);
173 if (mp.size() != 1) {
174 return "";
175 }
176
177 // if the one-elem "map" is of the form { 'value' : '' }
178 // replace it with { 'default_key' : 'value' }
179 const auto& [k, v] = *(mp.begin());
180 if (v.empty()) {
181 return k;
182 }
183 return v;
184}
185
186std::string get_value_via_strmap(
187 const string& conf_string,

Callers 1

Calls 4

get_str_mapFunction · 0.85
sizeMethod · 0.45
beginMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected