author | insilmaril |
Fri Jul 08 07:24:43 2005 +0000 (2005-07-08) | |
changeset 120 | 949591651fc7 |
parent 105 | 67a91e28b30f |
child 132 | fd7f08a85971 |
permissions | -rw-r--r-- |
1 #include "api.h"
3 #include <qregexp.h>
5 void API::parseCommand (const QString &s,QString &command,QString
6 ¶m)
7 {
8 param="";
9 command="";
10 QRegExp re;
11 int pos;
13 // Get command
14 re.setPattern ("(.*)\\s");
15 re.setMinimal (true);
16 pos=re.search (s);
17 if (pos>=0)
18 command=re.cap(1);
20 // Get parameters
21 re.setPattern ("\\((.*)\\)");
22 pos=re.search (s);
23 if (pos>=0)
24 param=re.cap (1);
25 }
27 void API::getString (const QString &s, QString &rs)
28 {
29 // return the string in s, this could be also stored in
30 // a variable later
31 QRegExp re("\"(.*)\"");
32 int pos=re.search (s);
33 if (pos>=0)
34 rs=re.cap (1);
35 else
36 rs="";
38 }