10 void API::initCommand()
18 void API::parseCommand (const QString &s)
25 re.setPattern ("(.*)\\s");
32 re.setPattern ("\\((.*)\\)");
37 paramList=QStringList::split(",",s);
41 QString API::command()
46 QStringList API::parameters()
51 QString API::errorDesc()
59 return (noErr) ?false:true;
62 void API::setError(const QString &e)
68 bool API::checkParamCount (const uint &expected)
70 if (paramList.count()!=expected)
72 errorString=QString("expected %1 parameters, but got %2").arg(expected).arg(paramList.count());
78 bool API::checkParamIsInt(const uint &index)
81 if (index > paramList.count())
83 errorString =QString("Parameter index %1 is outside of parameter list").arg(index);
87 paramList[index].toInt (&ok, 10);
90 errorString=QString("Parameter %1 is not an integer").arg(index);
97 int API::parInt (bool &ok,const uint &index)
99 if (checkParamIsInt (index))
101 return paramList[index].toInt (&ok, 10);
107 QString API::parString (bool &ok,const uint &index)
109 // return the string at index, this could be also stored in
112 QRegExp re("\"(.*)\"");
113 int pos=re.search (paramList[index]);