Add function LiveMessageTokenScriptWrapper::getString()

This commit is contained in:
Micke Prag 2011-12-29 17:32:56 +01:00
parent d86e12f1d3
commit 06bf1a867d
2 changed files with 11 additions and 0 deletions

View file

@ -137,6 +137,16 @@ int LiveMessageTokenScriptWrapper::getInt(const QString &key, int defaultValue)
return p_token.dictVal[key].intVal;
}
QString LiveMessageTokenScriptWrapper::getString(const QString &key, const QString &defaultValue) const {
if (p_token.valueType != LiveMessageToken::Dictionary) {
return defaultValue;
}
if (!p_token.dictVal.contains(key)) {
return defaultValue;
}
return p_token.dictVal[key].stringVal;
}
int LiveMessageTokenScriptWrapper::intVal() const {
return p_token.intVal;
}

View file

@ -36,6 +36,7 @@ public slots:
void add(LiveMessageTokenScriptWrapper *token);
int getInt(const QString &key, int defaultValue = 0) const;
QString getString(const QString &key, const QString &defaultValue = "") const;
int intVal() const;