Euphoria
|
base for the parser, start with Parser and add one or more subparsers More...
#include <argparse.h>
Public Member Functions | |
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) |
Argument & | add_argument (const Name &name, std::shared_ptr< Argument > argument) |
Argument & | add_void_function (const Name &name, std::function< void()> void_function) |
Argument & | set_true (const Name &name, bool *target) |
Argument & | set_false (const Name &name, bool *target) |
std::shared_ptr< SubParserGroup > | add_sub_parsers (const std::string &name="commands") |
ParseResult | parse_args (Runner *runner) |
template<typename T > | |
Argument & | set_const (const Name &name, T *target, T t) |
template<typename T > | |
Argument & | add (const Name &name, T *target, ParseFunction< T > parse_function=default_parse_function< T >) |
template<typename T > | |
Argument & | add_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< Argument > | find_argument (const std::string &name) const |
virtual std::string | get_calling_name (const NameAndArguments &args)=0 |
virtual ParserBase * | get_parent_or_null ()=0 |
Public Attributes | |
std::string | description |
std::vector< ArgumentAndName > | positional_argument_list |
std::map< std::string, std::shared_ptr< Argument > > | optional_arguments |
std::vector< ArgumentAndName > | optional_argument_list |
EnumToStringImplementation< std::shared_ptr< SubParserContainer > > | subparsers |
std::vector< std::shared_ptr< SubParserGroup > > | subparser_groups |
std::optional< CompleteFunction > | on_complete_function |
State | parser_state = State::adding |
SubParserStyle | parser_style = SubParserStyle::inherit |
Detailed Description
base for the parser, start with Parser and add one or more subparsers
Definition at line 411 of file argparse.h.
Constructor & Destructor Documentation
◆ ParserBase() [1/3]
|
explicit |
Definition at line 524 of file argparse.cc.
◆ ~ParserBase()
|
virtualdefault |
◆ ParserBase() [2/3]
|
delete |
◆ ParserBase() [3/3]
|
delete |
Member Function Documentation
◆ add()
|
inline |
Definition at line 452 of file argparse.h.
◆ add_argument()
Argument & eu::core::argparse::ParserBase::add_argument | ( | const Name & | name, |
std::shared_ptr< Argument > | argument | ||
) |
Definition at line 802 of file argparse.cc.
◆ add_sub_parsers()
std::shared_ptr< SubParserGroup > eu::core::argparse::ParserBase::add_sub_parsers | ( | const std::string & | name = "commands" | ) |
Definition at line 859 of file argparse.cc.
◆ add_vector()
|
inline |
add greedy argument, currently also accepts zero
Definition at line 497 of file argparse.h.
◆ add_void_function()
Argument & eu::core::argparse::ParserBase::add_void_function | ( | const Name & | name, |
std::function< void()> | void_function | ||
) |
Definition at line 829 of file argparse.cc.
◆ find_argument()
std::shared_ptr< Argument > eu::core::argparse::ParserBase::find_argument | ( | const std::string & | name | ) | const |
Definition at line 869 of file argparse.cc.
◆ generate_usage_string()
std::string eu::core::argparse::ParserBase::generate_usage_string | ( | const NameAndArguments & | args | ) |
Definition at line 550 of file argparse.cc.
◆ get_calling_name()
|
pure virtual |
Implemented in eu::core::argparse::Parser, and eu::core::argparse::SubParser.
◆ get_parent_or_null()
|
pure virtual |
Implemented in eu::core::argparse::Parser, and eu::core::argparse::SubParser.
◆ on_complete()
void eu::core::argparse::ParserBase::on_complete | ( | CompleteFunction | com | ) |
Definition at line 852 of file argparse.cc.
◆ operator=() [1/2]
|
delete |
◆ operator=() [2/2]
|
delete |
◆ parse_args()
ParseResult eu::core::argparse::ParserBase::parse_args | ( | Runner * | runner | ) |
Definition at line 1207 of file argparse.cc.
◆ print_help()
void eu::core::argparse::ParserBase::print_help | ( | std::shared_ptr< Printer > | printer, |
const NameAndArguments & | args | ||
) |
Definition at line 613 of file argparse.cc.
◆ set_const()
|
inline |
Definition at line 443 of file argparse.h.
◆ set_false()
Definition at line 844 of file argparse.cc.
◆ set_true()
Definition at line 836 of file argparse.cc.
Member Data Documentation
◆ description
std::string eu::core::argparse::ParserBase::description |
Definition at line 413 of file argparse.h.
◆ on_complete_function
std::optional<CompleteFunction> eu::core::argparse::ParserBase::on_complete_function |
Definition at line 419 of file argparse.h.
◆ optional_argument_list
std::vector<ArgumentAndName> eu::core::argparse::ParserBase::optional_argument_list |
Definition at line 416 of file argparse.h.
◆ optional_arguments
std::map<std::string, std::shared_ptr<Argument> > eu::core::argparse::ParserBase::optional_arguments |
Definition at line 415 of file argparse.h.
◆ parser_state
State eu::core::argparse::ParserBase::parser_state = State::adding |
Definition at line 420 of file argparse.h.
◆ parser_style
SubParserStyle eu::core::argparse::ParserBase::parser_style = SubParserStyle::inherit |
Definition at line 421 of file argparse.h.
◆ positional_argument_list
std::vector<ArgumentAndName> eu::core::argparse::ParserBase::positional_argument_list |
Definition at line 414 of file argparse.h.
◆ subparser_groups
std::vector<std::shared_ptr<SubParserGroup> > eu::core::argparse::ParserBase::subparser_groups |
Definition at line 418 of file argparse.h.
◆ subparsers
EnumToStringImplementation<std::shared_ptr<SubParserContainer> > eu::core::argparse::ParserBase::subparsers |
Definition at line 417 of file argparse.h.
The documentation for this struct was generated from the following files:
- libs/core/src/core/argparse.h
- libs/core/src/core/argparse.cc