#include <ConfigInstance.h>
Definition at line 63 of file ConfigInstance.h.
◆ Instance
◆ Role
◆ ConfigInstance() [1/3]
net::config::ConfigInstance::ConfigInstance |
( |
const std::string & |
instanceName, |
|
|
Role |
role |
|
) |
| |
|
explicitprotected |
Definition at line 75 of file ConfigInstance.cpp.
79 std::string("Configuration for ")
81 .append(" instance '")
83 .append("'"),
84 "Instances");
85
87 ->add_flag_function(
88 "--disabled{true}",
89 [this](std::size_t) {
91 },
92 "Disable this instance")
93 ->multi_option_policy(CLI::MultiOptionPolicy::TakeLast)
94 ->trigger_on_parse()
95 ->default_str("false")
96 ->type_name("bool")
97 ->check(CLI::IsMember({"true", "false"}))
98 ->group(
instanceSc->get_formatter()->get_label(
"Persistent Options"));
99 }
static void disabled(CLI::App *instance, bool disabled=true)
static CLI::App * addInstance(const std::string &name, const std::string &description, const std::string &group)
References disableOpt, instanceName, instanceSc, role, and SERVER.
◆ ~ConfigInstance()
net::config::ConfigInstance::~ConfigInstance |
( |
| ) |
|
|
protectedvirtual |
◆ ConfigInstance() [2/3]
◆ ConfigInstance() [3/3]
◆ addSection()
CLI::App * net::config::ConfigInstance::addSection |
( |
const std::string & |
name, |
|
|
const std::string & |
description, |
|
|
const std::string & |
group = "Sections" |
|
) |
| |
Definition at line 117 of file ConfigInstance.cpp.
117 {
119 ->add_subcommand(name, description)
120 ->fallthrough()
121 ->configurable(false)
122 ->allow_extras(false)
123 ->group(group)
124 ->ignore_case(false)
126
127 sectionSc
128 ->option_defaults()
129 ->configurable(!sectionSc->get_disabled());
130
131 if (!sectionSc->get_disabled()) {
134 }
135
136 return sectionSc;
137 }
static CLI::App * addStandardFlags(CLI::App *app)
static CLI::App * addSimpleHelp(CLI::App *app)
References instanceName, and instanceSc.
Referenced by net::config::ConfigSection::ConfigSection().
◆ getDisabled()
bool net::config::ConfigInstance::getDisabled |
( |
| ) |
const |
◆ getInstanceName()
const std::string & net::config::ConfigInstance::getInstanceName |
( |
| ) |
const |
Definition at line 109 of file ConfigInstance.cpp.
109 {
111 }
static const std::string nameAnonymous
References instanceName, and nameAnonymous.
Referenced by net::config::ConfigSection::addOption(), net::un::config::ConfigAddress< ConfigAddressTypeT >::ConfigAddress(), net::config::ConfigSection::ConfigSection(), tls::getClient(), legacy::getLegacyClient(), net::config::stream::tls::ConfigSocketServer< ConfigSocketServerBaseT >::getSniCtx(), net::config::stream::tls::ConfigSocketClient< ConfigSocketClientBaseT >::getSslCtx(), net::config::stream::tls::ConfigSocketServer< ConfigSocketServerBaseT >::getSslCtx(), main(), and core::socket::stream::SocketConnection::SocketConnection().
◆ getRequired()
bool net::config::ConfigInstance::getRequired |
( |
| ) |
const |
◆ getRole()
◆ getSection()
CLI::App * net::config::ConfigInstance::getSection |
( |
const std::string & |
name, |
|
|
bool |
onlyGot = false , |
|
|
bool |
recursive = false |
|
) |
| const |
Definition at line 166 of file ConfigInstance.cpp.
166 {
167 CLI::App* resultSc = (
instanceSc->got_subcommand(name) || !onlyGot) ?
instanceSc->get_subcommand_no_throw(name) :
nullptr;
168
169 if (resultSc == nullptr && recursive) {
170 CLI::App* parentSc =
instanceSc->get_parent();
171 resultSc =
172 (parentSc != nullptr && (parentSc->got_subcommand(name) || !onlyGot)) ? parentSc->get_subcommand_no_throw(name) : nullptr;
173 }
174
175 return resultSc;
176 }
References instanceSc.
Referenced by net::config::ConfigSection::ConfigSection().
◆ gotSection()
bool net::config::ConfigInstance::gotSection |
( |
const std::string & |
name, |
|
|
bool |
recursive = false |
|
) |
| const |
◆ operator=() [1/2]
◆ operator=() [2/2]
◆ required()
void net::config::ConfigInstance::required |
( |
CLI::App * |
section, |
|
|
bool |
req = true |
|
) |
| |
◆ setDisabled()
void net::config::ConfigInstance::setDisabled |
( |
bool |
disabled = true | ) |
|
◆ setInstanceName()
void net::config::ConfigInstance::setInstanceName |
( |
const std::string & |
instanceName | ) |
|
◆ net::config::ConfigSection
◆ disableOpt
CLI::Option* net::config::ConfigInstance::disableOpt = nullptr |
|
private |
◆ instanceName
std::string net::config::ConfigInstance::instanceName |
|
private |
◆ instanceSc
CLI::App* net::config::ConfigInstance::instanceSc = nullptr |
|
private |
◆ nameAnonymous
const std::string net::config::ConfigInstance::nameAnonymous = "<anonymous>" |
|
staticprivate |
◆ requiredCount
uint8_t net::config::ConfigInstance::requiredCount = 0 |
|
private |
◆ role
Role net::config::ConfigInstance::role |
|
private |
The documentation for this class was generated from the following files: