libcaf  0.15.3
Public Types | Public Member Functions | Public Attributes | List of all members
caf::message::cli_arg Struct Reference

Stores the name of a command line option ("<long name>[,<short name>]") along with a description and a callback. More...

#include <message.hpp>

Public Types

using consumer = std::function< bool(const std::string &)>
 Returns true on a match, false otherwise.
 

Public Member Functions

 cli_arg (std::string nstr, std::string tstr)
 Creates a CLI argument without data.
 
 cli_arg (std::string nstr, std::string tstr, bool &arg)
 Creates a CLI flag option. More...
 
 cli_arg (std::string nstr, std::string tstr, atom_value &arg)
 Creates a CLI argument storing its matched argument in dest.
 
 cli_arg (std::string nstr, std::string tstr, std::string &arg)
 Creates a CLI argument storing its matched argument in dest.
 
 cli_arg (std::string nstr, std::string tstr, std::vector< std::string > &arg)
 Creates a CLI argument appending matched arguments to dest.
 
 cli_arg (std::string nstr, std::string tstr, consumer f)
 Creates a CLI argument using the function object f.
 
template<class T >
 cli_arg (typename std::enable_if< type_nr< T >::value!=0, std::string >::type nstr, std::string tstr, T &arg)
 Creates a CLI argument for converting from strings, storing its matched argument in dest. More...
 
template<class T >
 cli_arg (std::string nstr, std::string tstr, std::vector< T > &arg)
 Creates a CLI argument for converting from strings, appending matched arguments to dest. More...
 

Public Attributes

std::string name
 Full name of this CLI argument using format "<long name>[,<short name>]".
 
std::string text
 Desciption of this CLI argument for the auto-generated help text.
 
std::string helptext
 Auto-generated helptext for this item.
 
consumer fun
 Evaluates option arguments.
 
bool * flag
 Set to true for zero-argument options.
 

Detailed Description

Stores the name of a command line option ("<long name>[,<short name>]") along with a description and a callback.

Constructor & Destructor Documentation

caf::message::cli_arg::cli_arg ( std::string  nstr,
std::string  tstr,
bool &  arg 
)

Creates a CLI flag option.

The flag is set to true if the option was set, otherwise it is false.

template<class T >
caf::message::cli_arg::cli_arg ( typename std::enable_if< type_nr< T >::value!=0, std::string >::type  nstr,
std::string  tstr,
T &  arg 
)

Creates a CLI argument for converting from strings, storing its matched argument in dest.

template<class T >
caf::message::cli_arg::cli_arg ( std::string  nstr,
std::string  tstr,
std::vector< T > &  arg 
)

Creates a CLI argument for converting from strings, appending matched arguments to dest.


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