Joutsen.ArgumentsParsing v0.3.0+1-ga4c84ed
Public Member Functions | Static Public Member Functions | Properties | List of all members
Joutsen.ArgumentsParsing.FlagArgument< TValueType > Class Template Reference

An argument that handles input values that are only a name, mostly known as flags. More...

Public Member Functions

 FlagArgument (String flag, String alternative, String destination, TValueType parsedValue, TValueType unparsedValue=default(TValueType), String help=null)
 Creates a new instance of the argument. More...
 
override string Description (string name=null, string alternative=null)
 
override string Usage (string name=null)
 
 FlagArgument (String flag, String alternative, String destination, bool value=true, String help=null)
 Creates a new instance of the argument. More...
 
- Public Member Functions inherited from Joutsen.ArgumentsParsing.TargetPropertyArgument< TValueType >
virtual string Description (string name=null, string alternative=null)
 Fetches the description of this argument. More...
 
virtual string Usage (string name=null)
 Fetches the usage description of this argument. More...
 
ArgumentLiteralParser GetParser ()
 Fetchs the literal parser for this argument. More...
 

Static Public Member Functions

static FlagArgument< ValueType > Create< TargetType, ValueType > (String flag, String alternative, Expression< Func< TargetType, ValueType > > destination, ValueType parsedValue, ValueType unparsedValue=default(ValueType), string help=null)
 Creates a new instance of the typed FlagArgument. More...
 
static FlagArgument Create< TargetType > (String flag, String alternative, Expression< Func< TargetType, bool > > destination=null, bool value=true, string help=null)
 Creates a new instance of the FlagArgument. More...
 

Properties

string Alternative [get]
 The alternative name that is usually a longer version of the flag as it appears in the input list. More...
 
- Properties inherited from Joutsen.ArgumentsParsing.TargetPropertyArgument< TValueType >
String Name [get]
 
bool IsRequired [get]
 

Additional Inherited Members

- Protected Member Functions inherited from Joutsen.ArgumentsParsing.TargetPropertyArgument< TValueType >
 TargetPropertyArgument (ArgumentReader< ValueType > reader, string name, bool required, ValueType defaultValue, string destination, string help, bool isFlag)
 Creates a new instance of the argument. More...
 
- Protected Attributes inherited from Joutsen.ArgumentsParsing.TargetPropertyArgument< TValueType >
string helpText
 
TargetPropertyParser< ValueType > parser
 

Detailed Description

An argument that handles input values that are only a name, mostly known as flags.

The presence and absence of a flag indicate two different values.

Template Parameters
TValueTypethe type of the values represented by the flag
Since
0.2.0

Constructor & Destructor Documentation

◆ FlagArgument() [1/2]

Joutsen.ArgumentsParsing.FlagArgument< TValueType >.FlagArgument ( String  flag,
String  alternative,
String  destination,
TValueType  parsedValue,
TValueType  unparsedValue = default(TValueType),
String  help = null 
)

Creates a new instance of the argument.

Parameters
flagthe name of the flag as it appears in the input list
alternativean alternative name that is usually a longer version of the flag as it appears in the input list
destinationthe property name of the target instance which shall recieve the parsed value. If this is null the name will be used instead.
parsedValuethe resulting parsed value of the argument if it was present in the input list
unparsedValuethe resulting default value of the argument if it was NOT present in the input list
helpa help text describing the parameter. It will be used to generade the description of the argument.

◆ FlagArgument() [2/2]

Joutsen.ArgumentsParsing.FlagArgument< TValueType >.FlagArgument ( String  flag,
String  alternative,
String  destination,
bool  value = true,
String  help = null 
)

Creates a new instance of the argument.

Parameters
flagthe name of the flag as it appears in the input list
alternativean alternative name that is usually a longer version of the flag as it appears in the input list
destinationthe property name of the target instance which shall recieve the parsed value. If this is null the name will be used instead.
valuethe resulting boolean value of the argument if it was present in the input list. The inverted value becomes the defaultValue.
helpa help text describing the parameter. It will be used to generade the description of the argument.

Member Function Documentation

◆ Create< TargetType >()

static FlagArgument Joutsen.ArgumentsParsing.FlagArgument< TValueType >.Create< TargetType > ( String  flag,
String  alternative,
Expression< Func< TargetType, bool > >  destination = null,
bool  value = true,
string  help = null 
)
static

Creates a new instance of the FlagArgument.

Template Parameters
TargetTypethe type of the target object that will receive the parsed values.
Parameters
flagthe name of the flag as it appears in the input list
alternativean alternative name that is usually a longer version of the flag as it appears in the input list
destinationan expression describing the property of the target instance which shall recieve the parsed value. If this is null the target property will be found using the name of the argument.
valuethe resulting boolean value of the argument if it was present in the input list. The inverted value becomes the defaultValue.
helpa help text describing the parameter. It will be used to generade the description of the argument.

◆ Create< TargetType, ValueType >()

static FlagArgument< ValueType > Joutsen.ArgumentsParsing.FlagArgument< TValueType >.Create< TargetType, ValueType > ( String  flag,
String  alternative,
Expression< Func< TargetType, ValueType > >  destination,
ValueType  parsedValue,
ValueType  unparsedValue = default(ValueType),
string  help = null 
)
static

Creates a new instance of the typed FlagArgument.

Template Parameters
TargetTypethe type of the target object that will receive the parsed values.
ValueTypethe type of the ValueArgument and the property on the target object
Parameters
flagthe name of the flag as it appears in the input list
alternativean alternative name that is usually a longer version of the flag as it appears in the input list
destinationan expression describing the property of the target instance which shall recieve the parsed value. If this is null the target property will be found using the name of the argument.
parsedValuethe resulting parsed value of the argument if it was present in the input list
unparsedValuethe resulting default value of the argument if it was NOT present in the input list
helpa help text describing the parameter. It will be used to generade the description of the argument.

◆ Description()

override string Joutsen.ArgumentsParsing.FlagArgument< TValueType >.Description ( string  name = null,
string  alternative = null 
)
virtual

◆ Usage()

override string Joutsen.ArgumentsParsing.FlagArgument< TValueType >.Usage ( string  name = null)
virtual

Property Documentation

◆ Alternative

string Joutsen.ArgumentsParsing.FlagArgument< TValueType >.Alternative
get

The alternative name that is usually a longer version of the flag as it appears in the input list.