SNode.C
Loading...
Searching...
No Matches
ConfigDb Class Reference
Inheritance diagram for ConfigDb:
Collaboration diagram for ConfigDb:

Public Member Functions

 ConfigDb (SubCommand *parent)
ConfigDbsetHost (const std::string &host)
std::string getHost ()
 ConfigDb (SubCommand *parent)
ConfigDbsetHost (const std::string &host)
std::string getHost ()
Public Member Functions inherited from utils::SubCommand
 SubCommand (const SubCommand &)=delete
 SubCommand (SubCommand &&)=delete
SubCommandoperator= (const SubCommand &)=delete
SubCommandoperator= (SubCommand &&)=delete
virtual ~SubCommand ()
std::string getName () const
std::string version () const
CLI::Option * setConfig (const std::string &defaultConfigFile) const
CLI::Option * setLogFile (const std::string &defaultLogFile) const
CLI::Option * setVersionFlag (const std::string &version) const
bool hasParent () const
SubCommandgetParent () const
SubCommandallowExtras (bool allow=true)
SubCommandrequired (bool required=true, bool force=true)
SubCommandrequired (SubCommand *subCommand, bool required=true)
SubCommandrequired (CLI::Option *option, bool required=true)
bool getRequired () const
SubCommandneeds (SubCommand *subCommand, bool needs=true)
SubCommanddisabled (SubCommand *subCommand, bool disabled=true)
SubCommandsetRequireCallback (const std::function< void(void)> &callback)
SubCommandfinalCallback (const std::function< void()> &finalCallback)
std::string configToStr () const
std::string help (const CLI::App *helpApp, const CLI::AppFormatMode &mode) const
void addSubCommandApp (std::shared_ptr< utils::AppWithPtr > subCommand)
template<typename NewSubCommand, typename... Args>
NewSubCommand * newSubCommand (Args &&... args)
template<typename RequestedSubCommand>
RequestedSubCommand * getSubCommand ()
template<typename RequestedSubCommand>
RequestedSubCommand * getSubCommand () const
CLI::Option * getOption (const std::string &name) const
CLI::Option * addOption (const std::string &name, const std::string &description, const std::string &typeName, const CLI::Validator &validator) const
template<typename ValueTypeT>
CLI::Option * addOption (const std::string &name, const std::string &description, const std::string &typeName, ValueTypeT defaultValue, const CLI::Validator &validator) const
template<typename ValueTypeT>
CLI::Option * addOptionVariable (const std::string &name, ValueTypeT &variable, const std::string &description, const std::string &typeName, const CLI::Validator &additionalValidator) const
template<typename ValueTypeT>
CLI::Option * addOptionVariable (const std::string &name, ValueTypeT &variable, const std::string &description, const std::string &typeName, ValueTypeT defaultValue, const CLI::Validator &additionalValidator) const
CLI::Option * addOptionFunction (const std::string &name, const std::function< void(const std::string &)> &callback, const std::string &description, const std::string &typeName, const CLI::Validator &validator) const
template<typename ValueTypeT>
CLI::Option * addOptionFunction (const std::string &name, const std::function< void(const std::string &)> &callback, const std::string &description, const std::string &typeName, ValueTypeT defaultValue, const CLI::Validator &validator) const
CLI::Option * addFlag (const std::string &name, const std::string &description, const std::string &typeName, const CLI::Validator &validator) const
template<typename ValueTypeT>
CLI::Option * addFlag (const std::string &name, const std::string &description, const std::string &typeName, ValueTypeT defaultValue, const CLI::Validator &validator) const
CLI::Option * addFlagFunction (const std::string &name, const std::function< void()> &callback, const std::string &description, const std::string &typeName, const CLI::Validator &validator) const
CLI::Option * addFlagFunction (const std::string &name, const std::function< void()> &callback, const std::string &description, const std::string &typeName, const std::string &defaultValue, const CLI::Validator &validator) const

Static Public Attributes

static constexpr std::string_view NAME {"db"}
static constexpr std::string_view DESCRIPTION {"Database connection"}

Private Attributes

CLI::Option * hostOpt

Additional Inherited Members

Protected Member Functions inherited from utils::SubCommand
 SubCommand (SubCommand *parent, std::shared_ptr< utils::AppWithPtr > appWithPtr, const std::string &group, bool final=false)
