static_assert(std::is_same<PositionalParameter<typenamePar::ConverterType,Par::optional>,Par>::value,"ParsePositionalParameters argument(s) must be PositionalParameter");
@ -141,10 +141,10 @@ class ParsePositionalParameters: public ParseParameters
}
// List is ended
if(i>=ol->Size())
if(i>=max)
{
// Parameter is optional, skip it
if(Par::optional)Parse(i,ol,args...);
if(Par::optional)Parse(i,max,ol,args...);
// Parameter is required, this is an error
elseerr="Parameter "+param.Name()+" is required, but can't be setted because list is ended";
}
@ -153,22 +153,24 @@ class ParsePositionalParameters: public ParseParameters
{
boolres=param.Init(ol->At(i),err);
// All Ok, continue to next element in list
if(res)Parse(i+1,ol,args...);
if(res)Parse(i+1,max,ol,args...);
else
{
// All Ok, optional parameter may be absent, try to initialise next parameter by same list element
if(Par::optional)Parse(i,ol,args...);
if(Par::optional)Parse(i,max,ol,args...);
// Error, required parameter not initialised
elseerr="Can't initialise parameter "+param.Name()+" from list element number "+ToString(i)+": "+err;
}
}
}
// Bottom of recursion
voidParse(ObjectList::IndexTypei,constObjectList*ol){if(i<ol->Size())err="There are excess elements in list";}
voidParse(ObjectList::IndexTypei,ObjectList::IndexTypemax,constObjectList*ol){if(i<max)err="There are excess elements in list";}