ROSE  0.11.96.11
Public Types | Public Member Functions | List of all members
Sawyer::CommandLine::ValueAugmenter Class Referenceabstract

Description

Base class for value agumentors.

A ValueAugmenter is invoked after a switch argument (explicit or default) is parsed and somehow merges the newly parsed value with previous values. The augmenter is called only when the switch whichProperty is set to SAVE_AUGMENTED.

The merge is performed by the function operator, which is given two sets of parsed values: the values that were previously parsed and stored in a ParserResult for the same switch key, and the values that were recently parsed for the switch. The method should combine the two in some way and return a new set of values that replace all previous and recently parsed values. The return values should contain appropriate information for the valueLocation, valueString, switchLocation, switchString, and valueSaver properties. Most of the time these properties can be initialized from parsed values passed to the function operator.

Most subclasses will have factory functions to instantiate reference counted, allocated objects. See Command line value augmenter factories for a list.

Definition at line 1896 of file util/Sawyer/CommandLine.h.

#include <CommandLine.h>

Inheritance diagram for Sawyer::CommandLine::ValueAugmenter:
Inheritance graph
[legend]
Collaboration diagram for Sawyer::CommandLine::ValueAugmenter:
Collaboration graph
[legend]

Public Types

typedef SharedPointer< ValueAugmenterPtr
 Reference counting pointer for this class.
 

Public Member Functions

virtual ParsedValues operator() (const ParsedValues &savedValues, const ParsedValues &newValues)=0
 Called when a switch's value is about to be stored into the ParserResult. More...
 
- Public Member Functions inherited from Sawyer::SharedObject
 SharedObject ()
 Default constructor. More...
 
 SharedObject (const SharedObject &)
 Copy constructor. More...
 
virtual ~SharedObject ()
 Virtual destructor. More...
 
SharedObjectoperator= (const SharedObject &)
 Assignment. More...
 

Member Function Documentation

◆ operator()()

virtual ParsedValues Sawyer::CommandLine::ValueAugmenter::operator() ( const ParsedValues savedValues,
const ParsedValues newValues 
)
pure virtual

Called when a switch's value is about to be stored into the ParserResult.

The previously stored switch values for all switch occurrences that used this same key are provided in the first arugment. The recently parsed value (or values if the switch value was a list that was then exploded) is provided as the second argument. The function should return a new value (or values) that will replace the values passed on the command-line.

Implemented in Rose::Color::ColorizationMerge, and Sawyer::CommandLine::Sum< T >.


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