basic_commandline_parser Class Template Reference
[System Library]

#include <winstl/system/commandline_parser.hpp>

List of all members.


Detailed Description

template<typename C, typename T = stlsoft:: stlsoft_char_traits <C>>
class winstl::basic_commandline_parser< C, T >

Parses a Windows (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.

Member Typedef Documentation

typedef C char_type

The character type.

typedef T traits_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.

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.


Member Function Documentation

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.

Parameters:
index The index of the argument
Note:
The behaviour is undefined if 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.


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

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