#include <stlsoft/system/cmdargs.hpp>
argv
elements to different strings. Public Types | |
enum | { singleDash = 1, doubleDash = 2, tripleDash = 3 } |
typedef simple_string | string_type |
typedef basic_string_view< char > | string_view_type |
typedef option | options_value_type |
typedef value | values_value_type |
typedef std::vector < options_value_type > | options_type |
typedef std::vector < values_value_type > | values_type |
typedef options_type::const_iterator | const_options_iterator |
typedef values_type::const_iterator | const_values_iterator |
typedef size_t | size_type |
typedef bool | bool_type |
Public Member Functions | |
Construction | |
cmdargs (int argc, char **argv) | |
Constructs from argc/argv. | |
~cmdargs () throw () | |
Releases any resources. | |
Attributes | |
options_type const & | options () const |
non-mutating reference to the options | |
values_type const & | values () const |
non-mutating reference to the values | |
const_options_iterator | options_begin () const |
const_options_iterator | options_end () const |
const_values_iterator | values_begin () const |
const_values_iterator | values_end () const |
size_type | options_size () const |
The number of options. | |
size_type | values_size () const |
The number of values. | |
size_type | size () const |
The numbers options and values. | |
bool_type | empty () const |
Indicates whether there are any options and/or values. | |
template<typename S> | |
bool_type | has_option (S const &optionName, int type=-1) const |
Determines whether the options collection contains an option of the given name. | |
template<typename S> | |
bool_type | has_option (S const &optionName, int type, option &opt) const |
Determines whether the options collection contains an option of the given name, and copies the found option's details into a caller-supplied instance. | |
template<typename S> | |
bool_type | has_value (S const &valueName) const |
template<typename S> | |
bool_type | has_value (S const &valueName, value &val) const |
Classes | |
struct | option |
Represents a command-line option. More... | |
struct | value |
Represents a command-line value. More... |
~cmdargs | ( | ) | throw () |
Releases any resources.
options_type const& options | ( | ) | const |
non-mutating reference to the options
values_type const& values | ( | ) | const |
non-mutating reference to the values
size_type options_size | ( | ) | const |
The number of options.
size_type values_size | ( | ) | const |
The number of values.
size_type size | ( | ) | const |
The numbers options and values.
bool_type empty | ( | ) | const |
Indicates whether there are any options and/or values.
bool_type has_option | ( | S const & | optionName, | |
int | type = -1 | |||
) | const [inline] |
Determines whether the options collection contains an option of the given name.
optionName | The name of the option to search for | |
type | The type of the option (i.e the number of hyphens). It defaults to -1, which indicates that the caller does not care. |
References stlsoft::c_str_ptr().
Determines whether the options collection contains an option of the given name, and copies the found option's details into a caller-supplied instance.
optionName | The name of the option to search for | |
type | The type of the option (i.e the number of hyphens). The caller can specify -1 to indicate that it does not care. | |
opt | The instance into which the |
References stlsoft::c_str_ptr().