-
Notifications
You must be signed in to change notification settings - Fork 0
/
Initi.h
110 lines (99 loc) · 2.04 KB
/
Initi.h
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
#ifndef Init
#define Init
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>
#define T_BOOL 1
#define T_INT 2
#define T_LONG 3
#define T_FLOAT 4
#define T_DOUBLE 5
#define T_STRING 6
typedef struct Query;
typedef bool(*Condition)(char *, char *);
typedef bool(*Task)(Query&);
// Condition Fuctions
bool Great(char *a, char *b) // >
{
for (; *a.str != '\0' && *b.str != '\0'; a.str++, b.str++)
{
if (*a.str > *b.str)
return true;
}
return false;
}
bool Less(char *a, char *b) // <
{
for (; *a.str != '\0' && *b.str != '\0'; a.str++, b.str++)
{
if (*a.str < *b.str)
return true;
}
return false;
}
bool Equal(char *a, char *b) // ==
{
for (; *a.str != '\0' && *b.str != '\0'; a.str++, b.str++)
{
if (*a.str != *b.str)
return false;
}
return true;
}
bool NotEqual(char *a, char *b) // !=
{
for (; *a.str != '\0' && *b.str != '\0'; a.str++, b.str++)
{
if (*a.str != *b.str)
return true;
}
return false;
}
bool GreatEqual(char *a, char *b) // >=
{
for (; *a.str != '\0' && *b.str != '\0'; a.str++, b.str++)
{
if (*a.str < *b.str)
return false;
}
return true;
}
bool LessEqual(char *a, char *b) // <=
{
for (; *a.str != '\0' && *b.str != '\0'; a.str++, b.str++)
{
if (*a.str > *b.str)
return false;
}
return true;
}
struct Column_list
{
char *name;
char *value;
Column_list *next = nullptr;
};
struct Cuase
{
char *col;
char *oh;
Condition con;
};
struct Cond_tree
{
bool me;
Cuase cuase;
char opts;
Cond_list *left = nullptr, *right = nullptr;
};
struct Query
{
char *table;
char *table_flag;
char *struct_flag;
Column_list *datas;
Cond_tree *conditions;
Task execute;
};
#endif