insilmaril@105: #include "api.h" insilmaril@105: insilmaril@105: #include insilmaril@105: insilmaril@105: void API::parseCommand (const QString &s,QString &command,QString insilmaril@105: ¶m) insilmaril@105: { insilmaril@105: param=""; insilmaril@105: command=""; insilmaril@105: QRegExp re; insilmaril@105: int pos; insilmaril@105: insilmaril@105: // Get command insilmaril@105: re.setPattern ("(.*)\\s"); insilmaril@106: re.setMinimal (true); insilmaril@105: pos=re.search (s); insilmaril@105: if (pos>=0) insilmaril@105: command=re.cap(1); insilmaril@105: insilmaril@105: // Get parameters insilmaril@105: re.setPattern ("\\((.*)\\)"); insilmaril@105: pos=re.search (s); insilmaril@105: if (pos>=0) insilmaril@105: param=re.cap (1); insilmaril@105: } insilmaril@105: insilmaril@105: void API::getString (const QString &s, QString &rs) insilmaril@105: { insilmaril@105: // return the string in s, this could be also stored in insilmaril@105: // a variable later insilmaril@105: QRegExp re("\"(.*)\""); insilmaril@105: int pos=re.search (s); insilmaril@105: if (pos>=0) insilmaril@105: rs=re.cap (1); insilmaril@105: else insilmaril@105: rs=""; insilmaril@105: insilmaril@105: }