AnCH Framework 0.1
Another C++ Hack Framework
Loading...
Searching...
No Matches
anch::cli::ArgHandler Class Reference

CLI arguments handler. More...

#include <args.hpp>

Collaboration diagram for anch::cli::ArgHandler:

Public Member Functions

 ArgHandler (const anch::cli::App &app, const std::vector< anch::cli::Arg > &options={})
 ArgHandler (const std::vector< anch::cli::Arg > &options)
virtual ~ArgHandler ()
anch::cli::ArgHandlerarg (anch::cli::Arg &arg)
void parse (int argc, char **argv)
void check ()
void handle (int argc, char **argv)
void printHelp (std::ostream &out)
void printVersion (std::ostream &out)
void printBanner (std::ostream &out)

Detailed Description

CLI arguments handler.

This class aims to register, parse and check arguments.
If not defined, ArgHandler will add help (-h and/or --help ) and version options (-v and/or --version ).

Since
0.1
Author
Vincent Lachenal

Constructor & Destructor Documentation

◆ ArgHandler() [1/2]

anch::cli::ArgHandler::ArgHandler ( const anch::cli::App & app,
const std::vector< anch::cli::Arg > & options = {} )

ArgHandler constructor

Parameters
appthe application informations
optionsthe arguments' definition (default to empty std::vector )
Exceptions
std::invalid_argumentinvalid argument registering

◆ ArgHandler() [2/2]

anch::cli::ArgHandler::ArgHandler ( const std::vector< anch::cli::Arg > & options)

ArgHandler constructor

Parameters
optionsthe arguments' definition
Exceptions
std::invalid_argumentinvalid argument registering

◆ ~ArgHandler()

virtual anch::cli::ArgHandler::~ArgHandler ( )
virtual

ArgHandler destructor

Member Function Documentation

◆ arg()

anch::cli::ArgHandler & anch::cli::ArgHandler::arg ( anch::cli::Arg & arg)

Register argument

Parameters
argthe argument to register
Returns
reference to this
Exceptions
std::invalid_argumentinvalid argument registering
Here is the call graph for this function:

◆ check()

void anch::cli::ArgHandler::check ( )

Parse command line arguments

Exceptions
std::invalid_argumentinvalid or missing argument

◆ handle()

void anch::cli::ArgHandler::handle ( int argc,
char ** argv )

Parse and check command line arguments

Parameters
argcthe number of arguments
argvthe arguments' list
Exceptions
std::invalid_argumentinvalid or missing argument

◆ parse()

void anch::cli::ArgHandler::parse ( int argc,
char ** argv )

Parse command line arguments

Parameters
argcthe number of arguments
argvthe arguments' list
Exceptions
std::invalid_argumentinvalid argument usage

◆ printBanner()

void anch::cli::ArgHandler::printBanner ( std::ostream & out)

Print banner

Parameters
outthe output stream to print in

◆ printHelp()

void anch::cli::ArgHandler::printHelp ( std::ostream & out)

Print help and immediatly exit with return code 0

Parameters
outthe output stream to print in

◆ printVersion()

void anch::cli::ArgHandler::printVersion ( std::ostream & out)

Print help and immediatly exit with return code 0

Parameters
outthe output stream to print in

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