#include <stlsoft/system/commandline_parser.hpp>
stlsoft::commandline_parser_a 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])); std::copy(cp.begin(), cp.end() , std::ostream_iterator<char const*>(std::cout, "\n"));
Member Types | |
typedef C | char_type |
The character type. | |
typedef T | traits_type |
The traits type. | |
typedef A | allocator_type |
The traits type. | |
typedef basic_commandline_parser< C, T, A > | 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. | |
Public Member Functions | |
Construction | |
basic_commandline_parser (char_type const *cmdLine) | |
Parses the given command-line and creates an internal array of pointers to the arguments. | |
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 A allocator_type |
The traits type.
typedef basic_commandline_parser<C, T, A> class_type |
The current instantiation of the type.
typedef pointers_type::value_type value_type |
The value type.
The non-mutating (const) iterator 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.
References auto_buffer::begin(), auto_buffer::end(), auto_buffer::size(), and STLSOFT_ASSERT.
size_type size | ( | ) | const [inline] |
The number of arguments.
References auto_buffer::size().
Referenced by basic_commandline_parser::operator[]().
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 not less than size()
. References basic_commandline_parser::size(), and STLSOFT_ASSERT.
const_iterator begin | ( | ) | const [inline] |
const_iterator end | ( | ) | const [inline] |