WPILibC++ 2025.1.1
|
#include <wpi/argparse.h>
Classes | |
class | MutuallyExclusiveGroup |
Public Member Functions | |
ArgumentParser (std::string program_name={}, std::string version="1.0", default_arguments add_args=default_arguments::all, bool exit_on_default_arguments=true, std::ostream &os=std::cout) | |
~ArgumentParser ()=default | |
ArgumentParser (const ArgumentParser &other)=delete | |
ArgumentParser & | operator= (const ArgumentParser &other)=delete |
ArgumentParser (ArgumentParser &&) noexcept=delete | |
ArgumentParser & | operator= (ArgumentParser &&)=delete |
operator bool () const | |
template<typename... Targs> | |
Argument & | add_argument (Targs... f_args) |
MutuallyExclusiveGroup & | add_mutually_exclusive_group (bool required=false) |
template<typename... Targs> | |
ArgumentParser & | add_parents (const Targs &... f_args) |
ArgumentParser & | add_usage_newline () |
ArgumentParser & | add_group (std::string group_name) |
ArgumentParser & | add_description (std::string description) |
ArgumentParser & | add_epilog (std::string epilog) |
ArgumentParser & | add_hidden_alias_for (Argument &arg, std::string_view alias) |
template<typename T = Argument> | |
T & | at (std::string_view name) |
ArgumentParser & | set_prefix_chars (std::string prefix_chars) |
ArgumentParser & | set_assign_chars (std::string assign_chars) |
void | parse_args (const std::vector< std::string > &arguments) |
std::vector< std::string > | parse_known_args (const std::vector< std::string > &arguments) |
void | parse_args (int argc, const char *const argv[]) |
auto | parse_known_args (int argc, const char *const argv[]) |
template<typename T = std::string> | |
T | get (std::string_view arg_name) const |
template<typename T = std::string> | |
auto | present (std::string_view arg_name) const -> std::optional< T > |
auto | is_used (std::string_view arg_name) const |
auto | is_subcommand_used (std::string_view subcommand_name) const |
auto | is_subcommand_used (const ArgumentParser &subparser) const |
Argument & | operator[] (std::string_view arg_name) const |
auto | help () const -> std::stringstream |
ArgumentParser & | set_usage_max_line_width (size_t w) |
ArgumentParser & | set_usage_break_on_mutex () |
auto | usage () const -> std::string |
std::string | print_help () const |
void | add_subparser (ArgumentParser &parser) |
void | set_suppress (bool suppress) |
Protected Types | |
using | argument_it = std::list<Argument>::iterator |
using | mutex_group_it = std::vector<MutuallyExclusiveGroup>::iterator |
using | argument_parser_it |
Protected Member Functions | |
const MutuallyExclusiveGroup * | get_belonging_mutex (const Argument *arg) const |
bool | is_valid_prefix_char (char c) const |
char | get_any_valid_prefix_char () const |
std::vector< std::string > | preprocess_arguments (const std::vector< std::string > &raw_arguments) const |
void | parse_args_internal (const std::vector< std::string > &raw_arguments) |
std::vector< std::string > | parse_known_args_internal (const std::vector< std::string > &raw_arguments) |
std::size_t | get_length_of_longest_argument () const |
void | index_argument (argument_it it) |
Protected Attributes | |
std::string | m_program_name |
std::string | m_version |
std::string | m_description |
std::string | m_epilog |
bool | m_exit_on_default_arguments = true |
std::string | m_prefix_chars {"-"} |
std::string | m_assign_chars {"="} |
bool | m_is_parsed = false |
std::list< Argument > | m_positional_arguments |
std::list< Argument > | m_optional_arguments |
std::map< std::string, argument_it > | m_argument_map |
std::string | m_parser_path |
std::list< std::reference_wrapper< ArgumentParser > > | m_subparsers |
std::map< std::string, argument_parser_it > | m_subparser_map |
std::map< std::string, bool > | m_subparser_used |
std::vector< MutuallyExclusiveGroup > | m_mutually_exclusive_groups |
bool | m_suppress = false |
std::size_t | m_usage_max_line_width = (std::numeric_limits<std::size_t>::max)() |
bool | m_usage_break_on_mutex = false |
int | m_usage_newline_counter = 0 |
std::vector< std::string > | m_group_names |
Friends | |
auto | operator<< (std::ostream &stream, const ArgumentParser &parser) -> std::ostream & |
|
protected |
|
protected |
|
protected |
|
inlineexplicit |
|
default |
|
delete |
|
deletenoexcept |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inlineprotected |
|
inlineprotected |
|
inlineprotected |
|
inline |
|
inlineprotected |
|
inline |
|
inline |
|
inline |
|
inlineprotected |
|
inlineexplicit |
|
delete |
|
delete |
|
inline |
|
inline |
|
inline |
|
inlineprotected |
|
inline |
|
inline |
|
inlineprotected |
|
inlineprotected |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
friend |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |