-
template
class
OptionHandler<typename C>
-
Abstract template class for option handlers.
An option handler is an object that interprets arguments of a command line
to configure another instance (change its state).
The option handler is called when its identifier appears in the argument list.
It could consume the option identifier - so that it is not longer
part of the argument list - and could consumes further elements of the
argument list that serve as configuration parameters.
This class template servers as base for option handlers that configure
instances of class C.
Public Members:
-
OptionHandler (const string& id, bool consuming) ;
-
Create a option handler instance.
Required arguments are the option identifier and the
consumption status.
-
virtual ~OptionHandler () ;
-
Destructor.
Does nothing. Ensures that all derived classes have a virtual
destructor.
-
virtual const string& identifier () const ;
-
The option identifier.
Returns the string that identifies the option.
-
virtual bool consuming () const ;
-
Consumption status.
Returns true when the option is consumed, meaning it is removed from
the argument list.
-
virtual ArgVector::iterator fireOption (C& inst, const string& id, ArgVector& args, ArgVector::iterator rest) ;
-
Fire the option.
This function actually handles the option. It could do whatever it wants to
process the option. It gets the instance to configure, the option name, the argument
list and an iterator pointing to the first element behind the option identifier.
If the option handler consumes further elements from the argument list, it must remove
them from the list and return the new head of the rest arguments as return value.
Otherwise the value of the rest parameter must be returned.
The Scrunitizer C++ Unit Test Framework
by Bernd Linowski
[Scrunitizer]
[Overview]
[Cookbook]
[Download]
[Index]
[Linosphere]
Page generated: 1 Nov 2000
(C) by Bernd Linowski
scrunitizer@linosphere.de
|