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