Elm  2
ELM is a library providing generic data structures, OS-independent interface, plugins and XML.
ListOption< T > Class Template Reference

#include <elm/option/ListOption.h>

+ Inheritance diagram for ListOption< T >:

Public Member Functions

 ListOption (const Make &make)
 
const T & get (int index) const
 
void set (int index, const T &value)
 
T & ref (int index)
 
void add (const T &val)
 
void remove (int index)
 
int count (void) const
 
 operator bool (void) const
 
const T & operator[] (int index) const
 
T & operator[] (int index)
 
Vector< T >::Iter begin () const
 
Vector< T >::Iter end () const
 
virtual void process (String arg)
 
- Public Member Functions inherited from AbstractValueOption
 AbstractValueOption (const Make &make)
 
 AbstractValueOption (Manager &man)
 
cstring description (void) override
 
usage_t usage (void) override
 
cstring argDescription (void) override
 
- Public Member Functions inherited from Option
 Option ()
 
 Option (const Make &make)
 
virtual ~Option ()
 

Additional Inherited Members

- Protected Attributes inherited from Option
cstring desc
 

Detailed Description

template<class T>
class elm::option::ListOption< T >

Option that accepts a list of value, that is, accepts several command and their linked argument.

Parameters
TType of arguments.

Constructor & Destructor Documentation

◆ ListOption()

ListOption ( const Make make)
inline

Simple constructor.

Parameters
manOwner manager.
tagFirst tag.
...(tag, value) pair list (ended by end).
manOwner manager.
tagFirst tag.
args(tag, value) pair list (ended by end).

Member Function Documentation

◆ add()

void add ( const T &  val)
inline

Add a value to the list.

Parameters
valValue to add.

References Vector< T, E, A >::add().

◆ begin()

Vector<T>::Iter begin ( ) const
inline

◆ count()

int count ( void  ) const
inline

Get the count of values.

Returns
Value count.

References Vector< T, E, A >::count().

◆ end()

Vector<T>::Iter end ( ) const
inline

◆ get()

const T & get ( int  index) const
inline

Get the value at the given index.

Parameters
indexIndex of the requested value.
Returns
Value at the given index.

◆ operator bool()

operator bool ( void  ) const
inline

◆ operator[]() [1/2]

T& operator[] ( int  index)
inline

◆ operator[]() [2/2]

const T& operator[] ( int  index) const
inline

◆ process()

virtual void process ( String  arg)
inlinevirtual

This method is called by the option manager when the option is encountered.

Parameters
argIf the option requires an argument, the value of the argument.

Implements Option.

References Vector< T, E, A >::add().

◆ ref()

T & ref ( int  index)
inline

Get reference on a value.

Parameters
indexIndex of value to get reference for.
Returns
Reference of value matching the index.

◆ remove()

void remove ( int  index)
inline

Remove value at the given index.

Parameters
indexIndex of the value to remove.

References Vector< T, E, A >::removeAt().

◆ set()

void set ( int  index,
const T &  value 
)
inline

Set a value in the list.

Parameters
indexIndex of the value to set.
valueValue to set.

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