1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
|
#ifndef PARSER_H
#define PARSER_H
#include <QColor>
#include <QStringList>
enum ErrorLevel {NoError,Warning,Aborted};
class Parser
{
public:
Parser();
void parseAtom (QString input);
QString getAtom();
QString getCommand();
QStringList getParameters();
int parCount();
QString errorMessage();
QString errorDescription();
ErrorLevel errorLevel();
void setError (ErrorLevel level,const QString &description);
void resetError();
bool checkParCount (QList <int> plist);
bool checkParCount (const int &index);
bool checkParIsInt (const int &index);
bool checkParIsDouble (const int &index);
int parInt (bool &,const uint &index);
QString parString(bool &ok,const int &index);
bool parBool (bool &ok, const int &index);
QColor parColor (bool &ok, const int &index);
double parDouble (bool &ok, const int &index);
void setScript (const QString &);
QString getScript();
void runScript();
bool next();
private:
void initParser();
void initAtom();
QString input;
QString atom;
QString com;
QStringList paramList;
int current;
QString script;
QString errMessage;
QString errDescription;
ErrorLevel errLevel;
};
#endif
|