parser.h
author insilmaril
Wed Mar 21 11:51:38 2007 +0000 (2007-03-21)
changeset 435 bd71dfb2292c
child 445 0796c5592f00
permissions -rw-r--r--
Slightly improved scripting abilities
insilmaril@432
     1
#ifndef PARSER_H
insilmaril@432
     2
#define PARSER_H
insilmaril@432
     3
insilmaril@432
     4
#include <QColor>
insilmaril@432
     5
#include <QStringList>
insilmaril@432
     6
insilmaril@432
     7
enum ErrorLevel {NoError,Warning,Aborted};
insilmaril@432
     8
insilmaril@432
     9
class Parser
insilmaril@432
    10
{
insilmaril@432
    11
public:
insilmaril@432
    12
	Parser();
insilmaril@432
    13
	void parseAtom (const QString &input);
insilmaril@432
    14
	QString command();
insilmaril@432
    15
	QStringList parameters();
insilmaril@432
    16
	int paramCount();
insilmaril@432
    17
	QString errorMessage();
insilmaril@432
    18
	QString errorDescription();
insilmaril@432
    19
	ErrorLevel errorLevel();
insilmaril@432
    20
	void setError (ErrorLevel level,const QString &description);
insilmaril@432
    21
	void resetError();
insilmaril@432
    22
	bool checkParamCount (QList <int> plist);
insilmaril@432
    23
	bool checkParamCount (const int &index);
insilmaril@432
    24
	bool checkParamIsInt (const int &index);
insilmaril@432
    25
	int parInt (bool &,const uint &index);
insilmaril@432
    26
	QString parString(bool &ok,const int &index);
insilmaril@432
    27
	bool parBool (bool &ok, const int &index);
insilmaril@432
    28
	QColor parColor (bool &ok, const int &index);
insilmaril@432
    29
insilmaril@432
    30
	void setScript (const QString &);
insilmaril@432
    31
	QString getScript();
insilmaril@432
    32
	void startScript();
insilmaril@432
    33
	bool next();
insilmaril@432
    34
insilmaril@432
    35
insilmaril@432
    36
private:
insilmaril@432
    37
	void initCommand();
insilmaril@432
    38
insilmaril@432
    39
	QString input;
insilmaril@432
    40
	QString com;
insilmaril@432
    41
	QStringList paramList;
insilmaril@432
    42
	QString script;
insilmaril@432
    43
insilmaril@432
    44
	QString errMessage;
insilmaril@432
    45
	QString errDescription;
insilmaril@432
    46
	ErrorLevel errLevel;
insilmaril@432
    47
};
insilmaril@432
    48
insilmaril@432
    49
#endif