|
Joutsen.ArgumentsParsing
v0.2.1
|
A literal parser that processes input literals for arguments that change properties on a target object. More...
Public Member Functions | |
| TargetPropertyParser (ArgumentReader< ValueType > reader, String name, bool isRequired, ValueType defaultValue, string propertyName, bool isFlag=false) | |
| Creates a new instance of the parser. More... | |
| virtual ParseResult | Parse (ArgumentsIterator args, object target, string name=null) |
| Parses the relevant argument in the list and modifies the target object with it. More... | |
| object | SetDefaultValue (object target, string name=null) |
| Sets the default value of the argument to a target object. More... | |
| override string | ToString () |
| void | Reset () |
| Clears the parsers state if any in order to prepare it for a new run. More... | |
Properties | |
| ArgumentReader< ValueType > | Reader [get] |
| The instance that reads the argument literals from the input. More... | |
| bool | IsArgumentRequired [get] |
| Determines if the argument is mandatory or optional. More... | |
| String | ArgumentName [get] |
| The name of the argument that is processed by the parser. More... | |
| bool | IsFlag [get] |
| ArgumentsListParser | ParentParser [set] |
Properties inherited from Joutsen.ArgumentsParsing.ArgumentLiteralParser | |
| ArgumentsListParser | ParentParser [set] |
| The list parser this literal parser belongs to. More... | |
| bool | IsFlag [get] |
| Determines if this argument is nearly a flag (name only) or uses values. More... | |
A literal parser that processes input literals for arguments that change properties on a target object.
| Joutsen.ArgumentsParsing.TargetPropertyParser< ValueType >.TargetPropertyParser | ( | ArgumentReader< ValueType > | reader, |
| String | name, | ||
| bool | isRequired, | ||
| ValueType | defaultValue, | ||
| string | propertyName, | ||
| bool | isFlag = false |
||
| ) |
Creates a new instance of the parser.
| reader | the reader that extracts the argument literals from the input |
| name | the name of the argument that is processed by the parser |
| isRequired | true, if the argument is mandatory and needs to be present in the input, false otherwise |
| defaultValue | the value that is used to change the property in the target object if the argument is optional and was not found in the input |
| propertyName | the name of the property that the parser modifies |
| isFlag | determines if the parser is processing a flag or an argument which can have additional values |
|
virtual |
Parses the relevant argument in the list and modifies the target object with it.
| args | the list of input strings that need to be parsed |
| target | the receiver of the parsed values |
| name | an optional name of the argument that is being parsed. This is usually only used for arguments that are identified by their name. |
Implements Joutsen.ArgumentsParsing.ArgumentLiteralParser.
| void Joutsen.ArgumentsParsing.TargetPropertyParser< ValueType >.Reset | ( | ) |
Clears the parsers state if any in order to prepare it for a new run.
Implements Joutsen.ArgumentsParsing.ArgumentLiteralParser.
| object Joutsen.ArgumentsParsing.TargetPropertyParser< ValueType >.SetDefaultValue | ( | object | target, |
| string | name = null |
||
| ) |
Sets the default value of the argument to a target object.
| target | the receiver of the default value |
| name | an optional name of this argument. This is usually only used for arguments that are identified by their name. |
Implements Joutsen.ArgumentsParsing.ArgumentLiteralParser.
| override string Joutsen.ArgumentsParsing.TargetPropertyParser< ValueType >.ToString | ( | ) |
|
get |
The name of the argument that is processed by the parser.
|
get |
Determines if the argument is mandatory or optional.
|
get |
|
set |
|
get |
The instance that reads the argument literals from the input.
1.8.13