Repository navigation
Expand file tree
/
Copy pathStructorType.hpp
More file actions
71 lines (55 loc) · 1.76 KB
/
Copy pathStructorType.hpp
File metadata and controls
71 lines (55 loc) · 1.76 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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
/**
* @file StructorType.hpp
* @author huangjian
* @date 2022-02-21
* @version 1.0
* @copyright huangjian
**/
#ifndef STRUCTORTYPE_H
#define STRUCTORTYPE_H
#include "TypeDefinition.hpp"
#include <vector>
/// @brief The StructorTypeDeclare class 类结构化类型声明基类,例如struct, union等
class StructorTypeDeclare : public Type {
public:
static const uint16_t ID;
public:
StructorTypeDeclare(const String &keyword, const String &name);
virtual ~StructorTypeDeclare() override;
public:
virtual int typeWrite(Dequque &leftSide, Dequque &rightSide) override;
virtual uint16_t id() const override {
return StructorTypeDeclare::ID;
}
virtual Kind kind() const override { return Code::Kind::CodeStatment; }
private:
String m_name;
String m_keyword;
};
/**
* @brief The StructorType class 类结构化类型(比如struct、union等)
*/
class StructorType : public BlockTypeDefinition {
public:
typedef ::CodeContainer MembersContainer;
public:
static const uint16_t ID;
public:
StructorType(const MembersContainer &fields,
const String &keyword,
const String &name = "");
virtual ~StructorType() override;
public:
const MembersContainer &fields() const { return codeContainer(); }
public:
virtual int typeWrite(Dequque &leftSide, Dequque &rightSide) override;
virtual uint16_t id() const override {
return StructorType::ID;
}
virtual Kind kind() const override { return Code::Kind::CodeBlock; }
private:
String m_name;
};
typedef RefObject<StructorType> StructorTypeRef;
typedef RefObject<StructorTypeDeclare> StructorTypeDeclareRef;
#endif // STRUCTORTYPE_H