Joutsen.ArgumentsParsing v0.3.0+1-ga4c84ed
Public Member Functions | Protected Member Functions | Properties | List of all members
Joutsen.ArgumentsParsing.FlagArgumentReader< ValueType > Class Template Reference

A reader that processes a single flag value and produces a predetermined value when it finds a match in the input. More...

Public Member Functions

 FlagArgumentReader (String name, String alternative, ValueType resultValue)
 Creates a new instance of the reader. More...
 
virtual ArgumentReadResult< ValueType > Read (ArgumentsIterator args, string name, int offset=0)
 Trys to match the flag with the providd name or the first literal from the input. More...
 
ArgumentReadResult< ValueType > Read (ArgumentsIterator args, string name, int offset=0)
 Reads literals from the input. More...
 

Protected Member Functions

virtual bool MatchesArgument (string argument)
 Checks if a value matches the flags names. More...
 

Properties

String Name [get]
 The name of the flag or more precisely the flag that the reader trys to match with the input literal. More...
 
String Alternative [get]
 The alternative to the name of the flag that the reader will try to match with the input literal. More...
 
Set< String > ArgumentPrefixes [set]
 The prefixes of the arguments used by the parser. More...
 
- Properties inherited from Joutsen.ArgumentsParsing.ArgumentReader< ValueType >
Set< String > ArgumentPrefixes [set]
 The prefixes of the arguments used by the parser. More...
 

Detailed Description

A reader that processes a single flag value and produces a predetermined value when it finds a match in the input.

Since
0.2.0

Constructor & Destructor Documentation

◆ FlagArgumentReader()

Joutsen.ArgumentsParsing.FlagArgumentReader< ValueType >.FlagArgumentReader ( String  name,
String  alternative,
ValueType  resultValue 
)

Creates a new instance of the reader.

Parameters
namethe name of the flag that the reader trys to match with the input literal
alternativethe alternative to the name of the flag that the reader will try to match with the input literal
resultValuethe result value the reader will return if the flag was matched

Member Function Documentation

◆ MatchesArgument()

virtual bool Joutsen.ArgumentsParsing.FlagArgumentReader< ValueType >.MatchesArgument ( string  argument)
protectedvirtual

Checks if a value matches the flags names.

◆ Read()

virtual ArgumentReadResult< ValueType > Joutsen.ArgumentsParsing.FlagArgumentReader< ValueType >.Read ( ArgumentsIterator  args,
string  name,
int  offset = 0 
)
virtual

Trys to match the flag with the providd name or the first literal from the input.

Parameters
argsthe input list of literal values represented by an iterator
namethe name of the argument whose values to read as found in the input
offsetan optional additional offset of literals where to start reading from the input
Returns
the value read from the input and the number of literals used in the process

Implements Joutsen.ArgumentsParsing.ArgumentReader< ValueType >.

Property Documentation

◆ Alternative

String Joutsen.ArgumentsParsing.FlagArgumentReader< ValueType >.Alternative
get

The alternative to the name of the flag that the reader will try to match with the input literal.

◆ ArgumentPrefixes

Set<String> Joutsen.ArgumentsParsing.FlagArgumentReader< ValueType >.ArgumentPrefixes
set

The prefixes of the arguments used by the parser.

The values are sometimes used to limit the number of values read from the input.

Implements Joutsen.ArgumentsParsing.ArgumentReader< ValueType >.

◆ Name

String Joutsen.ArgumentsParsing.FlagArgumentReader< ValueType >.Name
get

The name of the flag or more precisely the flag that the reader trys to match with the input literal.