#include <winstl/system/commandline_parser.hpp>
WinMain()
) command line into parts, and provides array semantics for their access.
winstl::commandline_parser cp("abc \"d e f\" ghi"); assert(3 == cp.size()); assert(0 == ::strcmp("abc", cp[0])); assert(0 == ::strcmp("d e f", cp[1])); assert(0 == ::strcmp("ghi", cp[2]));
Member Types | |
typedef C | char_type |
The character type. | |
typedef T | traits_type |
The traits type. | |
typedef basic_commandline_parser< C, T > | class_type |
The current instantiation of the type. | |
typedef pointers_type_::value_type | value_type |
The value type. | |
typedef pointers_type_::const_iterator | const_iterator |
The non-mutating (const) iterator type. | |
typedef size_t | size_type |
The size type. | |
Construction | |
basic_commandline_parser (char_type const *cmdLine) | |
Parses the given command-line and creates an internal array of pointers to the arguments. | |
basic_commandline_parser (char_type const *cmdLine, size_type len) | |
Parses the given command-line and creates an internal array of pointers to the arguments. | |
Public Member Functions | |
Accessors | |
size_type | size () const |
The number of arguments. | |
value_type const & | operator[] (size_type index) const |
Returns a non-mutating (const) pointer to each argument string. | |
Iteration | |
const_iterator | begin () const |
An iterator representing the start of the sequence. | |
const_iterator | end () const |
An iterator representing the end of the sequence. |
typedef C char_type |
The character type.
typedef T traits_type |
The traits type.
typedef basic_commandline_parser<C, T> class_type |
The current instantiation of the type.
typedef pointers_type_::value_type value_type |
The value type.
The non-mutating (const) iterator type.
typedef size_t size_type |
The size type.
basic_commandline_parser | ( | char_type const * | cmdLine | ) | [inline, explicit] |
Parses the given command-line and creates an internal array of pointers to the arguments.
basic_commandline_parser | ( | char_type const * | cmdLine, | |
size_type | len | |||
) | [inline, explicit] |
Parses the given command-line and creates an internal array of pointers to the arguments.
size_type size | ( | ) | const [inline] |
The number of arguments.
value_type const& operator[] | ( | size_type | index | ) | const [inline] |
Returns a non-mutating (const) pointer to each argument string.
index | The index of the argument |
index
is greater than size()
. If index
is equal to size()
, then the returned reference may not be used, other than to take its address (which is the address of the "end-element"). References WINSTL_ASSERT.
const_iterator begin | ( | ) | const [inline] |
An iterator representing the start of the sequence.
const_iterator end | ( | ) | const [inline] |
An iterator representing the end of the sequence.