diff options
author | Christian Wieninger <winni@debian.(none)> | 2007-11-28 19:39:36 +0100 |
---|---|---|
committer | Christian Wieninger <winni@debian.(none)> | 2007-11-28 19:39:36 +0100 |
commit | 6c107f1aeb1d4ce9ab59d0cf3e8619522497a408 (patch) | |
tree | daab03d220fe45f7b6e41263985e369f84221474 /varparser.c | |
parent | ff8576b944fb68511c86491668eff76b10f6a7c5 (diff) | |
download | vdr-plugin-epgsearch-6c107f1aeb1d4ce9ab59d0cf3e8619522497a408.tar.gz vdr-plugin-epgsearch-6c107f1aeb1d4ce9ab59d0cf3e8619522497a408.tar.bz2 |
- speedup
Diffstat (limited to 'varparser.c')
-rw-r--r-- | varparser.c | 34 |
1 files changed, 15 insertions, 19 deletions
diff --git a/varparser.c b/varparser.c index 6fe9ef4..6151aa6 100644 --- a/varparser.c +++ b/varparser.c @@ -24,6 +24,7 @@ The project's page is at http://winni.vdr-developer.org/epgsearch #include "varparser.h" #include <vdr/plugin.h> #include "log.h" +#include "epgsearchtools.h" bool cVarParser::Parse(const string& input) { @@ -55,16 +56,19 @@ bool cVarParser::ParseExp(const string& input) return ParseShellCmd(input); // conditional expression? int varPos = Strip(input).find("%"); - int queryPos = input.find("?"); - int colonPos = input.find(":"); - if (varPos == 0 && queryPos >= 0 && colonPos > queryPos) - return ParseCondExp(input); - else - { - // composed expression - compExpr = input; - return true; - } + if (varPos == 0) + { + int queryPos = input.find("?"); + if (queryPos >= 0) + { + int colonPos = input.find(":"); + if (colonPos > queryPos) + return ParseCondExp(input); + } + } + // composed expression + compExpr = input; + return true; } bool cVarParser::ParseShellCmd(const string& input) @@ -160,19 +164,11 @@ bool cVarParser::ParseEquality(const string& input) bool cVarParser::ParseVar(const string& input) { string str = Strip(input); - if (str[0] == '%' && str[str.size()-1] == '%' && str.size() > 2) + if (str.size() > 2 && str[0] == '%' && str[str.size()-1] == '%') return true; return false; } -string cVarParser::Strip(const string& input) -{ - string str = input; - while(str[0] == ' ') str.replace(0,1, ""); - while(str[str.size()-1] == ' ') str.replace(str.size()-1,1, ""); - return str; -} - bool cVarParser::IsCondExpr() { return (condEqLeft != ""); |