![]() |
Scarab
v2.11.1
Project 8 C++ Utility Library
|
#include <algorithm>#include <cmath>#include <deque>#include <exception>#include <fstream>#include <functional>#include <iomanip>#include <iostream>#include <istream>#include <iterator>#include <locale>#include <map>#include <memory>#include <numeric>#include <set>#include <sstream>#include <stdexcept>#include <string>#include <sys/stat.h>#include <sys/types.h>#include <tuple>#include <type_traits>#include <utility>#include <vector>
Go to the source code of this file.
Classes | |
| class | Error |
| All errors derive from this one. More... | |
| class | ConstructionError |
| Construction errors (not in parsing) More... | |
| class | IncorrectConstruction |
| Thrown when an option is set to conflicting values (non-vector and multi args, for example) More... | |
| class | BadNameString |
| Thrown on construction of a bad name. More... | |
| class | OptionAlreadyAdded |
| Thrown when an option already exists. More... | |
| class | ParseError |
| Anything that can error in Parse. More... | |
| class | Success |
| This is a successful completion on parsing, supposed to exit. More... | |
| class | CallForHelp |
| -h or –help on command line More... | |
| class | CallForAllHelp |
| Usually something like –help-all on command line. More... | |
| class | RuntimeError |
| Does not output a diagnostic in CLI11_PARSE, but allows to return from main() with a specific error code. More... | |
| class | FileError |
| Thrown when parsing an INI file and it is missing. More... | |
| class | ConversionError |
| Thrown when conversion call back fails, such as when an int fails to coerce to a string. More... | |
| class | ValidationError |
| Thrown when validation of results fails. More... | |
| class | RequiredError |
| Thrown when a required option is missing. More... | |
| class | ArgumentMismatch |
| Thrown when the wrong number of arguments has been received. More... | |
| class | RequiresError |
| Thrown when a requires option is missing. More... | |
| class | ExcludesError |
| Thrown when an excludes option is present. More... | |
| class | ExtrasError |
| Thrown when too many positionals or options are found. More... | |
| class | ConfigError |
| Thrown when extra values are found in an INI file. More... | |
| class | InvalidError |
| Thrown when validation fails before parsing. More... | |
| class | HorribleError |
| class | OptionNotFound |
| Thrown when counting a non-existent option. More... | |
| struct | make_void< Ts > |
| A copy of std::void_t from C++17 (helper for C++11 and C++14) More... | |
| struct | is_vector< T > |
| Check to see if something is a vector (fail check by default) More... | |
| struct | is_vector< std::vector< T, A > > |
| Check to see if something is a vector (true if actually a vector) More... | |
| struct | is_bool< T > |
| Check to see if something is bool (fail check by default) More... | |
| struct | is_bool< bool > |
| Check to see if something is bool (true if actually a bool) More... | |
| struct | is_shared_ptr< T > |
| Check to see if something is a shared pointer. More... | |
| struct | is_shared_ptr< std::shared_ptr< T > > |
| Check to see if something is a shared pointer (True if really a shared pointer) More... | |
| struct | is_shared_ptr< const std::shared_ptr< T > > |
| Check to see if something is a shared pointer (True if really a shared pointer) More... | |
| struct | is_copyable_ptr< T > |
| Check to see if something is copyable pointer. More... | |
| struct | IsMemberType< T > |
| This can be specialized to override the type deduction for IsMember. More... | |
| struct | IsMemberType< const char * > |
| The main custom type needed here is const char * should be a string. More... | |
| struct | element_type< T > |
| struct | element_value_type< T > |
| struct | pair_adaptor< T, _ > |
| Adaptor for set-like structure: This just wraps a normal container in a few utilities that do almost nothing. More... | |
| struct | pair_adaptor< T, conditional_t< false, void_t< typename T::value_type::first_type, typename T::value_type::second_type >, void > > |
| class | is_streamable< S, T > |
| struct | ConfigItem |
| Holds values to load into Options. More... | |
| class | Config |
| This class provides a converter for configuration files. More... | |
| class | ConfigINI |
| This converter works with INI files. More... | |
| class | Validator |
| Some validators that are provided. More... | |
| class | CustomValidator |
| Class wrapping some of the accessors of Validator. More... | |
| class | ExistingFileValidator |
| Check for an existing file (returns error message if check fails) More... | |
| class | ExistingDirectoryValidator |
| Check for an existing directory (returns error message if check fails) More... | |
| class | ExistingPathValidator |
| Check for an existing path. More... | |
| class | NonexistentPathValidator |
| Check for an non-existing path. More... | |
| class | IPV4Validator |
| Validate the given string is a legal ipv4 address. More... | |
| class | PositiveNumber |
| Validate the argument is a number and greater than or equal to 0. More... | |
| class | Number |
| Validate the argument is a number and greater than or equal to 0. More... | |
| class | Range |
| Produce a range (factory). Min and max are inclusive. More... | |
| class | Bound |
| Produce a bounded range (factory). Min and max are inclusive. More... | |
| struct | sfinae_true< typename > |
| struct | has_find< T, V > |
| class | IsMember |
| Verify items are in a set. More... | |
| class | Transformer |
| Translate named items to other or a value set. More... | |
| class | CheckedTransformer |
| translate named items to other or a value set More... | |
| class | AsNumberWithUnit |
| class | AsSizeValue |
| class | FormatterBase |
| class | FormatterLambda |
| This is a specialty override for lambda functions. More... | |
| class | Formatter |
| class | OptionBase< CRTP > |
| class | OptionDefaults |
| class | Option |
| class | App |
| Creates a command line program, with very few defaults. More... | |
| class | Option_group |
| Extension of App to better manage groups of options. More... | |
| struct | AppFriend |
| This class is simply to allow tests access to App's protected functions. More... | |
Namespaces | |
| CLI | |
| CLI::enums | |
| CLI::detail | |
Macros | |
| #define | CLI11_VERSION_MAJOR 1 |
| #define | CLI11_VERSION_MINOR 8 |
| #define | CLI11_VERSION_PATCH 0 |
| #define | CLI11_VERSION "1.8.0" |
| #define | CLI11_DEPRECATED(reason) __attribute__((deprecated(reason))) |
| #define | CLI11_STD_OPTIONAL 0 |
| #define | CLI11_EXPERIMENTAL_OPTIONAL 0 |
| #define | CLI11_BOOST_OPTIONAL 0 |
| #define | CLI11_ERROR_DEF(parent, name) |
| #define | CLI11_ERROR_SIMPLE(name) explicit name(std::string msg) : name(#name, msg, ExitCodes::name) {} |
| #define | CLI11_PARSE(app, argc, argv) |
Typedefs | |
| template<bool B, class T = void> | |
| using | enable_if_t = typename std::enable_if< B, T >::type |
| template<typename... Ts> | |
| using | void_t = typename make_void< Ts... >::type |
| A copy of std::void_t from C++17 - same reasoning as enable_if_t, it does not hurt to redefine. More... | |
| template<bool B, class T , class F > | |
| using | conditional_t = typename std::conditional< B, T, F >::type |
| A copy of std::conditional_t from C++14 - same reasoning as enable_if_t, it does not hurt to redefine. More... | |
| using | results_t = std::vector< std::string > |
| using | callback_t = std::function< bool(results_t)> |
| using | Option_p = std::unique_ptr< Option > |
| using | App_p = std::shared_ptr< App > |
Enumerations | |
| enum | ExitCodes { Success = 0, IncorrectConstruction = 100, BadNameString, OptionAlreadyAdded, FileError, ConversionError, ValidationError, RequiredError, RequiresError, ExcludesError, ExtrasError, ConfigError, InvalidError, HorribleError, OptionNotFound, ArgumentMismatch, BaseClass = 127 } |
| enum | enabler |
| Simple empty scoped class. More... | |
| enum | AppFormatMode { Normal, All, Sub } |
| enum | MultiOptionPolicy : char { Throw, TakeLast, TakeFirst, Join } |
| enum | Classifier { NONE, POSITIONAL_MARK, SHORT, LONG, WINDOWS, SUBCOMMAND, SUBCOMMAND_TERMINATOR } |
Functions | |
| template<typename T , typename = typename std::enable_if<std::is_enum<T>::value>::type> | |
| std::ostream & | operator<< (std::ostream &in, const T &item) |
| output streaming for enumerations More... | |
| template<typename T , typename = typename std::enable_if<std::is_enum<T>::value>::type> | |
| std::istream & | operator>> (std::istream &in, T &item) |
| input streaming for enumerations More... | |
| std::vector< std::string > | split (const std::string &s, char delim) |
| Split a string by a delim. More... | |
| template<typename T > | |
| std::string | as_string (const T &v) |
| simple utility to convert various types to a string More... | |
| template<typename T , typename = typename std::enable_if<std::is_constructible<std::string, T>::value>::type> | |
| auto | as_string (T &&v) -> decltype(std::forward< T >(v)) |
| template<typename T > | |
| std::string | join (const T &v, std::string delim=",") |
| Simple function to join a string. More... | |
| template<typename T , typename Callable , typename = typename std::enable_if<!std::is_constructible<std::string, Callable>::value>::type> | |
| std::string | join (const T &v, Callable func, std::string delim=",") |
| Simple function to join a string from processed elements. More... | |
| template<typename T > | |
| std::string | rjoin (const T &v, std::string delim=",") |
| Join a string in reverse order. More... | |
| std::string & | ltrim (std::string &str) |
| Trim whitespace from left of string. More... | |
| std::string & | ltrim (std::string &str, const std::string &filter) |
| Trim anything from left of string. More... | |
| std::string & | rtrim (std::string &str) |
| Trim whitespace from right of string. More... | |
| std::string & | rtrim (std::string &str, const std::string &filter) |
| Trim anything from right of string. More... | |
| std::string & | trim (std::string &str) |
| Trim whitespace from string. More... | |
| std::string & | trim (std::string &str, const std::string filter) |
| Trim anything from string. More... | |
| std::string | trim_copy (const std::string &str) |
| Make a copy of the string and then trim it. More... | |
| std::string | trim_copy (const std::string &str, const std::string &filter) |
| Make a copy of the string and then trim it, any filter string can be used (any char in string is filtered) More... | |
| std::ostream & | format_help (std::ostream &out, std::string name, std::string description, size_t wid) |
| Print a two part "help" string. More... | |
| template<typename T > | |
| bool | valid_first_char (T c) |
| Verify the first character of an option. More... | |
| template<typename T > | |
| bool | valid_later_char (T c) |
| Verify following characters of an option. More... | |
| bool | valid_name_string (const std::string &str) |
| Verify an option name. More... | |
| bool | isalpha (const std::string &str) |
| Verify that str consists of letters only. More... | |
| std::string | to_lower (std::string str) |
| Return a lower case version of a string. More... | |
| std::string | remove_underscore (std::string str) |
| remove underscores from a string More... | |
| std::string | find_and_replace (std::string str, std::string from, std::string to) |
| Find and replace a substring with another substring. More... | |
| bool | has_default_flag_values (const std::string &flags) |
| check if the flag definitions has possible false flags More... | |
| void | remove_default_flag_values (std::string &flags) |
| std::ptrdiff_t | find_member (std::string name, const std::vector< std::string > names, bool ignore_case=false, bool ignore_underscore=false) |
| Check if a string is a member of a list of strings and optionally ignore case or ignore underscores. More... | |
| template<typename Callable > | |
| std::string | find_and_modify (std::string str, std::string trigger, Callable modify) |
| std::vector< std::string > | split_up (std::string str) |
| std::string | fix_newlines (std::string leader, std::string input) |
| size_t | escape_detect (std::string &str, size_t offset) |
| std::string & | add_quotes_if_needed (std::string &str) |
| Add quotes if the string contains spaces. More... | |
| template<typename T , enable_if_t< std::is_constructible< std::string, T >::value, detail::enabler > = detail::dummy> | |
| auto | to_string (T &&value) -> decltype(std::forward< T >(value)) |
| Convert an object to a string (directly forward if this can become a string) More... | |
| template<typename T , enable_if_t<!std::is_constructible< std::string, T >::value &&is_streamable< std::stringstream, T >::value, detail::enabler > = detail::dummy> | |
| std::string | to_string (T &&value) |
| Convert an object to a string (streaming must be supported for that type) More... | |
| template<typename T , enable_if_t< std::is_integral< T >::value &&std::is_signed< T >::value, detail::enabler > = detail::dummy> | |
| constexpr const char * | type_name () |
| This one should not be used, since vector types print the internal type. More... | |
| int64_t | to_flag_value (std::string val) |
| Convert a flag into an integer value typically binary flags. More... | |
| template<typename T , enable_if_t< std::is_integral< T >::value &&std::is_signed< T >::value &&!is_bool< T >::value &&!std::is_enum< T >::value, detail::enabler > = detail::dummy> | |
| bool | lexical_cast (std::string input, T &output) |
| Signed integers. More... | |
| template<typename T , enable_if_t< std::is_integral< T >::value &&std::is_unsigned< T >::value, detail::enabler > = detail::dummy> | |
| void | sum_flag_vector (const std::vector< std::string > &flags, T &output) |
| bool | split_short (const std::string ¤t, std::string &name, std::string &rest) |
| bool | split_long (const std::string ¤t, std::string &name, std::string &value) |
| bool | split_windows_style (const std::string ¤t, std::string &name, std::string &value) |
| std::vector< std::string > | split_names (std::string current) |
| std::vector< std::pair< std::string, std::string > > | get_default_flag_values (const std::string &str) |
| extract default flag values either {def} or starting with a ! More... | |
| std::tuple< std::vector< std::string >, std::vector< std::string >, std::string > | get_names (const std::vector< std::string > &input) |
| Get a vector of short names, one of long names, and a single name. More... | |
| std::string | ini_join (std::vector< std::string > args) |
| Comma separated join, adds quotes if needed. More... | |
| template<typename T , enable_if_t< is_copyable_ptr< typename std::remove_reference< T >::type >::value, detail::enabler > = detail::dummy> | |
| auto | smart_deref (T value) -> decltype(*value) |
| template<typename T , enable_if_t<!is_copyable_ptr< typename std::remove_reference< T >::type >::value, detail::enabler > = detail::dummy> | |
| std::remove_reference< T >::type & | smart_deref (T &value) |
| template<typename T > | |
| std::string | generate_set (const T &set) |
| Generate a string representation of a set. More... | |
| template<typename T > | |
| std::string | generate_map (const T &map, bool key_only=false) |
| Generate a string representation of a map. More... | |
| template<typename T , typename V > | |
| static auto | test_find (int) -> sfinae_true< decltype(std::declval< T >().find(std::declval< V >()))> |
| template<typename , typename V > | |
| static auto | test_find (long) -> std::false_type |
| template<typename T , typename V , enable_if_t<!has_find< T, V >::value, detail::enabler > = detail::dummy> | |
| auto | search (const T &set, const V &val) -> std::pair< bool, decltype(std::begin(detail::smart_deref(set)))> |
| A search function. More... | |
| template<typename T , typename V > | |
| auto | search (const T &set, const V &val, const std::function< V(V)> &filter_function) -> std::pair< bool, decltype(std::begin(detail::smart_deref(set)))> |
| A search function with a filter function. More... | |
| template<typename T > | |
| std::enable_if< std::is_integral< T >::value, bool >::type | checked_multiply (T &a, T b) |
| Performs a *= b; if it doesn't cause integer overflow. Returns false otherwise. More... | |
| template<typename T > | |
| std::enable_if< std::is_floating_point< T >::value, bool >::type | checked_multiply (T &a, T b) |
| Performs a *= b; if it doesn't equal infinity. Returns false otherwise. More... | |
| std::pair< std::string, std::string > | split_program_name (std::string commandline) |
| std::string | simple (const App *app, const Error &e) |
| Printout a clean, simple message on error (the default in CLI11 1.5+) More... | |
| std::string | help (const App *app, const Error &e) |
| Printout the full help string on error (if this fn is set, the old default for CLI11) More... | |
| void | TriggerOn (App *trigger_app, App *app_to_enable) |
| Helper function to enable one option group/subcommand when another is used. More... | |
| void | TriggerOn (App *trigger_app, std::vector< App *> apps_to_enable) |
| Helper function to enable one option group/subcommand when another is used. More... | |
| void | TriggerOff (App *trigger_app, App *app_to_enable) |
| Helper function to disable one option group/subcommand when another is used. More... | |
| void | TriggerOff (App *trigger_app, std::vector< App *> apps_to_enable) |
| Helper function to disable one option group/subcommand when another is used. More... | |
Variables | |
| constexpr enabler | dummy = {} |
| An instance to use in EnableIf. More... | |
| template<typename T > | |
| using | TransformPairs = std::vector< std::pair< std::string, T > > |
| definition of the default transformation object More... | |
| const detail::ExistingFileValidator | ExistingFile |
| Check for existing file (returns error message if check fails) More... | |
| const detail::ExistingDirectoryValidator | ExistingDirectory |
| Check for an existing directory (returns error message if check fails) More... | |
| const detail::ExistingPathValidator | ExistingPath |
| Check for an existing path. More... | |
| const detail::NonexistentPathValidator | NonexistentPath |
| Check for an non-existing path. More... | |
| const detail::IPV4Validator | ValidIPV4 |
| Check for an IP4 address. More... | |
| const detail::PositiveNumber | PositiveNumber |
| Check for a positive number. More... | |
| const detail::Number | Number |
| Check for a number. More... | |
| std::string | ignore_case (std::string item) |
| Helper function to allow ignore_case to be passed to IsMember or Transform. More... | |
| std::string | ignore_underscore (std::string item) |
| Helper function to allow ignore_underscore to be passed to IsMember or Transform. More... | |
| std::string | ignore_space (std::string item) |
| Helper function to allow checks to ignore spaces to be passed to IsMember or Transform. More... | |
| #define CLI11_DEPRECATED | ( | reason | ) | __attribute__((deprecated(reason))) |
| #define CLI11_ERROR_DEF | ( | parent, | |
| name | |||
| ) |
| #define CLI11_ERROR_SIMPLE | ( | name | ) | explicit name(std::string msg) : name(#name, msg, ExitCodes::name) {} |
| #define CLI11_PARSE | ( | app, | |
| argc, | |||
| argv | |||
| ) |
1.8.13