summaryrefslogtreecommitdiff
path: root/varparser.c
diff options
context:
space:
mode:
authorChristian Wieninger <cwieninger@gmx.de>2010-09-26 14:09:57 +0200
committerChristian Wieninger <cwieninger@gmx.de>2010-09-26 14:09:57 +0200
commit9efac7dc163ee573072fe1cdf64fb0dceb655982 (patch)
tree5d662f2a7d764fdabd704e52f11268dc5badf0f5 /varparser.c
parent44fe54115300b604865789018b560ec28edfcf3f (diff)
downloadvdr-plugin-epgsearch-9efac7dc163ee573072fe1cdf64fb0dceb655982.tar.gz
vdr-plugin-epgsearch-9efac7dc163ee573072fe1cdf64fb0dceb655982.tar.bz2
new 'lenght' command for script language
Diffstat (limited to 'varparser.c')
-rw-r--r--varparser.c29
1 files changed, 26 insertions, 3 deletions
diff --git a/varparser.c b/varparser.c
index d9ac6e8..09caca6 100644
--- a/varparser.c
+++ b/varparser.c
@@ -59,6 +59,10 @@ bool cVarParser::ParseExp(const string& input)
int conPos = input.find("connect");
if (conPos == 0)
return ParseConnectCmd(input);
+ // length command?
+ int lenPos = input.find("length");
+ if (lenPos == 0)
+ return ParseLengthCmd(input);
// conditional expression?
int varPos = Strip(input).find("%");
if (varPos == 0)
@@ -98,6 +102,7 @@ bool cVarParser::ParseShellCmd(const string& input)
cmd = NULL;
return false;
}
+ type = cVarParser::shellcmd;
return true;
}
@@ -124,6 +129,18 @@ bool cVarParser::ParseConnectCmd(const string& input)
LogFile.eSysLog("error parsing command: %s", input.c_str());
return false;
}
+ type = cVarParser::connectcmd;
+ return true;
+}
+
+bool cVarParser::ParseLengthCmd(const string& input)
+{
+ int startLen = input.find("(");
+ int endLen = input.find(")");
+ if (startLen == -1 || endLen == -1) return false;
+ string arg(input.begin() + startLen + 1, input.begin() + endLen);
+ compExpr = arg;
+ type = cVarParser::lengthcmd;
return true;
}
@@ -165,6 +182,7 @@ bool cVarParser::ParseCondExp(const string& input)
{
condvarTrue = Strip(truePart);
condvarFalse = Strip(falsePart);
+ type = cVarParser::condition;
return true;
}
}
@@ -202,15 +220,20 @@ bool cVarParser::ParseVar(const string& input)
bool cVarParser::IsCondExpr()
{
- return (condEqLeft != "");
+ return type == cVarParser::condition;
}
bool cVarParser::IsShellCmd()
{
- return (cmd != NULL);
+ return type == cVarParser::shellcmd;
}
bool cVarParser::IsConnectCmd()
{
- return (connectAddr != "" && connectPort != -1);
+ return type == cVarParser::connectcmd;
+}
+
+bool cVarParser::IsLengthCmd()
+{
+ return type == cVarParser::lengthcmd;
}