-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcsgl.hpp
148 lines (121 loc) · 2.45 KB
/
csgl.hpp
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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
//c++ header file
/*
#***********************************************
#
# Filename: csgl.h
#
# Author: coderguang
# Email: royalchen@royalchen.com
# website: www.royalchen.com
# Description: ----
#
# Create: 2017-09-09 12:56:17
# Last Modified: 2017-09-09 12:56:17
#***********************************************
*/
#ifndef _CSG_L_
#define _CSG_L_
#include <iostream>
#include <string>
#include <vector>
struct CSGEnum{
std::string identify;
int value;
void clear(){
identify="";
value=0;
}
};
struct CSGStruct{
std::string type;
std::string identify;
void clear(){
type="";
identify="";
};
};
struct CSGInterfaceParam{
std::string type;
bool isOut;
std::string identify;
void clear(){
type="";
isOut=false;
identify="";
}
};
struct CSGInterface{
int rpcId;
std::string funcName;
std::vector<CSGInterfaceParam> paramList;
void clear(){
rpcId=0;
funcName="";
paramList.clear();
};
};
struct CSGType{
int id; //identify id
int t_int;
float t_float;
double t_double;
long t_long;
std::string t_string;
bool t_bool;
std::vector<std::string> ts_list;
//for enum
CSGEnum tmpEnumKey;
std::vector<CSGEnum> te_list;
//for struct
CSGStruct tmpStructKey;
std::vector<CSGStruct> tstruct_list;
//for interface
CSGInterface tmpInterfaceKey;
CSGInterfaceParam tmpInterfaceParamKey;
std::vector<CSGInterface> tinterface_list;
void clear(){
id=0;
t_int=0;
t_float=0.0;
t_double=0.0;
t_long=0;
t_string="";
t_bool=false;
ts_list.clear();
tmpEnumKey.clear();
te_list.clear();
tmpStructKey.clear();
tstruct_list.clear();
tmpInterfaceKey.clear();
tmpInterfaceParamKey.clear();
tinterface_list.clear();
}
};
static std::string includeCsgFile="\
#include \"engine/serialize/serializestream\.h\"\n\
#include \"engine/def/csg_def\.h\"\n\
#include \"engine/mq/msgBlock\.h\"\n\
#include \"engine/mq/msgManager\.h\"\n\
#include \"engine/rpc/rmiObject.h\"\n";
static std::string csgDefStr="\
//******************************************\n\
// generated by royalchen's csgl tools\n\
// email:royalchen@royalchen.com \n\
// FAQ:www.royalchen.com\n\
// ******************************************";
class CSGStream{
public:
std::string content;
};
static CSGStream& operator<<(CSGStream& os,std::string str){
os.content+=str;
return os;
};
extern "C"{
extern int yylex(void);
extern void yyerror(const char* s);
}
#define YYSTYPE CSGType
#define YYDEBUG 1
#define YYERROR_VERBOSE
#endif