summaryrefslogtreecommitdiff
path: root/xml/function.h
diff options
context:
space:
mode:
Diffstat (limited to 'xml/function.h')
-rw-r--r--xml/function.h66
1 files changed, 66 insertions, 0 deletions
diff --git a/xml/function.h b/xml/function.h
new file mode 100644
index 0000000..a7d8838
--- /dev/null
+++ b/xml/function.h
@@ -0,0 +1,66 @@
+/*
+ * $Id: function.h,v 1.4 2004/12/08 18:47:37 lordjaxom Exp $
+ */
+
+#ifndef VDR_TEXT2SKIN_XML_FUNCTION_H
+#define VDR_TEXT2SKIN_XML_FUNCTION_H
+
+#include "xml/string.h"
+#include <string>
+
+#define STRING 0x01000000
+#define NUMBER 0x02000000
+#define INTERNAL 0x04000000
+
+#define MAXPARAMETERS 16
+
+class cxFunction {
+public:
+ enum eType {
+ undefined_function,
+
+ string = STRING,
+ number = NUMBER,
+
+ fun_not = INTERNAL + 1,
+ fun_and = INTERNAL + 2,
+ fun_or = INTERNAL + 3,
+ fun_eq = INTERNAL + 4,
+ fun_file = INTERNAL + 5,
+ fun_trans = INTERNAL + 6
+ };
+
+ static const std::string False;
+ static const std::string True;
+
+private:
+ eType mType;
+ cxString mString;
+ int mNumber;
+ cxFunction *mParams[MAXPARAMETERS];
+ uint mNumParams;
+
+protected:
+ const std::string &FunFile(const std::string &Param) const;
+
+public:
+ cxFunction(void);
+ cxFunction(const cxString &String);
+ cxFunction(const cxFunction &Src);
+ ~cxFunction();
+
+ bool Parse(const std::string &Text);
+ std::string Evaluate(void) const;
+ bool EvaluateToBool(void);
+
+ void SetIndex(uint Index, int Tab);
+};
+
+inline void cxFunction::SetIndex(uint Index, int Tab)
+{
+ mString.SetIndex(Index, Tab);
+ for (uint i = 0; i < mNumParams; ++i)
+ mParams[i]->SetIndex(Index, Tab);
+}
+
+#endif // VDR_TEXT2SKIN_XML_FUNCTION_H