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

A parser argument that only accepts distinct predefined values. More...

Public Member Functions

 ChoiceArgument (string name, Set< ValueType > values, bool required=true, ValueType defaultValue=default(ValueType), string destination=null, string help=null)
 Creates a new instance of the argument. More...
 
override string Description (string name=null, string alternative=null)
 Fetches the description of this argument. More...
 
- Public Member Functions inherited from Joutsen.ArgumentsParsing.ValueArgument< ValueType >
 ValueArgument (string name, bool required=true, ValueType defaultValue=default(ValueType), string destination=null, string help=null)
 Creates a new instance of the argument. More...
 
override string Usage (string name=null)
 Fetches the usage description of this argument. More...
 
override string Description (string name=null, string alternative=null)
 Fetches the description of this argument. More...
 
- Public Member Functions inherited from Joutsen.ArgumentsParsing.TargetPropertyArgument< ValueType >
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...
 
string Description (string name=null, string alternative=null)
 Fetches the description of this argument. More...
 
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 ChoiceArgument< ValueType > Create< TargetType, ValueType > (string name, Set< ValueType > values, bool required=true, ValueType defaultValue=default(ValueType), Expression< Func< TargetType, ValueType > > destination=null, string help=null)
 Creates a new instance of the ChoiceArgument. More...
 
- Static Public Member Functions inherited from Joutsen.ArgumentsParsing.ValueArgument< ValueType >
static ValueArgument< ValueType > Create< TargetType, ValueType > (string name, bool required=true, ValueType defaultValue=default(ValueType), Expression< Func< TargetType, ValueType > > destination=null, string help=null)
 Creates a new instance of a ValueArgument. More...
 

Additional Inherited Members

- Protected Member Functions inherited from Joutsen.ArgumentsParsing.ValueArgument< ValueType >
 ValueArgument (ArgumentReader< ValueType > reader, string name, bool required, ValueType defaultValue, string destination, string help)
 
- Protected Member Functions inherited from Joutsen.ArgumentsParsing.TargetPropertyArgument< ValueType >
 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< ValueType >
string helpText
 
TargetPropertyParser< ValueType > parser
 
- Properties inherited from Joutsen.ArgumentsParsing.ValueArgument< ValueType >
String ValueStartDelimiter [get, set]
 The delimiter indicating the start of the combined value. More...
 
String ValueEndDelimiter [get, set]
 The delimiter indicating the end of the combined value. More...
 
String ValuePartsConnector [get, set]
 A term that is used to connect the values from the input list into a single parsed one. More...
 
bool KeepDelimiters [get, set]
 Determiens wether the delimiters are part of the resulting value or not. More...
 
SimpleTypeConverter< string, ValueType > TypeConverter [get, set]
 The converter used to create the parsed value from the input value. More...
 
- Properties inherited from Joutsen.ArgumentsParsing.TargetPropertyArgument< ValueType >
String Name [get]
 
bool IsRequired [get]
 

Detailed Description

A parser argument that only accepts distinct predefined values.

A static class offering convenient ways to create ChoiceArguments.

Since
0.2.0

Constructor & Destructor Documentation

◆ ChoiceArgument()

Joutsen.ArgumentsParsing.ChoiceArgument< ValueType >.ChoiceArgument ( string  name,
Set< ValueType >  values,
bool  required = true,
ValueType  defaultValue = default(ValueType),
string  destination = null,
string  help = null 
)

Creates a new instance of the argument.

Parameters
namethe name of the argument
valuesthe accepted values for this argument
requiredindicates wether this argument has to appear in the input list or if it is optional
defaultValuethe value that wil be set onthe target for this argument if it is not required and did not appear int he 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.
helpa help text describing the parameter. It will be used to generade the description of the argument.

Member Function Documentation

◆ Create< TargetType, ValueType >()

static ChoiceArgument< ValueType > Joutsen.ArgumentsParsing.ChoiceArgument< ValueType >.Create< TargetType, ValueType > ( string  name,
Set< ValueType >  values,
bool  required = true,
ValueType  defaultValue = default(ValueType),
Expression< Func< TargetType, ValueType > >  destination = null,
string  help = null 
)
static

Creates a new instance of the ChoiceArgument.

Parameters
namethe name of the argument
valuesthe accepted values for this argument
requiredindicates wether this argument has to appear in the input list or if it is optional
defaultValuethe value that wil be set onthe target for this argument if it is not required and did not appear int he 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.
helpa help text describing the parameter. It will be used to generade the description of the argument.

◆ Description()

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

Fetches the description of this argument.

Parameters
namefor arguments that are identified by their name in the input string, the name to incorporate into the description
alternativefor arguments that are identified by their alternative name in the input string, the alternative name to incorporate into the description
Returns
the description

Reimplemented from Joutsen.ArgumentsParsing.TargetPropertyArgument< ValueType >.