-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvalue.h
More file actions
51 lines (46 loc) · 1.35 KB
/
value.h
File metadata and controls
51 lines (46 loc) · 1.35 KB
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
//value.h
#ifndef VALUE_H
#define VALUE_H
#include <string>
#include "event.h"
#include "function.h"
using namespace std;
class SysFunction;
class Table;
class Channel;
class VoiceChannel;
class Value {
public:
enum Type {UNDEF, STRING, EVENTS, INTEGER, IDENTIFIER, SYS_FUNCTION,ERROR,FUNCTION, CHANNEL, OUTPORT, INPORT, DICT, LABEL, FARLABEL, ARRAY};
Type type;
union {
string str;
int integer;
vector<Event *> *events;
Function *function;
SysFunction *sysfunction;
Table *dictionary;
Channel *channel;
VoiceChannel *voicechannel;
Wait_t FL;
struct {
unsigned int len;
char *data;
}array;
};
Value(){type=UNDEF;}
Value(string s):str(s) {type=STRING;}
Value(string s, Type t):str(s) {type=t;}
Value(vector<Event *> *e):events(e) {type=EVENTS;}
Value(int n):integer(n) {type=INTEGER;}
Value(Function *f):function(f) {type=FUNCTION;}
Value(SysFunction *f):sysfunction(f) {type=SYS_FUNCTION;}
Value(Channel *c):channel(c) {type=CHANNEL;}
Value(VoiceChannel *c):voicechannel(c) {type=CHANNEL;}
Value(Table *t):dictionary(t){type=DICT;}
Value(int v, Type t):integer(v){type=t;}
Value(Channel *c, string l): FL(c,l) {type=FARLABEL;}
Value(char *c, unsigned int l){array.data=c;array.len=l;type=ARRAY;}
void print();
};
#endif