Added read(string,float,float,float,float) method
This commit is contained in:
parent
845adb8745
commit
d82b3d0105
@ -105,6 +105,11 @@ class SG_EXPORT ArgumentParser
|
||||
* remove the four entries from the list and return true, otherwise return false.*/
|
||||
bool read(const std::string& str,float& value1,float& value2,float& value3);
|
||||
|
||||
/** search for an occurance of a string in the argument list followed by three numeric values,
|
||||
* on sucess set the values with the second & third & fourth parameters and then
|
||||
* remove the four entries from the list and return true, otherwise return false.*/
|
||||
bool read(const std::string& str,float& value1,float& value2,float& value3,float& value4);
|
||||
|
||||
|
||||
enum ErrorSeverity
|
||||
{
|
||||
|
@ -264,6 +264,23 @@ bool ArgumentParser::read(const std::string& str,float& value1,float& value2,flo
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ArgumentParser::read(const std::string& str,float& value1,float& value2,float& value3,float& value4)
|
||||
{
|
||||
int pos=find(str);
|
||||
if (pos<=0) return false;
|
||||
if (!isNumber(pos+1) || !isNumber(pos+2) || !isNumber(pos+3))
|
||||
{
|
||||
reportError("argument to `"+str+"` is missing");
|
||||
return false;
|
||||
}
|
||||
value1 = atof(_argv[pos+1]);
|
||||
value2 = atof(_argv[pos+2]);
|
||||
value3 = atof(_argv[pos+3]);
|
||||
value4 = atof(_argv[pos+4]);
|
||||
remove(pos,5);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ArgumentParser::errors(ErrorSeverity severity) const
|
||||
{
|
||||
for(ErrorMessageMap::const_iterator itr=_errorMessageMap.begin();
|
||||
|
Loading…
Reference in New Issue
Block a user