diff options
| author | louis <louis.braun@gmx.de> | 2015-01-18 15:54:41 +0100 |
|---|---|---|
| committer | louis <louis.braun@gmx.de> | 2015-01-18 15:54:41 +0100 |
| commit | bab251a7a16d81854f3ce733d7bcc92adf826996 (patch) | |
| tree | 0c857d35339bf6d03b6b80150a3d4adcab06730f /libtemplate/parameter.c | |
| parent | 06af6390e35f7e73e631e56d472f883396299d81 (diff) | |
| download | vdr-plugin-skindesigner-bab251a7a16d81854f3ce733d7bcc92adf826996.tar.gz vdr-plugin-skindesigner-bab251a7a16d81854f3ce733d7bcc92adf826996.tar.bz2 | |
added empty operator additionally to isset to check in a condition if a string token is set
Diffstat (limited to 'libtemplate/parameter.c')
| -rw-r--r-- | libtemplate/parameter.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/libtemplate/parameter.c b/libtemplate/parameter.c index e3e48bd..b191d17 100644 --- a/libtemplate/parameter.c +++ b/libtemplate/parameter.c @@ -295,6 +295,19 @@ bool cConditionalParameter::Evaluate(map < string, int > *intTokens, map < strin 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 { int tokenValue = EvaluateParameter(cond->tokenName, intTokens, stringTokens); if (cond->type == ctBool) { @@ -387,6 +400,8 @@ void cConditionalParameter::InsertCondition(string cond) { sCond.isNegated = true; } else if (!rest.compare("isset")) { sCond.type = ctStringSet; + } else if (!rest.compare("empty")) { + sCond.type = ctStringEmpty; } else if (startswith(rest.c_str(), "gt(")) { string compVal = rest.substr(4, rest.size() - 5); sCond.compareValue = atoi(compVal.c_str()); |
