mirror of
https://projects.vdr-developer.org/git/vdr-plugin-skindesigner.git
synced 2023-10-19 17:58:31 +02:00
added empty operator additionally to isset to check in a condition if a string token is set
This commit is contained in:
parent
06af6390e3
commit
bab251a7a1
2
HISTORY
2
HISTORY
@ -156,3 +156,5 @@ Version 0.1.3
|
|||||||
Version 0.1.4
|
Version 0.1.4
|
||||||
|
|
||||||
- fixed token volpercent in nopacity and metrixhd
|
- fixed token volpercent in nopacity and metrixhd
|
||||||
|
- added "empty" operator additionally to "isset" to check in a condition
|
||||||
|
if a string token is set
|
||||||
|
@ -295,6 +295,19 @@ bool cConditionalParameter::Evaluate(map < string, int > *intTokens, map < strin
|
|||||||
tokenTrue = true;
|
tokenTrue = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else if (cond->type == ctStringEmpty) {
|
||||||
|
if (stringTokens) {
|
||||||
|
map < string, string >::iterator hit = stringTokens->find(cond->tokenName);
|
||||||
|
if (hit != stringTokens->end()) {
|
||||||
|
string value = hit->second;
|
||||||
|
if (value.size() == 0)
|
||||||
|
tokenTrue = true;
|
||||||
|
} else {
|
||||||
|
tokenTrue = true;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
tokenTrue = true;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
int tokenValue = EvaluateParameter(cond->tokenName, intTokens, stringTokens);
|
int tokenValue = EvaluateParameter(cond->tokenName, intTokens, stringTokens);
|
||||||
if (cond->type == ctBool) {
|
if (cond->type == ctBool) {
|
||||||
@ -387,6 +400,8 @@ void cConditionalParameter::InsertCondition(string cond) {
|
|||||||
sCond.isNegated = true;
|
sCond.isNegated = true;
|
||||||
} else if (!rest.compare("isset")) {
|
} else if (!rest.compare("isset")) {
|
||||||
sCond.type = ctStringSet;
|
sCond.type = ctStringSet;
|
||||||
|
} else if (!rest.compare("empty")) {
|
||||||
|
sCond.type = ctStringEmpty;
|
||||||
} else if (startswith(rest.c_str(), "gt(")) {
|
} else if (startswith(rest.c_str(), "gt(")) {
|
||||||
string compVal = rest.substr(4, rest.size() - 5);
|
string compVal = rest.substr(4, rest.size() - 5);
|
||||||
sCond.compareValue = atoi(compVal.c_str());
|
sCond.compareValue = atoi(compVal.c_str());
|
||||||
|
@ -109,6 +109,7 @@ enum eCondType {
|
|||||||
ctEquals,
|
ctEquals,
|
||||||
ctBool,
|
ctBool,
|
||||||
ctStringSet,
|
ctStringSet,
|
||||||
|
ctStringEmpty,
|
||||||
ctNone
|
ctNone
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user