basic_commandline_parser Class Template Reference
[System Library]

#include <stlsoft/system/commandline_parser.hpp>

List of all members.


Detailed Description

template<typename C, typename T = stlsoft:: stlsoft_char_traits <C>, typename A = typename allocator_selector<C>::allocator_type>
class stlsoft::basic_commandline_parser< C, T, A >

Parses a command line into parts, and provides sequence semantics for their access.

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.

Member Typedef Documentation

typedef C char_type

The character type.

typedef T traits_type

The traits type.

typedef A allocator_type

The traits type.

The current instantiation of the type.

The value type.

The non-mutating (const) iterator type.

typedef size_t size_type

The size type.


Constructor & Destructor Documentation

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.


Member Function Documentation

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.

Parameters:
index The index of the argument
Note:
The behaviour is undefined if index is not less than size().

References basic_commandline_parser::size(), and STLSOFT_ASSERT.

const_iterator begin (  )  const [inline]

An iterator representing the start of the sequence.

References auto_buffer::begin().

const_iterator end (  )  const [inline]

An iterator representing the end of the sequence.

References auto_buffer::end().


The documentation for this class was generated from the following file:

Generated on Thu Jun 10 08:59:01 2010 for STLSoft by  doxygen 1.5.6