acpa/include/element.h
方而静 e5caca5350 拆分源代码到多个文件 (#5)
fixes #3

Co-authored-by: lcw <ez_lcw@foxmail.com>
Co-authored-by: szdytom <szdytom@qq.com>
Reviewed-on: #5
2023-08-29 12:37:26 +00:00

53 lines
1018 B
C++

#ifndef ACPA_ELEMENT_H
#define ACPA_ELEMENT_H
#include <map>
#include <memory>
#include <string>
#include <vector>
using std::map;
using std::shared_ptr;
using std::string;
using std::vector;
using std::weak_ptr;
struct Struct;
struct ValType;
struct TemplateType;
struct StructType;
struct FunctionType;
struct Struct {
weak_ptr<Struct> fa;
vector<shared_ptr<TemplateType>> c1;
vector<shared_ptr<ValType>> c2;
map<string, shared_ptr<ValType>> vars;
map<string, shared_ptr<Struct>> structs;
};
struct ValType {
virtual int type() const = 0;
virtual ~ValType() = default;
};
struct TemplateType : ValType {
int type() const override;
};
struct StructType : ValType {
int type() const override;
shared_ptr<Struct> str;
map<shared_ptr<TemplateType>, shared_ptr<ValType>> mp;
};
struct FunctionType : ValType {
int type() const override;
vector<shared_ptr<TemplateType>> c1;
vector<shared_ptr<ValType>> c2;
shared_ptr<ValType> c3;
};
bool sameType(shared_ptr<ValType>, shared_ptr<ValType>);
#endif