koutil
Loading...
Searching...
No Matches
koutil::argparser::Arg Struct Reference

Base structure representing a subcommand argument. More...

#include <arg.h>

Public Types

enum  Type { OPTION_FLAG , OPTION_VALUE }
 

Public Member Functions

constexpr bool operator== (const Arg &other) const
 
constexpr bool operator< (char name) const
 
constexpr bool operator< (std::string_view name) const
 
constexpr bool operator> (char name) const
 
constexpr bool operator> (std::string_view name) const
 
constexpr bool operator== (char name) const
 
constexpr bool operator== (std::string_view name) const
 

Static Public Member Functions

static constexpr Arg option_flag (char opt, std::string_view desc)
 Constructs an argument of type OPTION_FLAG with a short name and description.
 
static constexpr Arg option_flag (std::string_view long_name, std::string_view desc)
 Constructs an argument of type OPTION_FLAG with a long name and description.
 
static constexpr Arg option_flag (char opt, std::string_view long_name, std::string_view desc)
 Constructs an argument of type OPTION_FLAG with both short and long names and a description.
 
static constexpr Arg option_value (std::string_view long_name, std::string_view desc)
 Constructs an argument of type OPTION_VALUE with a long name and description.
 

Public Attributes

enum koutil::argparser::Arg::Type type
 
const char short_name
 
const std::string_view long_name
 
const std::string_view description
 

Private Member Functions

constexpr Arg (Type arg_type, char sname, std::string_view lname, std::string_view desc)
 

Detailed Description

Base structure representing a subcommand argument.

Member Enumeration Documentation

◆ Type

Enumerator
OPTION_FLAG 
OPTION_VALUE 

Constructor & Destructor Documentation

◆ Arg()

koutil::argparser::Arg::Arg ( Type arg_type,
char sname,
std::string_view lname,
std::string_view desc )
inlineconstexprprivate

Member Function Documentation

◆ operator<() [1/2]

bool koutil::argparser::Arg::operator< ( char name) const
inlineconstexpr

◆ operator<() [2/2]

bool koutil::argparser::Arg::operator< ( std::string_view name) const
inlineconstexpr

◆ operator==() [1/3]

bool koutil::argparser::Arg::operator== ( char name) const
inlineconstexpr

◆ operator==() [2/3]

bool koutil::argparser::Arg::operator== ( const Arg & other) const
inlineconstexpr

◆ operator==() [3/3]

bool koutil::argparser::Arg::operator== ( std::string_view name) const
inlineconstexpr

◆ operator>() [1/2]

bool koutil::argparser::Arg::operator> ( char name) const
inlineconstexpr

◆ operator>() [2/2]

bool koutil::argparser::Arg::operator> ( std::string_view name) const
inlineconstexpr

◆ option_flag() [1/3]

static constexpr Arg koutil::argparser::Arg::option_flag ( char opt,
std::string_view desc )
inlinestaticconstexpr

Constructs an argument of type OPTION_FLAG with a short name and description.

Parameters
optThe short name of the argument.
descThe description of the argument.
Returns
A constructed argument.

◆ option_flag() [2/3]

static constexpr Arg koutil::argparser::Arg::option_flag ( char opt,
std::string_view long_name,
std::string_view desc )
inlinestaticconstexpr

Constructs an argument of type OPTION_FLAG with both short and long names and a description.

Parameters
optThe short name of the argument.
long_nameThe long name of the argument.
descThe description of the argument.
Returns
A constructed argument.

◆ option_flag() [3/3]

static constexpr Arg koutil::argparser::Arg::option_flag ( std::string_view long_name,
std::string_view desc )
inlinestaticconstexpr

Constructs an argument of type OPTION_FLAG with a long name and description.

Parameters
long_nameThe long name of the argument.
descThe description of the argument.
Returns
A constructed argument.

◆ option_value()

static constexpr Arg koutil::argparser::Arg::option_value ( std::string_view long_name,
std::string_view desc )
inlinestaticconstexpr

Constructs an argument of type OPTION_VALUE with a long name and description.

Parameters
long_nameThe long name of the argument.
descThe description of the argument.
Returns
A constructed argument.

Member Data Documentation

◆ description

const std::string_view koutil::argparser::Arg::description

◆ long_name

const std::string_view koutil::argparser::Arg::long_name

◆ short_name

const char koutil::argparser::Arg::short_name

◆ type

enum koutil::argparser::Arg::Type koutil::argparser::Arg::type

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