parser.cpp
changeset 579 1c487b3dd40f
parent 534 32b71ba642aa
child 659 b582bba9e312
     1.1 --- a/parser.cpp	Fri Jun 29 15:12:04 2007 +0000
     1.2 +++ b/parser.cpp	Fri Aug 03 14:13:35 2007 +0000
     1.3 @@ -191,6 +191,27 @@
     1.4  	return true;
     1.5  }
     1.6  
     1.7 +bool Parser::checkParIsDouble(const int &index)
     1.8 +{
     1.9 +	bool ok;
    1.10 +	if (index > paramList.count())
    1.11 +	{
    1.12 +		errLevel=Aborted;
    1.13 +		errDescription=QString("Parameter index %1 is outside of parameter list").arg(index);
    1.14 +		return false;
    1.15 +	} else
    1.16 +	{
    1.17 +		paramList[index].toDouble (&ok);
    1.18 +		if (!ok)
    1.19 +		{
    1.20 +			errLevel=Aborted;
    1.21 +			errDescription=QString("Parameter %1 is not double").arg(index);
    1.22 +			return false;
    1.23 +		} 
    1.24 +	}	
    1.25 +	return true;
    1.26 +}
    1.27 +
    1.28  int Parser::parInt (bool &ok,const uint &index)
    1.29  {
    1.30  	if (checkParIsInt (index))
    1.31 @@ -246,6 +267,14 @@
    1.32  	return c;
    1.33  }
    1.34  
    1.35 +double Parser::parDouble (bool &ok,const int &index)
    1.36 +{
    1.37 +	if (checkParIsDouble (index))
    1.38 +		return paramList[index].toDouble (&ok);
    1.39 +	ok=false;
    1.40 +	return 0;
    1.41 +}
    1.42 +
    1.43  void Parser::setScript(const QString &s)
    1.44  {
    1.45  	script=s;