summaryrefslogtreecommitdiffstats
path: root/kommander/widget/parser.cpp
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-07-31 19:54:04 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-07-31 19:54:04 +0000
commitdc6b8e72fed2586239e3514819238c520636c9d9 (patch)
tree88b200df0a0b7fab9d6f147596173556f1ed9a13 /kommander/widget/parser.cpp
parent6927d4436e54551917f600b706a8d6109e49de1c (diff)
downloadtdewebdev-dc6b8e72fed2586239e3514819238c520636c9d9.tar.gz
tdewebdev-dc6b8e72fed2586239e3514819238c520636c9d9.zip
Trinity Qt initial conversion
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdewebdev@1157656 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kommander/widget/parser.cpp')
-rw-r--r--kommander/widget/parser.cpp98
1 files changed, 49 insertions, 49 deletions
diff --git a/kommander/widget/parser.cpp b/kommander/widget/parser.cpp
index 1424d6c7..04748e45 100644
--- a/kommander/widget/parser.cpp
+++ b/kommander/widget/parser.cpp
@@ -22,23 +22,23 @@
using namespace Parse;
-QString unescape(QString s)
+TQString unescape(TQString s)
{
return s.replace("\\\"", "\"").replace("\\t", "\t").replace("\\n", "\n").replace("\\\\", "\\");
}
-Parser::Parser(ParserData* pData) : m_data(pData), m_start(0), m_error(QString::null), m_errorPosition(0),
+Parser::Parser(ParserData* pData) : m_data(pData), m_start(0), m_error(TQString::null), m_errorPosition(0),
m_widget(0)
{
}
-Parser::Parser(ParserData* pData, const QString& expr) : m_data(pData), m_start(0),
- m_error(QString::null), m_errorPosition(0), m_widget(0)
+Parser::Parser(ParserData* pData, const TQString& expr) : m_data(pData), m_start(0),
+ m_error(TQString::null), m_errorPosition(0), m_widget(0)
{
setString(expr);
}
-bool Parser::setString(const QString& s)
+bool Parser::setString(const TQString& s)
{
reset();
m_parts.clear();
@@ -78,7 +78,7 @@ bool Parser::setString(const QString& s)
else if (s[start].isDigit()) // number: 1000 or 2.45
{
bool decimal = false;
- for (i = start+1; s[i].isDigit() || (!decimal && s[i] == QChar('.')); i++)
+ for (i = start+1; s[i].isDigit() || (!decimal && s[i] == TQChar('.')); i++)
if (s[i] == '.')
decimal = true;
if (decimal)
@@ -91,7 +91,7 @@ bool Parser::setString(const QString& s)
{
for (i = start+1; s[i].isLetterOrNumber() || s[i] == '_'; i++)
;
- QString name = s.mid(start, i - start);
+ TQString name = s.mid(start, i - start);
insertNode(ParseNode(m_data->stringToKeyword(name), name), lines);
start = i;
} // comment
@@ -131,28 +131,28 @@ void Parser::insertNode(ParseNode p, int line)
m_parts.append(p);
}
-QString Parser::errorMessage() const
+TQString Parser::errorMessage() const
{
return m_error;
}
-QString Parser::function(ParserData* data, const QString& name, const QStringList& params)
+TQString Parser::function(ParserData* data, const TQString& name, const TQStringList& params)
{
ParameterList par;
- for (QStringList::ConstIterator Iter = params.begin(); Iter != params.end(); ++Iter)
+ for (TQStringList::ConstIterator Iter = params.begin(); Iter != params.end(); ++Iter)
par.append(*Iter);
Function f = data->function(name);
return f.execute(0, par).toString();
}
-QString Parser::expression(Mode mode)
+TQString Parser::expression(Mode mode)
{
reset();
ParseNode p = parseExpression(mode);
if (!isError())
return p.toString();
else
- return QString();
+ return TQString();
}
bool Parser::isError() const
@@ -206,14 +206,14 @@ ParseNode Parser::parseValue(Mode mode)
{
if (tryKeyword(LeftBracket, CheckOnly))
{
- QString index = parseValue(mode).toString();
+ TQString index = parseValue(mode).toString();
tryKeyword(RightBracket);
- QString arr = p.variableName();
+ TQString arr = p.variableName();
return arrayValue(arr, index);
}
else if (tryKeyword(Dot, CheckOnly))
{
- QString value = variable(p.variableName()).toString();
+ TQString value = variable(p.variableName()).toString();
if (m_widget && m_widget->isWidget(value))
{
m_start--;
@@ -300,7 +300,7 @@ ParseNode Parser::parseAdd(Mode mode)
{
if (k == Plus)
if (type == ValueString)
- p = QString(p.toString() + p2.toString());
+ p = TQString(p.toString() + p2.toString());
else if (type == ValueDouble)
p = p.toDouble() + p2.toDouble();
else
@@ -410,7 +410,7 @@ ParseNode Parser::parseExpression(Mode mode)
ParseNode Parser::parseFunction(Mode mode)
{
int pos = m_start;
- QString name = next().variableName();
+ TQString name = next().variableName();
Function f = m_data->function(name);
m_start++;
ParameterList params;
@@ -440,10 +440,10 @@ ParseNode Parser::parseFunction(Mode mode)
return ParseNode();
}
-ParseNode Parser::parseWidget(Mode mode, const QString &widgetName)
+ParseNode Parser::parseWidget(Mode mode, const TQString &widgetName)
{
int pos = m_start;
- QString widget;
+ TQString widget;
if (widgetName.isNull())
widget = nextVariable(mode);
else
@@ -452,7 +452,7 @@ ParseNode Parser::parseWidget(Mode mode, const QString &widgetName)
if (!tryKeyword(Dot))
return ParseNode();
- QString var = nextVariable();
+ TQString var = nextVariable();
if (var.isNull())
return ParseNode();
ParameterList params;
@@ -483,10 +483,10 @@ ParseNode Parser::parseWidget(Mode mode, const QString &widgetName)
ParseNode Parser::parseAssignment(Mode mode)
{
- QString var = nextVariable();
+ TQString var = nextVariable();
if (tryKeyword(LeftBracket, CheckOnly))
{
- QString index = parseValue(mode).toString();
+ TQString index = parseValue(mode).toString();
tryKeyword(RightBracket);
tryKeyword(Assign);
ParseNode p = parseExpression(mode);
@@ -501,7 +501,7 @@ ParseNode Parser::parseAssignment(Mode mode)
}
else if (tryKeyword(Dot, CheckOnly))
{
- QString value = variable(var).toString();
+ TQString value = variable(var).toString();
if (m_widget && m_widget->isWidget(value))
{
m_start--;
@@ -585,7 +585,7 @@ Parse::Flow Parser::parseWhile(Mode mode)
Parse::Flow Parser::parseFor(Mode mode)
{
m_start++;
- QString var = nextVariable();
+ TQString var = nextVariable();
tryKeyword(Assign);
int start = parseExpression(mode).toInt();
tryKeyword(To);
@@ -620,16 +620,16 @@ Parse::Flow Parser::parseFor(Mode mode)
Parse::Flow Parser::parseForeach(Mode mode)
{
m_start++;
- QString var = nextVariable();
+ TQString var = nextVariable();
tryKeyword(In);
- QString arr = nextVariable();
+ TQString arr = nextVariable();
tryKeyword(Do);
int start = m_start;
Parse::Flow flow = FlowStandard;
if (isArray(arr) && array(arr).count())
{
- const QMap<QString, ParseNode> A = array(arr);
- for (QMapConstIterator<QString, ParseNode> It = A.begin(); It != A.end(); ++It)
+ const TQMap<TQString, ParseNode> A = array(arr);
+ for (TQMapConstIterator<TQString, ParseNode> It = A.begin(); It != A.end(); ++It)
{
m_start = start;
setVariable(var, It.key());
@@ -652,7 +652,7 @@ Parse::Flow Parser::parseForeach(Mode mode)
void Parser::parseSwitch(Mode mode)
{
m_start++;
- QString var = nextVariable();
+ TQString var = nextVariable();
ParseNode caseValue = variable(var);
bool executed = false;
tryKeyword(Semicolon, CheckOnly);
@@ -688,7 +688,7 @@ Flow Parser::parseCommand(Mode mode)
return FlowBreak;
else if (isFunction())
{
- QString name = next().variableName();
+ TQString name = next().variableName();
parseFunction(mode);
if (name == "return" && mode == Execute)
return FlowExit;
@@ -749,7 +749,7 @@ bool Parser::tryVariable(Mode mode)
{
if (next().isVariable())
{
- QString name = next().variableName();
+ TQString name = next().variableName();
m_start++;
return true;
}
@@ -758,17 +758,17 @@ bool Parser::tryVariable(Mode mode)
return false;
}
-QString Parser::nextVariable(Mode mode)
+TQString Parser::nextVariable(Mode mode)
{
if (next().isVariable())
{
- QString name = next().variableName();
+ TQString name = next().variableName();
m_start++;
return name;
}
else if (mode == Execute)
setError(i18n("Expected variable"));
- return QString();
+ return TQString();
}
@@ -785,16 +785,16 @@ bool Parser::isWidget() const
void Parser::reset()
{
m_start = 0;
- m_error = QString::null;
+ m_error = TQString::null;
m_errorPosition = 0;
}
-void Parser::setError(const QString& msg)
+void Parser::setError(const TQString& msg)
{
setError(msg, m_start);
}
-void Parser::setError(const QString& msg, int pos)
+void Parser::setError(const TQString& msg, int pos)
{
if (m_error.isNull())
{
@@ -803,7 +803,7 @@ void Parser::setError(const QString& msg, int pos)
}
}
-void Parser::setVariable(const QString& name, ParseNode value)
+void Parser::setVariable(const TQString& name, ParseNode value)
{
if (isGlobal(name))
m_globalVariables[name] = value;
@@ -811,7 +811,7 @@ void Parser::setVariable(const QString& name, ParseNode value)
m_variables[name] = value;
}
-ParseNode Parser::variable(const QString& name) const
+ParseNode Parser::variable(const TQString& name) const
{
if (isGlobal(name))
return m_globalVariables.contains(name) ? m_globalVariables[name] : ParseNode();
@@ -819,17 +819,17 @@ ParseNode Parser::variable(const QString& name) const
return m_variables.contains(name) ? m_variables[name] : ParseNode();
}
-bool Parser::isGlobal(const QString& name) const
+bool Parser::isGlobal(const TQString& name) const
{
return !name.isEmpty() && name[0] == '_';
}
-bool Parser::isVariable(const QString& name) const
+bool Parser::isVariable(const TQString& name) const
{
return m_variables.contains(name) || m_globalVariables.contains(name);
}
-void Parser::unsetVariable(const QString& key)
+void Parser::unsetVariable(const TQString& key)
{
if (isGlobal(key))
m_globalVariables.remove(key);
@@ -837,7 +837,7 @@ void Parser::unsetVariable(const QString& key)
m_variables.remove(key);
}
-const QMap<QString, ParseNode>& Parser::array(const QString& name) const
+const TQMap<TQString, ParseNode>& Parser::array(const TQString& name) const
{
if (isGlobal(name))
return m_globalArrays[name];
@@ -845,12 +845,12 @@ const QMap<QString, ParseNode>& Parser::array(const QString& name) const
return m_arrays[name];
}
-bool Parser::isArray(const QString& name) const
+bool Parser::isArray(const TQString& name) const
{
return m_arrays.contains(name) || m_globalArrays.contains(name);
}
-void Parser::setArray(const QString& name, const QString& key, ParseNode value)
+void Parser::setArray(const TQString& name, const TQString& key, ParseNode value)
{
if (isGlobal(name))
m_globalArrays[name][key] = value;
@@ -858,7 +858,7 @@ void Parser::setArray(const QString& name, const QString& key, ParseNode value)
m_arrays[name][key] = value;
}
-void Parser::unsetArray(const QString& name, const QString& key)
+void Parser::unsetArray(const TQString& name, const TQString& key)
{
if (isGlobal(name))
{
@@ -876,7 +876,7 @@ void Parser::unsetArray(const QString& name, const QString& key)
}
}
-ParseNode Parser::arrayValue(const QString& name, const QString& key) const
+ParseNode Parser::arrayValue(const TQString& name, const TQString& key) const
{
if (!isArray(name))
return ParseNode();
@@ -893,7 +893,7 @@ KommanderWidget* Parser::currentWidget() const
return m_widget;
}
-QMap<QString, ParseNode> Parser::m_globalVariables;
-QMap<QString, QMap<QString, ParseNode> > Parser::m_globalArrays;
+TQMap<TQString, ParseNode> Parser::m_globalVariables;
+TQMap<TQString, TQMap<TQString, ParseNode> > Parser::m_globalArrays;