|
Joutsen.ArgumentsParsing v0.3.0+1-ga4c84ed
|
A configurable parser that can be used to parse a list of input strings and pass the values to a target objects properties. More...
Public Member Functions | |
| ArgumentsParser () | |
| Creates a new instance of the parser without a program name. More... | |
| ArgumentsParser (DisplayArgument helpArgument) | |
| Creates a new instance of the parser with a custom help argument. More... | |
| ArgumentsParser (String programName) | |
| Creates a new instance of the parser with a program name. More... | |
| ArgumentsParser (DisplayArgument helpArgument, String programName) | |
| Creates a new instance of the parser with a program name. More... | |
| ArgumentsParser (ArgumentsListParserFactory factory) | |
| Creates a new instance of the parser with a custom factory for list parsers. More... | |
| ArgumentsParser (ArgumentsListParserFactory factory, DisplayArgument helpArgument) | |
| Creates a new instance of the parser with a custom factory for list parsers and a custom help argument. More... | |
| ArgumentsParser (ArgumentsListParserFactory factory, String programName) | |
| Creates a new instance of the parser with a custom factory for list parsers and a program name. More... | |
| ArgumentsParser (ArgumentsListParserFactory factory, DisplayArgument helpArgument, String programName) | |
| Creates a new instance of the parser with a custom factory for list parsers, a custom help argument and a program name. More... | |
| void | AddArgument (ParserArgument argument) |
| Adds a new argument to the parser. More... | |
| void | AddArgument (string name, ParserArgument argument) |
| Adds a new argument that is identified by its name to the parser. More... | |
| void | AddArgument (string name, string alternative, ParserArgument argument) |
| Adds a new argument that is identified by its name or an alternative name to the parser. More... | |
| void | AddArgument (DisplayArgument argument) |
| Adds a new argument that will display a message when invoked during parsing. More... | |
| void | AddArgument< FlagValueType > (FlagArgument< FlagValueType > argument) |
| Adds a new argument that represents a flag. More... | |
| void | AddArgumentsGroup (ArgumentsGroup group) |
| Adds a new argument group to the parser. More... | |
| MutuallyExclusiveArgumentsGroup | AddMutuallyExclusiveGroup (String name, String prefix="-", bool isRequired=false) |
| A short hand method for adding a mutually exclusive arguments group. More... | |
| SubParser | AddSubParser (String name) |
| Adds a new subparser to the parser. More... | |
| SubParser | AddSubParser (String name, String help) |
| Adds a new subparser to the parser. More... | |
| SubParser | AddSubParser (String name, String destination, String help) |
| Adds a new subparser that stores its result in a property. More... | |
| SubParser< ResultType > | AddSubParser< ResultType > (String name) |
| Adds a new subparser to the parser that will create a typed result. More... | |
| SubParser< ResultType > | AddSubParser< ResultType > (String name, String help) |
| Adds a new subparser to the parser that will create a typed result. More... | |
| SubParser< ResultType > | AddSubParser< TargetType, ResultType > (String name, Expression< Func< TargetType, ResultType > > destination, String help) |
| Adds a new subparser to the parser that will create a typed result. More... | |
| SubParser< ResultType > | AddSubParser< ResultType > (String name, String destination, String help) |
| Adds a new subparser to the parser that will create a typed result. More... | |
| SubParser< ResultType > | AddSubParser< ResultType > (String name, Func< ResultType > resultFactory) |
| Adds a new subparser to the parser that will create a typed result. More... | |
| SubParser< ResultType > | AddSubParser< ResultType > (String name, Func< ResultType > resultFactory, String help) |
| Adds a new subparser to the parser that will create a typed result. More... | |
| SubParser< ResultType > | AddSubParser< TargetType, ResultType > (String name, Expression< Func< TargetType, ResultType > > destination, Func< ResultType > resultFactory, String help) |
| Adds a new subparser to the parser that will create a typed result. More... | |
| SubParser< ResultType > | AddSubParser< ResultType > (String name, String destination, Func< ResultType > resultFactory, String help) |
| Adds a new subparser to the parser that will create a typed result. More... | |
| virtual ParseResult | Parse (string[] args, object target=null) |
| Parses an array of input strings and raises an exception if the list does not match the specified arguments. More... | |
| virtual ParseResult | Parse (Listable< string > args, object target=null) |
| Parses a list of input strings and raises an exception if the list does not match the specified arguments. More... | |
| virtual ParseResult | Parse (ArgumentsIterator args, object target=null) |
| Parses a list of input strings and raises an exception if the list does not match the specified arguments. More... | |
| virtual ParseResult | ParseKnown (string[] args, object target=null) |
| Parses all known values in an array of input strings. More... | |
| virtual ParseResult | ParseKnown (Listable< string > args, object target=null) |
| Parses all known values in a list of input strings. More... | |
| virtual ParseResult | ParseKnown (ArgumentsIterator args, object target=null) |
| Parses all known values in a list of input strings. More... | |
| virtual ParseResult< TResult > | Parse< TResult > (string[] args) |
| Parses an array of input strings and raises an exception if the list does not match the specified arguments. More... | |
| virtual ParseResult< TResult > | Parse< TResult > (Listable< string > args) |
| Parses an array of input strings and raises an exception if the list does not match the specified arguments. More... | |
| virtual ParseResult< TResult > | Parse< TResult > (ArgumentsIterator args) |
| Parses an array of input strings and raises an exception if the list does not match the specified arguments. More... | |
| virtual ParseResult< TResult > | ParseKnown< TResult > (string[] args) |
| Parses all known values in an array of input strings. More... | |
| virtual ParseResult< TResult > | ParseKnown< TResult > (Listable< string > args) |
| Parses all known values in a list of input strings. More... | |
| virtual ParseResult< TResult > | ParseKnown< TResult > (ArgumentsIterator args) |
| Parses all known values in a list of input strings. More... | |
| virtual string | Usage () |
| Creates a string briefly describing the expected parser input. More... | |
| virtual string | Description () |
| Creates a description of all the arguments added to the parser. More... | |
Protected Member Functions | |
| void | AddSubParser (DefaultSubParser parser) |
| Adds an existing SubParser to the parser. More... | |
| ArgumentsListParser | GetParserImpl (ArgumentsParserType parserType) |
| Creates a list parser depending on the parse mode. More... | |
Protected Attributes | |
| ArgumentsGroupCollection | groups |
| The groups of parser arguments for this parser. More... | |
| ArgumentsListParserFactory | factory |
| The factory creating the actual list parsers depending on the parse mode. More... | |
| String | programName |
| When used as a parser for command line arguments this can contain the name of the program. More... | |
A configurable parser that can be used to parse a list of input strings and pass the values to a target objects properties.
| Joutsen.ArgumentsParsing.ArgumentsParser.ArgumentsParser | ( | ) |
Creates a new instance of the parser without a program name.
| Joutsen.ArgumentsParsing.ArgumentsParser.ArgumentsParser | ( | DisplayArgument | helpArgument | ) |
Creates a new instance of the parser with a custom help argument.
| helpArgument | the argument that should be used to show help text and usage |
| Joutsen.ArgumentsParsing.ArgumentsParser.ArgumentsParser | ( | String | programName | ) |
Creates a new instance of the parser with a program name.
| programName | a name given to the parser that will be printed in the description and usage. This is usually used when parsing command line arguments. |
| Joutsen.ArgumentsParsing.ArgumentsParser.ArgumentsParser | ( | DisplayArgument | helpArgument, |
| String | programName | ||
| ) |
Creates a new instance of the parser with a program name.
| helpArgument | the argument that should be used to show help text and usage |
| programName | a name given to the parser that will be printed in the description and usage. This is usually used when parsing command line arguments. |
| Joutsen.ArgumentsParsing.ArgumentsParser.ArgumentsParser | ( | ArgumentsListParserFactory | factory | ) |
Creates a new instance of the parser with a custom factory for list parsers.
| factory | the factory for the list parser |
| Joutsen.ArgumentsParsing.ArgumentsParser.ArgumentsParser | ( | ArgumentsListParserFactory | factory, |
| DisplayArgument | helpArgument | ||
| ) |
Creates a new instance of the parser with a custom factory for list parsers and a custom help argument.
| factory | the factory for the list parser |
| helpArgument | the argument that should be used to show help text and usage |
| Joutsen.ArgumentsParsing.ArgumentsParser.ArgumentsParser | ( | ArgumentsListParserFactory | factory, |
| String | programName | ||
| ) |
Creates a new instance of the parser with a custom factory for list parsers and a program name.
| factory | the factory for the list parser |
| programName | a name given to the parser that will be printed in the description and usage. This is usually used when parsing command line arguments. |
| Joutsen.ArgumentsParsing.ArgumentsParser.ArgumentsParser | ( | ArgumentsListParserFactory | factory, |
| DisplayArgument | helpArgument, | ||
| String | programName | ||
| ) |
Creates a new instance of the parser with a custom factory for list parsers, a custom help argument and a program name.
| factory | the factory for the list parser |
| programName | a name given to the parser that will be printed in the description and usage. This is usually used when parsing command line arguments. |
| helpArgument | the argument that should be used to show help text and usage |
| void Joutsen.ArgumentsParsing.ArgumentsParser.AddArgument | ( | DisplayArgument | argument | ) |
Adds a new argument that will display a message when invoked during parsing.
| void Joutsen.ArgumentsParsing.ArgumentsParser.AddArgument | ( | ParserArgument | argument | ) |
Adds a new argument to the parser.
| void Joutsen.ArgumentsParsing.ArgumentsParser.AddArgument | ( | string | name, |
| ParserArgument | argument | ||
| ) |
Adds a new argument that is identified by its name to the parser.
| name | the name that identifies this argument in the input list |
| argument | the argument |
| void Joutsen.ArgumentsParsing.ArgumentsParser.AddArgument | ( | string | name, |
| string | alternative, | ||
| ParserArgument | argument | ||
| ) |
Adds a new argument that is identified by its name or an alternative name to the parser.
| name | the name that identifies this argument in the input list |
| alternative | the alternative name that identifies this argument in the input list |
| argument | the argument |
| void Joutsen.ArgumentsParsing.ArgumentsParser.AddArgument< FlagValueType > | ( | FlagArgument< FlagValueType > | argument | ) |
Adds a new argument that represents a flag.
| void Joutsen.ArgumentsParsing.ArgumentsParser.AddArgumentsGroup | ( | ArgumentsGroup | group | ) |
Adds a new argument group to the parser.
| MutuallyExclusiveArgumentsGroup Joutsen.ArgumentsParsing.ArgumentsParser.AddMutuallyExclusiveGroup | ( | String | name, |
| String | prefix = "-", |
||
| bool | isRequired = false |
||
| ) |
A short hand method for adding a mutually exclusive arguments group.
| name | the name of the new group |
| prefix | the prefix of the named arguments in the group |
| isRequired | determines if one of the arguments in the group needs to be present when parsing or if the group's arguments are optional. |
|
protected |
Adds an existing SubParser to the parser.
| SubParser Joutsen.ArgumentsParsing.ArgumentsParser.AddSubParser | ( | String | name | ) |
Adds a new subparser to the parser.
| name | the name identifying the command this parser represents in the input string |
| SubParser Joutsen.ArgumentsParsing.ArgumentsParser.AddSubParser | ( | String | name, |
| String | destination, | ||
| String | help | ||
| ) |
Adds a new subparser that stores its result in a property.
| name | the name identifying the command this parser represents in the input string |
| destination | the name of the key or property the parsed values will be available at after parsing |
| help | an additional help text that describes the command of the subparser |
| SubParser Joutsen.ArgumentsParsing.ArgumentsParser.AddSubParser | ( | String | name, |
| String | help | ||
| ) |
Adds a new subparser to the parser.
| name | the name identifying the command this parser represents in the input string |
| help | an additional help text that describes the command of the subparser |
| SubParser< ResultType > Joutsen.ArgumentsParsing.ArgumentsParser.AddSubParser< ResultType > | ( | String | name | ) |
Adds a new subparser to the parser that will create a typed result.
| ResultType | the type of the instance that will contain all values parsed by the subparser |
| name | the name identifying the command this parser represents in the input string |
| ResultType | : | new() |
| SubParser< ResultType > Joutsen.ArgumentsParsing.ArgumentsParser.AddSubParser< ResultType > | ( | String | name, |
| Func< ResultType > | resultFactory | ||
| ) |
Adds a new subparser to the parser that will create a typed result.
| ResultType | the type of the instance that will contain all values parsed by the subparser |
| name | the name identifying the command this parser represents in the input string |
| resultFactory | a factory method to create an instance of ResultType |
| SubParser< ResultType > Joutsen.ArgumentsParsing.ArgumentsParser.AddSubParser< ResultType > | ( | String | name, |
| Func< ResultType > | resultFactory, | ||
| String | help | ||
| ) |
Adds a new subparser to the parser that will create a typed result.
| ResultType | the type of the instance that will contain all values parsed by the subparser |
| name | the name identifying the command this parser represents in the input string |
| resultFactory | a factory method to create an instance of ResultType |
| help | an additional help text that describes the command of the subparser |
| SubParser< ResultType > Joutsen.ArgumentsParsing.ArgumentsParser.AddSubParser< ResultType > | ( | String | name, |
| String | destination, | ||
| Func< ResultType > | resultFactory, | ||
| String | help | ||
| ) |
Adds a new subparser to the parser that will create a typed result.
| ResultType | the type of the instance that will contain all values parsed by the subparser |
| name | the name identifying the command this parser represents in the input string |
| destination | the name of the key or property the parsed values will be available at after parsing |
| resultFactory | a factory method to create an instance of ResultType |
| help | an additional help text that describes the command of the subparser |
| SubParser< ResultType > Joutsen.ArgumentsParsing.ArgumentsParser.AddSubParser< ResultType > | ( | String | name, |
| String | destination, | ||
| String | help | ||
| ) |
Adds a new subparser to the parser that will create a typed result.
| ResultType | the type of the instance that will contain all values parsed by the subparser |
| name | the name identifying the command this parser represents in the input string |
| destination | the name of the key or property the parsed values will be available at after parsing |
| help | an additional help text that describes the command of the subparser |
| ResultType | : | new() |
| SubParser< ResultType > Joutsen.ArgumentsParsing.ArgumentsParser.AddSubParser< ResultType > | ( | String | name, |
| String | help | ||
| ) |
Adds a new subparser to the parser that will create a typed result.
| ResultType | the type of the instance that will contain all values parsed by the subparser |
| name | the name identifying the command this parser represents in the input string |
| help | an additional help text that describes the command of the subparser |
| ResultType | : | new() |
| SubParser< ResultType > Joutsen.ArgumentsParsing.ArgumentsParser.AddSubParser< TargetType, ResultType > | ( | String | name, |
| Expression< Func< TargetType, ResultType > > | destination, | ||
| Func< ResultType > | resultFactory, | ||
| String | help | ||
| ) |
Adds a new subparser to the parser that will create a typed result.
| ResultType | the type of the instance that will contain all values parsed by the subparser |
| name | the name identifying the command this parser represents in the input string |
| destination | an expression that determines the property the parsed values will be available at after parsing |
| resultFactory | a factory method to create an instance of ResultType |
| help | an additional help text that describes the command of the subparser |
| SubParser< ResultType > Joutsen.ArgumentsParsing.ArgumentsParser.AddSubParser< TargetType, ResultType > | ( | String | name, |
| Expression< Func< TargetType, ResultType > > | destination, | ||
| String | help | ||
| ) |
Adds a new subparser to the parser that will create a typed result.
| ResultType | the type of the instance that will contain all values parsed by the subparser |
| name | the name identifying the command this parser represents in the input string |
| destination | an expression that determines the property the parsed values will be available at after parsing |
| help | an additional help text that describes the command of the subparser |
| ResultType | : | new() |
|
virtual |
Creates a description of all the arguments added to the parser.
|
protected |
Creates a list parser depending on the parse mode.
|
virtual |
Parses a list of input strings and raises an exception if the list does not match the specified arguments.
@params args the iterator of the input list @params target the object which the parsed values should be added to, if null a generic target will be created
|
virtual |
Parses a list of input strings and raises an exception if the list does not match the specified arguments.
@params args the input list to parse @params target the object which the parsed values should be added to, if null a generic target will be created
|
virtual |
Parses an array of input strings and raises an exception if the list does not match the specified arguments.
@params args the input list to parse @params target the object which the parsed values should be added to, if null a generic target will be created
|
virtual |
Parses an array of input strings and raises an exception if the list does not match the specified arguments.
| TResult | the type of object to create and store the parsed values in @params args the iterator of the input list to parse |
| TResult | : | new() |
|
virtual |
Parses an array of input strings and raises an exception if the list does not match the specified arguments.
| TResult | the type of object to create and store the parsed values in @params args the input list to parse |
| TResult | : | new() |
|
virtual |
Parses an array of input strings and raises an exception if the list does not match the specified arguments.
| TResult | the type of object to create and store the parsed values in @params args the input list to parse |
| TResult | : | new() |
|
virtual |
Parses all known values in a list of input strings.
All input strings that cannot be parsed are ignored. @params args the iterator of the input list to parse @params target the object which the parsed values should be added to, if null a generic target will be created
|
virtual |
Parses all known values in a list of input strings.
All input strings that cannot be parsed are ignored. @params args the input list to parse @params target the object which the parsed values should be added to, if null a generic target will be created
|
virtual |
Parses all known values in an array of input strings.
All input strings that cannot be parsed are ignored. @params args the input list to parse @params target the object which the parsed values should be added to, if null a generic target will be created
|
virtual |
Parses all known values in a list of input strings.
All input strings that cannot be parsed are ignored.
| TResult | the type of object to create and store the parsed values in @params args the iterator of the input list to parse |
| TResult | : | new() |
|
virtual |
Parses all known values in a list of input strings.
All input strings that cannot be parsed are ignored.
| TResult | the type of object to create and store the parsed values in @params args the input list to parse |
| TResult | : | new() |
|
virtual |
Parses all known values in an array of input strings.
All input strings that cannot be parsed are ignored.
| TResult | the type of object to create and store the parsed values in @params args the input list to parse |
| TResult | : | new() |
|
virtual |
Creates a string briefly describing the expected parser input.
|
protected |
The factory creating the actual list parsers depending on the parse mode.
|
protected |
The groups of parser arguments for this parser.
|
protected |
When used as a parser for command line arguments this can contain the name of the program.