forked from aqjune/atdtocpp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcppdatastructure.h
90 lines (70 loc) · 1.79 KB
/
cppdatastructure.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
#ifndef CPPDATASTRUCTURE_H
#define CPPDATASTRUCTURE_H
#include<string>
#include<vector>
#include<iostream>
using namespace std;
class PrintConfig{
public:
int indentsize;
};
enum CppAccessModifier{
PUBLIC, PROTECTED, PRIVATE
};
class CppVariable{
public:
string name;
string type;
CppVariable(string type, string name);
void print(ostream &out);
};
class CppClass;
class CppMember{
public:
CppAccessModifier accmod;
public:
virtual void printDec(ostream &out, int indentation, PrintConfig *config, bool printAccMod) = 0;
};
class CppField : public CppMember{
public:
bool isstatic;
string type;
string name;
CppField();
void printDec(ostream &out, int indentation, PrintConfig *config, bool printAccMod);
};
class CppConstructor : public CppMember{
public:
CppClass *parentClass;
vector<CppVariable*> args;
vector<pair<CppField *, string> > initializers;
vector<string> instructions;
CppConstructor();
void printDec(ostream &hppout, int indentation, PrintConfig *config, bool printAccMod);
void printDef(ostream &cppout, int indentation, PrintConfig *config);
};
class CppMethod : public CppMember{
public:
bool isstatic;
bool isconst;
bool ispurevirtual;
CppClass *parentClass;
string returnType;
string name;
vector<CppVariable *> args;
vector<string> instructions;
CppMethod();
void printDec(ostream &out, int indentation, PrintConfig *config, bool printAccMod);
bool printDef(ostream &out, int indentation, PrintConfig *config);
};
class CppClass{
public:
string name;
string parentname;
vector<CppConstructor *> constructors;
vector<CppMethod *> methods;
vector<CppField *> fields;
void printDec(ostream &out, int indentation, PrintConfig *config);
int printDef(ostream &out, int indentation, PrintConfig *config);
};
#endif