1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/api.cpp Mon Jun 06 20:27:42 2005 +0000
1.3 @@ -0,0 +1,38 @@
1.4 +#include "api.h"
1.5 +
1.6 +#include <qregexp.h>
1.7 +
1.8 +void API::parseCommand (const QString &s,QString &command,QString
1.9 +¶m)
1.10 +{
1.11 + param="";
1.12 + command="";
1.13 + QRegExp re;
1.14 + int pos;
1.15 +
1.16 + // Get command
1.17 + re.setPattern ("(.*)\\s");
1.18 + re.setMinimal (false);
1.19 + pos=re.search (s);
1.20 + if (pos>=0)
1.21 + command=re.cap(1);
1.22 +
1.23 + // Get parameters
1.24 + re.setPattern ("\\((.*)\\)");
1.25 + pos=re.search (s);
1.26 + if (pos>=0)
1.27 + param=re.cap (1);
1.28 +}
1.29 +
1.30 +void API::getString (const QString &s, QString &rs)
1.31 +{
1.32 + // return the string in s, this could be also stored in
1.33 + // a variable later
1.34 + QRegExp re("\"(.*)\"");
1.35 + int pos=re.search (s);
1.36 + if (pos>=0)
1.37 + rs=re.cap (1);
1.38 + else
1.39 + rs="";
1.40 +
1.41 +}
1.42 \ No newline at end of file