Joutsen.ArgumentsParsing  v0.2.1
Public Member Functions | Properties | List of all members
Joutsen.ArgumentsParsing.CollectionArgumentReader< CollectionType, ValueType > Class Template Reference

A reader that processes multiple input values into a list. More...

Public Member Functions

 CollectionArgumentReader (ValueCount valueCount)
 Creates a new instance of the reader for a certain number of elements allowed in the resulting collection using a default converter to convert list elements that implement the IConvertible interface. More...
 
 CollectionArgumentReader (ValueCount valueCount, SimpleTypeConverter< string, ValueType > converter)
 Creates a new instance of the reader for a certain number of elements allowed in the resulting collection using a custom converter to convert list elements to the target type. More...
 
 CollectionArgumentReader (ValueCount valueCount, SimpleTypeConverter< string, ValueType > converter, String startDelimiter, String endDelimiter, String partConnector, bool keepDelimiters)
 Creates a new instance using a custom converter for delimited values to produce the elements of the resulting collection. More...
 
virtual ArgumentReadResult< CollectionType > Read (ArgumentsIterator args, string name, int offset=0)
 Reads literals from the input to create a collection. More...
 
- Public Member Functions inherited from Joutsen.ArgumentsParsing.ArgumentReader< CollectionType >
ArgumentReadResult< ValueType > Read (ArgumentsIterator args, string name, int offset=0)
 Reads literals from the input. More...
 

Properties

ValueCount ValueCount [get]
 The operator or 'strategy' which determines how many values the resulting list should contain. More...
 
String ValueStartDelimiter [get, set]
 The delimiter that determines the start of a delimited value. More...
 
String ValueEndDelimiter [get, set]
 The delimiter that determines the end of a delimited value. More...
 
String ValuePartsConnector [get, set]
 The value that is added between the different literals read from the input when reading a delimited value. More...
 
bool KeepDelimiters [get, set]
 Determines if the resulting value should contain the delimiters or not. More...
 
Set< String > ArgumentPrefixes [get, set]
 
SimpleTypeConverter< string, ValueType > TypeConverter [get, set]
 The converter used to change the read literals into a different type. More...
 
- Properties inherited from Joutsen.ArgumentsParsing.ArgumentReader< CollectionType >
Set< String > ArgumentPrefixes [set]
 The prefixes of the arguments used by the parser. More...
 

Detailed Description

A reader that processes multiple input values into a list.

Remarks
The reader supports different 'strategies' to determine the number of values to read (see ValueCount for details). It also supports delimited values which can be combined to create a single element of the resulting list (see ValueArguemntReader for details)
Since
0.2.0
Type Constraints
CollectionType :Collection<ValueType> 
CollectionType :new() 

Constructor & Destructor Documentation

◆ CollectionArgumentReader() [1/3]

Creates a new instance of the reader for a certain number of elements allowed in the resulting collection using a default converter to convert list elements that implement the IConvertible interface.

◆ CollectionArgumentReader() [2/3]

Joutsen.ArgumentsParsing.CollectionArgumentReader< CollectionType, ValueType >.CollectionArgumentReader ( ValueCount  valueCount,
SimpleTypeConverter< string, ValueType >  converter 
)

Creates a new instance of the reader for a certain number of elements allowed in the resulting collection using a custom converter to convert list elements to the target type.

◆ CollectionArgumentReader() [3/3]

Joutsen.ArgumentsParsing.CollectionArgumentReader< CollectionType, ValueType >.CollectionArgumentReader ( ValueCount  valueCount,
SimpleTypeConverter< string, ValueType >  converter,
String  startDelimiter,
String  endDelimiter,
String  partConnector,
bool  keepDelimiters 
)

Creates a new instance using a custom converter for delimited values to produce the elements of the resulting collection.

Member Function Documentation

◆ Read()

virtual ArgumentReadResult<CollectionType> Joutsen.ArgumentsParsing.CollectionArgumentReader< CollectionType, ValueType >.Read ( ArgumentsIterator  args,
string  name,
int  offset = 0 
)
virtual

Reads literals from the input to create a collection.

Parameters
argsthe input list of literal values represented by an iterator
namethe name of the argument whose values to read as found in the input
offsetan optional additional offset of literals where to start reading from the input
Returns
the collection read from the input and the number of literals used in the process
Exceptions
ValueCountExceptionif the number of elements provided in the input does not conform to the number determined by the 'strategy'.
ArgumentParseExceptionif a value cannot be converted to the ValueType or if a delimited value is not 'closed' correctly

Property Documentation

◆ ArgumentPrefixes

Set<String> Joutsen.ArgumentsParsing.CollectionArgumentReader< CollectionType, ValueType >.ArgumentPrefixes
getset

◆ KeepDelimiters

bool Joutsen.ArgumentsParsing.CollectionArgumentReader< CollectionType, ValueType >.KeepDelimiters
getset

Determines if the resulting value should contain the delimiters or not.

◆ TypeConverter

SimpleTypeConverter<string, ValueType> Joutsen.ArgumentsParsing.CollectionArgumentReader< CollectionType, ValueType >.TypeConverter
getset

The converter used to change the read literals into a different type.

◆ ValueCount

The operator or 'strategy' which determines how many values the resulting list should contain.

◆ ValueEndDelimiter

String Joutsen.ArgumentsParsing.CollectionArgumentReader< CollectionType, ValueType >.ValueEndDelimiter
getset

The delimiter that determines the end of a delimited value.

◆ ValuePartsConnector

String Joutsen.ArgumentsParsing.CollectionArgumentReader< CollectionType, ValueType >.ValuePartsConnector
getset

The value that is added between the different literals read from the input when reading a delimited value.

◆ ValueStartDelimiter

String Joutsen.ArgumentsParsing.CollectionArgumentReader< CollectionType, ValueType >.ValueStartDelimiter
getset

The delimiter that determines the start of a delimited value.