MCPcopy Create free account
hub / github.com/Tencent/TAD_Sim / set_config

Method set_config

simcore/framework/src/cli/cli.hpp:5424–5445  ·  view source on GitHub ↗

Set a configuration ini file option, or clear it if no name passed

Source from the content-addressed store, hash-verified

5422
5423 /// Set a configuration ini file option, or clear it if no name passed
5424 Option *set_config(std::string option_name = "", std::string default_filename = "",
5425 const std::string &help_message = "Read an ini file", bool config_required = false) {
5426 // Remove existing config if present
5427 if (config_ptr_ != nullptr) {
5428 remove_option(config_ptr_);
5429 config_ptr_ = nullptr; // need to remove the config_ptr completely
5430 }
5431
5432 // Only add config if option passed
5433 if (!option_name.empty()) {
5434 config_ptr_ = add_option(option_name, help_message);
5435 if (config_required) {
5436 config_ptr_->required();
5437 }
5438 if (!default_filename.empty()) {
5439 config_ptr_->default_str(std::move(default_filename));
5440 }
5441 config_ptr_->configurable(false);
5442 }
5443
5444 return config_ptr_;
5445 }
5446
5447 /// Removes an option from the App. Takes an option pointer. Returns true if found and removed.
5448 bool remove_option(Option *opt) {

Callers

nothing calls this directly

Calls 4

default_strMethod · 0.80
emptyMethod · 0.45
requiredMethod · 0.45
configurableMethod · 0.45

Tested by

no test coverage detected