Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
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 Go to previous message
mdelfede is currently offline  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
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: SysInfo - some bug fixes
Next Topic: Google Mock - now available at bazaar
Goto Forum:
  


Current Time: Fri Aug 08 22:12:03 CEST 2025

Total time taken to generate the page: 0.03390 seconds