24 #ifndef __SCANNER_HPP__ 25 #define __SCANNER_HPP__ 87 const QString &str()
const;
88 void setStr(
const QString &v);
90 unsigned int number()
const;
91 void setNumber(
unsigned int v);
93 double decimal()
const;
94 void setDecimal(
double v);
97 void setBoolean(
bool v);
100 void setToken(
char v);
102 unsigned int tokenLine()
const;
103 void setTokenLine(
unsigned int v);
105 unsigned int tokenLinePosition()
const;
106 void setTokenLinePosition(
unsigned int v);
108 unsigned int scanPos()
const;
109 void setScanPos(
unsigned int v);
122 Scanner(
const char *data,
int length = -1);
130 void checkForWhitespace();
136 bool checkToken(
char token);
141 int currentLine()
const;
142 int currentLinePos()
const;
143 int currentPos()
const;
144 unsigned int currentScanPos()
const;
150 bool nextToken(
bool autoExpandState =
true);
151 void mustGetToken(
unsigned char token);
153 const char *scriptData()
const;
154 void scriptMessage(MessageLevel level,
const char *error, ...)
const;
155 void setScriptIdentifier(
const QString &ident);
163 bool tokensLeft()
const;
174 static const QString &escape(QString &str);
175 static const QString &unescape(QString &str);
177 static void setMessageHandler(
void (*handler)(MessageLevel,
const char *, va_list))
179 messageHandler = handler;
187 void incrementLine();
192 static void (*messageHandler)(MessageLevel,
const char *, va_list);
Scanner reads scripts by checking individual tokens.