Public Member Functions | List of all members
openfluid::utils::CommandLineCommand Class Reference

#include <utils/CommandLineParser.hpp>

Public Member Functions

 CommandLineCommand ()
 
 CommandLineCommand (const std::string &Name, const std::string &HelpText)
 
std::string getHelpText () const
 
std::string getName () const
 
const std::map< std::string, CommandLineOption > & options ()
 
void addOption (const CommandLineOption &Option)
 
bool activateOption (const std::string &LongName, const std::string &Value="")
 
std::string getOptionNameFromShortName (const std::string &ShortName) const
 
bool isOptionExists (const std::string &LongName) const
 
bool isOptionRequiresValue (const std::string &LongName) const
 
bool isOptionActive (const std::string &LongName) const
 
std::string getOptionValue (const std::string &LongName) const
 
void reset ()
 

Constructor & Destructor Documentation

◆ CommandLineCommand() [1/2]

openfluid::utils::CommandLineCommand::CommandLineCommand ( )
inline

◆ CommandLineCommand() [2/2]

openfluid::utils::CommandLineCommand::CommandLineCommand ( const std::string &  Name,
const std::string &  HelpText 
)
inline

Instanciates a command with the given parameters

Parameters
[in]NameThe long name of the command
[in]HelpTextThe help text associated to the command

Member Function Documentation

◆ activateOption()

bool openfluid::utils::CommandLineCommand::activateOption ( const std::string &  LongName,
const std::string &  Value = "" 
)
inline

Activates the given option with the given value

Parameters
[in]LongNameThe long name of the option
[in]ValueThe value for activation (default is empty)

◆ addOption()

void openfluid::utils::CommandLineCommand::addOption ( const CommandLineOption Option)
inline

Adds an option to the command

Parameters
[in]OptionThe option to add

◆ getHelpText()

std::string openfluid::utils::CommandLineCommand::getHelpText ( ) const
inline

Returns the help text of the command

Returns
The help text

◆ getName()

std::string openfluid::utils::CommandLineCommand::getName ( ) const
inline

Returns the name of the command

Returns
The name (e.g. "search")

◆ getOptionNameFromShortName()

std::string openfluid::utils::CommandLineCommand::getOptionNameFromShortName ( const std::string &  ShortName) const
inline

Returns the long name of an option from its short name

Parameters
[in]ShortNameThe requested short name for the option
Returns
The long name

◆ getOptionValue()

std::string openfluid::utils::CommandLineCommand::getOptionValue ( const std::string &  LongName) const
inline

Returns the value given for an option

Parameters
[in]LongNameThe long name for the option
Returns
the value for the option

◆ isOptionActive()

bool openfluid::utils::CommandLineCommand::isOptionActive ( const std::string &  LongName) const
inline

Tests if an option is active

Parameters
[in]LongNameThe long name for the searched option
Returns
true if the option is active

◆ isOptionExists()

bool openfluid::utils::CommandLineCommand::isOptionExists ( const std::string &  LongName) const
inline

Tests if an option exists for the command

Parameters
[in]LongNameThe long name for the searched option
Returns
true if the option exists

◆ isOptionRequiresValue()

bool openfluid::utils::CommandLineCommand::isOptionRequiresValue ( const std::string &  LongName) const
inline

Tests if an option requires a value

Parameters
[in]LongNameThe long name for the searched option
Returns
true if the option requires a value

◆ options()

const std::map<std::string,CommandLineOption>& openfluid::utils::CommandLineCommand::options ( )
inline

Returns the options registered for the command

Returns
The options

◆ reset()

void openfluid::utils::CommandLineCommand::reset ( )
inline

Resets all options to default (inactive with empty value)


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