-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathobject.hpp
More file actions
52 lines (50 loc) · 1.63 KB
/
object.hpp
File metadata and controls
52 lines (50 loc) · 1.63 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
52
#ifndef OBJECT_H
#define OBJECT_H
#include <string>
#include "type.hpp"
#include "baseobj.hpp"
#include "table.hpp"
struct LiteralManager {
const int MAX_LENGTH = 200;
std::vector<char*> chars;
std::vector<int*> ints;
Object GetInt(int l);
Object GetVarChar(std::string& l);
Object GetNull();
void clear();
};
struct Expr {
virtual Object getObj(void* l, void* r = nullptr) = 0;
virtual void Use(const std::string& lname, const std::string& rname, TableDesc* ldesc, TableDesc* rdesc = nullptr) = 0;
};
struct ReadExpr : public Expr {
bool useLeft;
int offset;
int size;
int nullMask;
TYPE type;
std::string tbl, name;
ReadExpr(){};
ReadExpr(const std::string& _name) : tbl(""), name(_name) {}
ReadExpr(const std::string& _tbl, const std::string& _name) : tbl(_tbl), name(_name) {}
virtual Object getObj(void* l, void* r = nullptr);
virtual void Use(const std::string& lname, const std::string& rname, TableDesc* ldesc, TableDesc* rdesc = nullptr);
};
struct LiteralExpr : public Expr {
Object obj;
LiteralExpr(Object _obj) : obj(_obj) {}
virtual Object getObj(void* l, void* r = nullptr);
virtual void Use(const std::string& lname, const std::string& rname, TableDesc* ldesc, TableDesc* rdesc = nullptr);
};
typedef bool (*Oper)(const Object&, const Object&);
struct Condition {
Expr *l, *r;
Oper op;
};
bool op_eq(const Object&, const Object&);
bool op_ne(const Object&, const Object&);
bool op_lt(const Object&, const Object&);
bool op_gt(const Object&, const Object&);
bool op_le(const Object&, const Object&);
bool op_ge(const Object&, const Object&);
#endif