Documentation for OpenFLUID 2.2.0
openfluid::utils::StructuredCommandLineParser Class Reference

#include <utils/StructuredCommandLineParser.hpp>

Public Member Functions

 StructuredCommandLineParser (const std::string &ProgramName, const std::string &HelpText, const std::vector< CommandLineSection * > &CommandSections)
 
void addCommandSection (CommandLineSection *CommandSection)
 
void addCommandSections (const std::vector< CommandLineSection * > &CommandSections)
 
void addCommand (const CommandLineCommand &Command, CommandLineSection *CommandSection=nullptr)
 
void printHelp (std::ostream &OutStm)
 
- Public Member Functions inherited from openfluid::utils::CommandLineParser
 CommandLineParser ()
 
 CommandLineParser (const std::string &ProgramName, const std::string &HelpText, bool UseCustomOrder=false)
 
const std::vector< std::string > & extraArgs () const
 
const std::vector< std::string > & thirdPartyArgs () const
 
std::string getHelpText () const
 
std::string getProgramName () const
 
std::string getParsingMessage () const
 
std::string getActiveCommand () const
 
const CommandLineCommandcommand (const std::string &Name) const
 
void addCommand (const CommandLineCommand &Command)
 
void addOption (const CommandLineOption &Option)
 
bool parse (std::list< std::string > ArgValues)
 
bool parse (int ArgC, char **ArgV)
 
void reset ()
 
bool isHelpAsked ()
 
void printHelp (std::ostream &OutStm)
 
void printState (std::ostream &OutStm)
 

Additional Inherited Members

- Protected Member Functions inherited from openfluid::utils::CommandLineParser
int getLargestCommandLength ()
 
int getLargestOptionLength ()
 
std::string getCustomIndent (int CommandLength, int LargestCommandLength, std::string minimalSpace=" ")
 
CommandLineOption getHelpOption ()
 
void displayFormattedData (std::ostream &OutStm, std::string Title, std::string HelpText, int LargestTextLength)
 
void displayOptions (std::ostream &OutStm, CommandLineOption HelpOption, int LargestTextLength)
 
std::string getArgsDisplay ()
 
void displayUsageMessage (std::ostream &OutStm)
 
- Protected Attributes inherited from openfluid::utils::CommandLineParser
std::string m_ProgramName
 
std::string m_HelpText
 
std::map< std::string, CommandLineCommandm_Commands
 
std::vector< CommandLineCommandm_CommandsOrdered
 
std::string m_ActiveCommand
 
const std::string m_AvailableCommandsText
 
Inheritance diagram for openfluid::utils::StructuredCommandLineParser:
Collaboration diagram for openfluid::utils::StructuredCommandLineParser:

Constructor & Destructor Documentation

◆ StructuredCommandLineParser()

openfluid::utils::StructuredCommandLineParser::StructuredCommandLineParser ( const std::string &  ProgramName,
const std::string &  HelpText,
const std::vector< CommandLineSection * > &  CommandSections 
)
inline

Instanciates a command line parser with the given parameters

Parameters
[in]ProgramNameThe name of the programn
[in]HelpTextThe help text associated to the option
[in]CommandSectionsList of commands section

Member Function Documentation

◆ addCommand()

void openfluid::utils::StructuredCommandLineParser::addCommand ( const CommandLineCommand Command,
CommandLineSection CommandSection = nullptr 
)
inline

Adds a command. Can add a command to a command section

Parameters
[in]CommandThe command to add
[in]CommandSectionThe section to add the command. Can be null

◆ addCommandSection()

void openfluid::utils::StructuredCommandLineParser::addCommandSection ( CommandLineSection CommandSection)
inline

Adds a command section to the parser

Parameters
[in]CommandSectionThe command section to add

◆ addCommandSections()

void openfluid::utils::StructuredCommandLineParser::addCommandSections ( const std::vector< CommandLineSection * > &  CommandSections)
inline

Adds a command section to the parser

Parameters
[in]CommandSectionsThe command section to add

◆ printHelp()

void openfluid::utils::StructuredCommandLineParser::printHelp ( std::ostream &  OutStm)
inline

Prints the help text

Parameters
[in]OutStmThe stream where the help text is printed (e.g. std::cout)

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