DCCL v4
dccl::Option Class Reference

Represents a command line option. More...

#include <dccl/cli_option.h>

Public Member Functions

 Option (char shortname, const char *longname, int has_argument, std::string description)
 Create a command line option. More...
 
option c_opt () const
 
std::string opt_code () const
 
std::string usage () const
 

Static Public Member Functions

static void convert_vector (const std::vector< Option > &options, std::vector< option > *c_options, std::string *opt_string)
 Convert a vector of Options into a vector of options (from getopt.h) and an opt_string, suitable for use in getopt_long()
 

Detailed Description

Represents a command line option.

Definition at line 36 of file cli_option.h.

Constructor & Destructor Documentation

◆ Option()

dccl::Option::Option ( char  shortname,
const char *  longname,
int  has_argument,
std::string  description 
)
inline

Create a command line option.

Parameters
shortnameSingle character representation (e.g. 'v' for "-v")
longnameFull representation (e.g. "verbose" for "--verbose")
has_argumentDoes the parameter take an argument?
descriptionHuman description for the –help option

Definition at line 45 of file cli_option.h.

Member Function Documentation

◆ c_opt()

option dccl::Option::c_opt ( ) const
inline
Returns
Equivalent option from <getopt.h>

Definition at line 56 of file cli_option.h.

◆ opt_code()

std::string dccl::Option::opt_code ( ) const
inline
Returns
option code from <getopt.h> used in getopt_long()

Definition at line 59 of file cli_option.h.

◆ usage()

std::string dccl::Option::usage ( ) const
inline
Returns
String giving usage for the –help option.

Definition at line 77 of file cli_option.h.


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