Home » Developing U++ » UppHub » U++ Command Line Argument Processor Package
Re: U++ Command Line Argument Processor Package [message #47525 is a reply to message #19157] |
Wed, 25 January 2017 19:02  |
mdelfede
Messages: 1310 Registered: September 2007
|
Ultimate Contributor |
|
|
Hi, I guess that a bugfix is needed, as it is if ONE option matches the whole stuff do, even if some are missing.
I replaced ArgProcessor::MatchesOptions with the following :
bool ArgProcessor::MatchesOptions(Ptr<ArgSet> arg_set)
{
// check for required options
for(int i=0; i<arg_set->_options.GetCount(); i++)
{
if(arg_set->_options[i]->IsRequired())
{
bool found = false;
for(int j=0; j<_arg_list.GetCount(); j++)
{
if(arg_set->_options[i] == _arg_list[j])
{
if(arg_set->_options[i]->IsSet())
{
found = true;
break;
}
}
}
if(!found)
return false;
}
}
// check for spurious options
for(int j=0; j<_arg_list.GetCount(); j++)
{
bool found = false;
for(int i=0; i<arg_set->_options.GetCount(); i++)
{
if(arg_set->_options[i] == _arg_list[j])
{
found = true;
break;
}
}
if(!found)
return false;
}
return true;
}
No time to check if it solves all problems, but in my case it's ok.
Now it's checking that ALL required options are there and that NO un-listed option is there.
Ciao
Massimo
|
|
|
Goto Forum:
Current Time: Fri Aug 08 22:12:03 CEST 2025
Total time taken to generate the page: 0.03390 seconds
|