UNISTDX_BASE_COMMAND_LINE
using input_operator_type = std::function< bool(int, const std::string &)>

Function that parses command line argument.

template <class T>
class sys::key_value

Command line argument encoded as key=value pair.

Types
  • using delimiter_type = std::string::value_type

    Alias to std::string::value_type.

  • using key_type = std::string

    Alias to std::string.

Methods
  • operator()(int, const std::string & arg) -> bool

    Parse command line argument as key-value pair.

  • key_value(const key_type & key, T & value, delimiter_type delim = '=')

    Construct key-value pair with key key and reference to value value.

class sys::bad_argument

Invalid command line argument error.

Base classes
  • public std::exception
Methods
  • argument() const -> const char *

    Command line argument name.

  • what() const -> const char *

    Error message.

  • bad_argument(const char * arg)explicit

    Construct error object for command line argument arg.

struct sys::ignore_first_argument

Ignores nought command line argument, which usually equals executable name. Fails on all other arguments.

Methods
  • operator()(int pos, const std::string &) -> bool

    Ignores nought command line argument, which usually equals executable name. Fails on all other arguments.

template <class T>
make_key_value(const std::string & key, T & value) -> key_value< T >

Helper function to construct key-value pair.

parse_arguments(int argc, char * argv, input_operator_type * input_operators) -> void

Parse command line arguments argv using provided input_operators.

parse_arguments(int argc, const char * argv, input_operator_type * input_operators) -> void

Parse command line arguments argv using provided input_operators.