parser.h
author insilmaril
Wed Feb 27 16:08:45 2008 +0000 (2008-02-27)
changeset 670 fe3c52c49037
parent 514 497fab7d1404
permissions -rw-r--r--
autosave fix
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@447
    13
	void parseAtom (QString input);
insilmaril@447
    14
	QString getAtom();
insilmaril@447
    15
	QString getCommand();
insilmaril@447
    16
	QStringList getParameters();
insilmaril@514
    17
	int parCount();
insilmaril@432
    18
	QString errorMessage();
insilmaril@432
    19
	QString errorDescription();
insilmaril@432
    20
	ErrorLevel errorLevel();
insilmaril@432
    21
	void setError (ErrorLevel level,const QString &description);
insilmaril@432
    22
	void resetError();
insilmaril@514
    23
	bool checkParCount (QList <int> plist);
insilmaril@514
    24
	bool checkParCount (const int &index);
insilmaril@514
    25
	bool checkParIsInt (const int &index);
insilmaril@539
    26
	bool checkParIsDouble (const int &index);
insilmaril@432
    27
	int parInt (bool &,const uint &index);
insilmaril@432
    28
	QString parString(bool &ok,const int &index);
insilmaril@432
    29
	bool parBool (bool &ok, const int &index);
insilmaril@432
    30
	QColor parColor (bool &ok, const int &index);
insilmaril@539
    31
	double parDouble (bool &ok, const int &index);
insilmaril@432
    32
insilmaril@432
    33
	void setScript (const QString &);
insilmaril@432
    34
	QString getScript();
insilmaril@445
    35
	void runScript();
insilmaril@447
    36
	bool next();
insilmaril@432
    37
insilmaril@432
    38
insilmaril@432
    39
private:
insilmaril@447
    40
	void initParser();
insilmaril@447
    41
	void initAtom();
insilmaril@432
    42
insilmaril@432
    43
	QString input;
insilmaril@447
    44
	QString atom;
insilmaril@432
    45
	QString com;
insilmaril@432
    46
	QStringList paramList;
insilmaril@447
    47
	int current;
insilmaril@432
    48
	QString script;
insilmaril@432
    49
insilmaril@432
    50
	QString errMessage;
insilmaril@432
    51
	QString errDescription;
insilmaril@432
    52
	ErrorLevel errLevel;
insilmaril@432
    53
};
insilmaril@432
    54
insilmaril@432
    55
#endif