template<typename ConcretSubCommand>
 SubCommand (SubCommand *parent, ConcretSubCommand *concretSubCommand, const std::string &group, bool final=false)
void parse (int argc, char *argv[]) const
SubCommanddescription (const std::string &description)
SubCommandfooter (const std::string &footer)
void removeSubCommand ()
template<typename ValueTypeT>
CLI::Option * setDefaultValue (CLI::Option *option, const ValueTypeT &value, bool clear=true) const
CLI::Option * setConfigurable (CLI::Option *option, bool configurable) const
Static Protected Member Functions inherited from utils::SubCommand
static CLI::App * getHelpTriggerApp ()
static CLI::App * getShowConfigTriggerApp ()
static CLI::App * getCommandlineTriggerApp ()
Protected Attributes inherited from utils::SubCommand
CLI::Option * helpOpt = nullptr
Static Protected Attributes inherited from utils::SubCommand
static std::shared_ptr< CLI::Formatter > sectionFormatter = makeSectionFormatter()
static std::map< std::string, std::string > aliases
static CLI::App * helpTriggerApp = nullptr
static CLI::App * showConfigTriggerApp = nullptr
static CLI::App * commandlineTriggerApp = nullptr

Detailed Description

Definition at line 62 of file testmariadb.cpp.

Constructor & Destructor Documentation

◆ ConfigDb() [1/2]

ConfigDb::ConfigDb ( SubCommand * parent)
inline

Definition at line 67 of file testmariadb.cpp.

68 : SubCommand(parent, this, "Database") {
70 addOption("--db-host", "Hostname or IP-Address of Server", "hostname|IPv4", CLI::TypeValidator<std::string>()), true);
71
73 }
CLI::Option * hostOpt
SubCommand * required(bool required=true, bool force=true)
SubCommand(SubCommand *parent, std::shared_ptr< utils::AppWithPtr > appWithPtr, const std::string &group, bool final=false)
SubCommand * parent
Definition SubCommand.h:253
CLI::Option * addOption(const std::string &name, const std::string &description, const std::string &typeName, const CLI::Validator &validator) const
CLI::Option * setConfigurable(CLI::Option *option, bool configurable) const

References hostOpt, and utils::SubCommand::setConfigurable().

Here is the call graph for this function:

◆ ConfigDb() [2/2]

ConfigDb::ConfigDb ( SubCommand * parent)
inline

Definition at line 67 of file testmariadb.cpp.

68 : SubCommand(parent, this, "Database") {
70 addOption("--db-host", "Hostname or IP-Address of Server", "hostname|IPv4", CLI::TypeValidator<std::string>()), true);
71
73 }

Member Function Documentation

◆ getHost() [1/2]

std::string ConfigDb::getHost ( )
inline

Definition at line 82 of file testmariadb.cpp.

82 {
83 return hostOpt->as<std::string>();
84 }

References hostOpt.

◆ getHost() [2/2]

std::string ConfigDb::getHost ( )
inline

Definition at line 82 of file testmariadb.cpp.

82 {
83 return hostOpt->as<std::string>();
84 }

◆ setHost() [1/2]

ConfigDb & ConfigDb::setHost ( const std::string & host)
inline

Definition at line 75 of file testmariadb.cpp.

75 {
77 required(hostOpt, false);
78
79 return *this;
80 }
CLI::Option * setDefaultValue(CLI::Option *option, const ValueTypeT &value, bool clear=true) const
Definition SubCommand.h:367

References hostOpt.

◆ setHost() [2/2]

ConfigDb & ConfigDb::setHost ( const std::string & host)
inline

Definition at line 75 of file testmariadb.cpp.

75 {
77 required(hostOpt, false);
78
79 return *this;
80 }

Member Data Documentation

◆ DESCRIPTION

constexpr std::string_view ConfigDb::DESCRIPTION {"Database connection"}
staticconstexpr

Definition at line 65 of file testmariadb.cpp.

65{"Database connection"};

◆ hostOpt

CLI::Option * ConfigDb::hostOpt
private

Definition at line 87 of file testmariadb.cpp.

Referenced by ConfigDb(), getHost(), and setHost().

◆ NAME

constexpr std::string_view ConfigDb::NAME {"db"}
staticconstexpr

Definition at line 64 of file testmariadb.cpp.

64{"db"};

The documentation for this class was generated from the following file: