Euphoria
eu::core::argparse::Parser Struct Reference

root parser. start argumentparsing with this one More...

#include <argparse.h>

Inheritance diagram for eu::core::argparse::Parser:
eu::core::argparse::ParserBase

Public Member Functions

 Parser (const std::string &d="")
 
ParseResult parse (const NameAndArguments &args)
 
std::optional< int > parse (int argc, char *argv[])
 value = return from main nullopt = continue, parsing was ok More...
 
ParserBaseget_parent_or_null () override
 
std::string get_calling_name (const NameAndArguments &args) override
 
- Public Member Functions inherited from eu::core::argparse::ParserBase
 ParserBase (const std::string &d)
 
virtual ~ParserBase ()=default
 
 ParserBase (const ParserBase &)=delete
 
 ParserBase (ParserBase &&)=delete
 
void operator= (const ParserBase &)=delete
 
void operator= (ParserBase &&)=delete
 
std::string generate_usage_string (const NameAndArguments &args)
 
void print_help (std::shared_ptr< Printer > printer, const NameAndArguments &args)
 
void on_complete (CompleteFunction com)
 
Argumentadd_argument (const Name &name, std::shared_ptr< Argument > argument)
 
Argumentadd_void_function (const Name &name, std::function< void()> void_function)
 
Argumentset_true (const Name &name, bool *target)
 
Argumentset_false (const Name &name, bool *target)
 
std::shared_ptr< SubParserGroupadd_sub_parsers (const std::string &name="commands")
 
ParseResult parse_args (Runner *runner)
 
template<typename T >
Argumentset_const (const Name &name, T *target, T t)
 
template<typename T >
Argumentadd (const Name &name, T *target, ParseFunction< T > parse_function=default_parse_function< T >)
 
template<typename T >
Argumentadd_vector (const Name &name, std::vector< T > *target, ParseFunction< T > parse_function=default_parse_function< T >)
 add greedy argument, currently also accepts zero More...
 
std::shared_ptr< Argumentfind_argument (const std::string &name) const
 

Public Attributes

std::shared_ptr< argparse::Printerprinter
 
- Public Attributes inherited from eu::core::argparse::ParserBase
std::string description
 
std::vector< ArgumentAndNamepositional_argument_list
 
std::map< std::string, std::shared_ptr< Argument > > optional_arguments
 
std::vector< ArgumentAndNameoptional_argument_list
 
EnumToStringImplementation< std::shared_ptr< SubParserContainer > > subparsers
 
std::vector< std::shared_ptr< SubParserGroup > > subparser_groups
 
std::optional< CompleteFunctionon_complete_function
 
State parser_state = State::adding
 
SubParserStyle parser_style = SubParserStyle::inherit
 

Detailed Description

root parser. start argumentparsing with this one

Definition at line 574 of file argparse.h.

Constructor & Destructor Documentation

◆ Parser()

eu::core::argparse::Parser::Parser ( const std::string &  d = "")
explicit

Definition at line 1288 of file argparse.cc.

Member Function Documentation

◆ get_calling_name()

std::string eu::core::argparse::Parser::get_calling_name ( const NameAndArguments args)
overridevirtual

Implements eu::core::argparse::ParserBase.

Definition at line 1328 of file argparse.cc.

◆ get_parent_or_null()

ParserBase * eu::core::argparse::Parser::get_parent_or_null ( )
overridevirtual

Implements eu::core::argparse::ParserBase.

Definition at line 1296 of file argparse.cc.

◆ parse() [1/2]

ParseResult eu::core::argparse::Parser::parse ( const NameAndArguments args)

Definition at line 1303 of file argparse.cc.

◆ parse() [2/2]

std::optional< int > eu::core::argparse::Parser::parse ( int  argc,
char *  argv[] 
)

value = return from main nullopt = continue, parsing was ok

Definition at line 1312 of file argparse.cc.

Member Data Documentation

◆ printer

std::shared_ptr<argparse::Printer> eu::core::argparse::Parser::printer

Definition at line 576 of file argparse.h.


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