Version 1.9.0
authorinsilmaril
Wed, 04 Jul 2007 11:05:16 +0000
changeset 538be2299221801
parent 537 16d3598f611f
child 539 7dde64ce0577
Version 1.9.0
parser.cpp
     1.1 --- a/parser.cpp	Wed Jul 04 11:05:15 2007 +0000
     1.2 +++ b/parser.cpp	Wed Jul 04 11:05:16 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;