1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
|
/*
* $Id: function.h,v 1.2 2004/12/28 01:24:35 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,
fun_plugin = INTERNAL + 7
};
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;
std::string FunPlugin(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 SetListIndex(uint Index, int Tab);
};
inline void cxFunction::SetListIndex(uint Index, int Tab)
{
mString.SetListIndex(Index, Tab);
for (uint i = 0; i < mNumParams; ++i)
mParams[i]->SetListIndex(Index, Tab);
}
#endif // VDR_TEXT2SKIN_XML_FUNCTION_H
|