api.cpp
changeset 191 2658342e3310
parent 132 fd7f08a85971
child 364 7b74fa3772bf
     1.1 --- a/api.cpp	Sat Jul 23 10:26:29 2005 +0000
     1.2 +++ b/api.cpp	Tue Jan 24 15:09:48 2006 +0000
     1.3 @@ -29,12 +29,39 @@
     1.4  		com=re.cap(1);
     1.5  
     1.6  	// Get parameters
     1.7 +	paramList.clear();
     1.8  	re.setPattern ("\\((.*)\\)");
     1.9  	pos=re.search (s);
    1.10  	if (pos>=0)
    1.11  	{
    1.12  		QString s=re.cap(1);
    1.13 -		paramList=QStringList::split(",",s);
    1.14 +		QString a;
    1.15 +		bool inquote=false;
    1.16 +		pos=0;
    1.17 +		if (!s.isEmpty())
    1.18 +		{
    1.19 +			while (pos<s.length())
    1.20 +			{
    1.21 +				if (s.at(pos)=='\"') 
    1.22 +				{
    1.23 +					if (inquote)
    1.24 +						inquote=false;
    1.25 +					else	
    1.26 +						inquote=true;
    1.27 +				}
    1.28 +
    1.29 +				if (s.at(pos)==',' && !inquote)
    1.30 +				{
    1.31 +					a=s.left(pos);
    1.32 +					paramList.append(a);
    1.33 +					s=s.right(s.length()-pos-1);
    1.34 +					pos=0;
    1.35 +				} else
    1.36 +					pos++;
    1.37 +				
    1.38 +			}
    1.39 +			paramList.append (s);
    1.40 +		}	
    1.41  	}	
    1.42  }
    1.43  
    1.44 @@ -70,9 +97,10 @@
    1.45  	if (paramList.count()!=expected)
    1.46  	{
    1.47  		errorString=QString("expected %1 parameters, but got %2").arg(expected).arg(paramList.count());
    1.48 -		return false;
    1.49 -	} 
    1.50 -	return true;
    1.51 +		noErr=false;
    1.52 +	} else 
    1.53 +		noErr=true;
    1.54 +	return noErr;	
    1.55  }
    1.56  
    1.57  bool API::checkParamIsInt(const uint &index)
    1.58 @@ -81,17 +109,18 @@
    1.59  	if (index > paramList.count())
    1.60  	{
    1.61  		errorString =QString("Parameter index %1 is outside of parameter list").arg(index);
    1.62 -		return false;
    1.63 +		noErr=false;
    1.64  	} else
    1.65  	{
    1.66  		paramList[index].toInt (&ok, 10);
    1.67  		if (!ok)
    1.68  		{
    1.69  			errorString=QString("Parameter %1 is not an integer").arg(index);
    1.70 -			return false;
    1.71 -		}
    1.72 -		return true;
    1.73 +			noErr=false;
    1.74 +		} else
    1.75 +			noErr=true;
    1.76  	}	
    1.77 +	return noErr;
    1.78  }
    1.79  
    1.80  int API::parInt (bool &ok,const uint &index)