lintel 0.2.0
Loading...
Searching...
No Matches
Public Types | Public Member Functions | List of all members
lintel::Argument Class Reference

#include <Argument.h>

Public Types

typedef std::variant< int32_t *, uint32_t *, double *, float *, bool *, std::string *, std::optional< int32_t > *, std::optional< uint32_t > *, std::optional< double > *, std::optional< float > *, std::optional< bool > *, std::optional< std::string > * > Value
 

Public Member Functions

 Argument (std::string flag, std::string shortFlag, std::string description, const Value &value)
 
void printHelp (std::ostream &os=std::cout) const
 
void parse (const std::string &arguments)
 
const std::string & getFlag () const
 
const std::string & getShortFlag () const
 

Detailed Description

Represents a single command-line argument with flag, short flag, description, and parsed value.

Member Typedef Documentation

◆ Value

typedef std::variant<int32_t *, uint32_t *, double *, float *, bool *, std::string *, std::optional<int32_t> *, std::optional<uint32_t> *, std::optional<double> *, std::optional<float> *, std::optional<bool> *, std::optional<std::string> *> lintel::Argument::Value

Constructor & Destructor Documentation

◆ Argument()

lintel::Argument::Argument ( std::string  flag,
std::string  shortFlag,
std::string  description,
const Value &  value 
)

Construct an Argument with its flags, description, and target value.

Parameters
flagthe long flag name (e.g. "--verbose")
shortFlagthe short flag name (e.g. "-v")
descriptionthe help description
valuepointer to the variable to store the parsed value

Member Function Documentation

◆ getFlag()

const std::string & lintel::Argument::getFlag ( ) const

Returns the long flag name.

Returns
the long flag

◆ getShortFlag()

const std::string & lintel::Argument::getShortFlag ( ) const

Returns the short flag name.

Returns
the short flag

◆ parse()

void lintel::Argument::parse ( const std::string &  arguments)

Parse a command-line argument string and store the result.

Parameters
argumentsthe argument string to parse

◆ printHelp()

void lintel::Argument::printHelp ( std::ostream &  os = std::cout) const

Print the help text for this argument to the given stream.

Parameters
osthe output stream (default: std::cout)

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