Joutsen.ArgumentsParsing  v0.2.1
Public Member Functions | Static Public Member Functions | Protected Member Functions | Properties | List of all members
Joutsen.ArgumentsParsing.ValueArgument< ValueType > Class Template Reference

A simple argument that parses a value from the input list. More...

Public Member Functions

 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 >
ArgumentLiteralParser GetParser ()
 Fetchs the literal parser for this argument. More...
 

Static Public Member Functions

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...
 

Protected Member Functions

 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...
 

Properties

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]
 

Additional Inherited Members

- Protected Attributes inherited from Joutsen.ArgumentsParsing.TargetPropertyArgument< ValueType >
string helpText
 
TargetPropertyParser< ValueType > parser
 

Detailed Description

A simple argument that parses a value from the input list.

A static class offering convenient ways to create ValueArguments.

Since
0.2.0

Constructor & Destructor Documentation

◆ ValueArgument() [1/2]

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.

Parameters
namethe name of the 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
destiantionthe 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.
Since
0.2.0

◆ ValueArgument() [2/2]

Joutsen.ArgumentsParsing.ValueArgument< ValueType >.ValueArgument ( ArgumentReader< ValueType >  reader,
string  name,
bool  required,
ValueType  defaultValue,
string  destination,
string  help 
)
protected

Member Function Documentation

◆ Create< TargetType, ValueType >()

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

Creates a new instance of a ValueArgument.

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
namethe name of the 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
destiantionan 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.ValueArgument< 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 >.

◆ Usage()

override string Joutsen.ArgumentsParsing.ValueArgument< ValueType >.Usage ( string  name = null)
virtual

Fetches the usage description of this argument.

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

Reimplemented from Joutsen.ArgumentsParsing.TargetPropertyArgument< ValueType >.

Property Documentation

◆ KeepDelimiters

bool Joutsen.ArgumentsParsing.ValueArgument< ValueType >.KeepDelimiters
getset

Determiens wether the delimiters are part of the resulting value or not.

◆ TypeConverter

SimpleTypeConverter<string, ValueType> Joutsen.ArgumentsParsing.ValueArgument< ValueType >.TypeConverter
getset

The converter used to create the parsed value from the input value.

◆ ValueEndDelimiter

String Joutsen.ArgumentsParsing.ValueArgument< ValueType >.ValueEndDelimiter
getset

The delimiter indicating the end of the combined value.

◆ ValuePartsConnector

String Joutsen.ArgumentsParsing.ValueArgument< ValueType >.ValuePartsConnector
getset

A term that is used to connect the values from the input list into a single parsed one.

◆ ValueStartDelimiter

String Joutsen.ArgumentsParsing.ValueArgument< ValueType >.ValueStartDelimiter
getset

The delimiter indicating the start of the combined value.