Add function LiveMessageTokenScriptWrapper::getString()
This commit is contained in:
parent
d86e12f1d3
commit
06bf1a867d
2 changed files with 11 additions and 0 deletions
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue