MCPcopy Create free account
hub / github.com/OpenVPN/openvpn3-linux / SetValue

Method SetValue

src/common/configfileparser.cpp:235–261  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

233
234
235void File::SetValue(const std::string &key, const std::string &value)
236{
237 configure_mapping();
238
239 auto it = std::find_if(map.begin(),
240 map.end(),
241 [key](OptionMapEntry &e)
242 {
243 return key == e.option;
244 });
245 if (it == map.end())
246 {
247 throw OptionNotFound(key);
248 }
249
250 if (OptionValueType::Present == it->type)
251 {
252 it->present = true;
253 it->present_value = ("1" == value || "yes" == value || "true" == value);
254 it->value = "";
255 }
256 else
257 {
258 it->value = value;
259 it->present = !value.empty();
260 }
261}
262
263
264void File::SetValue(const std::string &key, const int value)

Callers 6

save_propertyMethod · 0.80
configure_loggerFunction · 0.80
configure_netcfgFunction · 0.80
cmd_netcfg_serviceFunction · 0.80
manage_config_fileFunction · 0.80
TEST_FFunction · 0.80

Calls 2

OptionNotFoundClass · 0.85
emptyMethod · 0.45

Tested by 1

TEST_FFunction · 0.64