ChainCLI
A modern C++20 command-line interface library
Loading...
Searching...
No Matches
cli::commands::TypedArgumentBase Class Referenceabstract

Base class for typed command-line arguments. More...

#include <argument.h>

Inheritance diagram for cli::commands::TypedArgumentBase:
cli::commands::OptionArgumentBase cli::commands::PositionalArgumentBase cli::commands::OptionArgument< T > cli::commands::PositionalArgument< T >

Public Member Functions

std::type_index getType () const
 Get the type of the argument.
 
virtual std::any parseToValue (const std::string &input) const =0
 Parse the input string to the argument's value type.
 

Protected Member Functions

 TypedArgumentBase (std::type_index t)
 

Protected Attributes

const std::type_index type
 

Detailed Description

Base class for typed command-line arguments.

Member Function Documentation

◆ getType()

std::type_index cli::commands::TypedArgumentBase::getType ( ) const
inline

Get the type of the argument.

Returns
The type of the argument.

◆ parseToValue()

virtual std::any cli::commands::TypedArgumentBase::parseToValue ( const std::string &  input) const
pure virtual

Parse the input string to the argument's value type.

Parameters
inputThe input string to parse.
Returns
The parsed value as std::any.

Implemented in cli::commands::OptionArgument< T >, and cli::commands::PositionalArgument< T >.


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