CPP-AP 2.2.6
Command-line argument parser for C++20
Loading...
Searching...
No Matches
ap::detail::argument_base Class Referenceabstract

Argument class interface. More...

#include <argument_base.hpp>

Inheritance diagram for ap::detail::argument_base:
ap::argument::optional< T > ap::argument::positional< T >

Protected Member Functions

 argument_base (const argument_name &name)
 
const ap::detail::argument_namename () const noexcept
 
const std::optional< std::string > & help () const noexcept
 
virtual detail::argument_descriptor desc (const bool verbose, const char flag_char) const noexcept=0
 
virtual bool is_required () const noexcept=0
 
virtual bool bypass_required_enabled () const noexcept=0
 
virtual bool mark_used ()=0
 Mark the argument as used.
 
virtual bool is_used () const noexcept=0
 
virtual std::size_t count () const noexcept=0
 
virtual bool set_value (const std::string &value)=0
 Set the value for the argument.
 
virtual bool has_value () const noexcept=0
 
virtual bool has_parsed_values () const noexcept=0
 
virtual std::weak_ordering nvalues_ordering () const noexcept=0
 
virtual const std::any & value () const =0
 
virtual const std::vector< std::any > & values () const =0
 

Protected Attributes

const ap::detail::argument_name _name
 
std::optional< std::string > _help_msg
 

Friends

class ::ap::argument_parser
 

Detailed Description

Argument class interface.

Definition at line 26 of file argument_base.hpp.

Constructor & Destructor Documentation

◆ argument_base()

ap::detail::argument_base::argument_base ( const argument_name name)
inlineprotected

Definition at line 33 of file argument_base.hpp.

Member Function Documentation

◆ bypass_required_enabled()

virtual bool ap::detail::argument_base::bypass_required_enabled ( ) const
protectedpure virtualnoexcept
Returns
true if bypassing the required status is enabled for the argument, false otherwise.

◆ count()

virtual std::size_t ap::detail::argument_base::count ( ) const
protectedpure virtualnoexcept
Returns
The number of times the positional argument is used.

◆ desc()

virtual detail::argument_descriptor ap::detail::argument_base::desc ( const bool  verbose,
const char  flag_char 
) const
protectedpure virtualnoexcept
Parameters
verboseThe verbosity mode value.
flag_charThe character used for the argument flag prefix.
Returns
An argument descriptor object for the argument.

◆ has_parsed_values()

virtual bool ap::detail::argument_base::has_parsed_values ( ) const
protectedpure virtualnoexcept
Returns
true if the argument has parsed values., false otherwise.

◆ has_value()

virtual bool ap::detail::argument_base::has_value ( ) const
protectedpure virtualnoexcept
Returns
true if the argument has a value, false otherwise.

◆ help()

const std::optional< std::string > & ap::detail::argument_base::help ( ) const
inlineprotectednoexcept
Returns
Optional help message for the positional argument.

Definition at line 41 of file argument_base.hpp.

◆ is_required()

virtual bool ap::detail::argument_base::is_required ( ) const
protectedpure virtualnoexcept
Returns
true if the argument is required, false otherwise

◆ is_used()

virtual bool ap::detail::argument_base::is_used ( ) const
protectedpure virtualnoexcept
Returns
true if the argument has been used, false otherwise.

◆ mark_used()

virtual bool ap::detail::argument_base::mark_used ( )
protectedpure virtual

Mark the argument as used.

Returns
true if the argument accepts further values, false otherwise.

◆ name()

const ap::detail::argument_name & ap::detail::argument_base::name ( ) const
inlineprotectednoexcept
Returns
Reference the name of the positional argument.

Definition at line 36 of file argument_base.hpp.

◆ nvalues_ordering()

virtual std::weak_ordering ap::detail::argument_base::nvalues_ordering ( ) const
protectedpure virtualnoexcept
Returns
The ordering relationship of argument range.

◆ set_value()

virtual bool ap::detail::argument_base::set_value ( const std::string &  value)
protectedpure virtual

Set the value for the argument.

Parameters
valueThe string representation of the value.
Returns
true if the argument accepts further values, false otherwise.

◆ value()

virtual const std::any & ap::detail::argument_base::value ( ) const
protectedpure virtual
Returns
Reference to the stored value of the argument.

◆ values()

virtual const std::vector< std::any > & ap::detail::argument_base::values ( ) const
protectedpure virtual
Returns
Reference to the vector of parsed values of the argument.

Friends And Related Symbol Documentation

◆ ::ap::argument_parser

friend class ::ap::argument_parser
friend

Definition at line 30 of file argument_base.hpp.

Member Data Documentation

◆ _help_msg

std::optional<std::string> ap::detail::argument_base::_help_msg
protected

Definition at line 94 of file argument_base.hpp.

◆ _name

const ap::detail::argument_name ap::detail::argument_base::_name
protected

Definition at line 93 of file argument_base.hpp.


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