1 Star 0 Fork 14

̶w̶o̶l̶f̶/ftrpc

forked from RonxBulld/ftrpc 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
ast_tree.h 1.64 KB
一键复制 编辑 原始数据 按行查看 历史
//
// Created by Rexfield on 2018/4/27.
//
#ifndef FTRPC_AST_TREE_H
#define FTRPC_AST_TREE_H
#include <list>
#include <memory>
enum NodeType {
NT_NONE = -1, NT_ROOT = 0, NT_MODULE, NT_API, NT_PARAM, NT_TYPE, NT_STRUCT
};
#include "TypeDef.h"
class astTreeNode
{
public:
enum NodeType nodeType = NT_NONE;
astTreeNode() {}
};
class TypeNode : public astTreeNode
{
public:
enum Type type;
explicit TypeNode(enum Type type = TY_NAN) {
this->nodeType = NT_TYPE;
this->type = type;
}
};
class StructNode : public TypeNode
{
public:
unsigned int name = (unsigned int)-1;
StructNode() {
this->nodeType = NT_STRUCT;
}
};
class ParamNode : public astTreeNode
{
public:
TypeNode type;
unsigned int name = (unsigned int)-1;
ParamNode() {
this->nodeType = NT_PARAM;
}
};
class ApiNode : public astTreeNode
{
public:
TypeNode retType;
unsigned int name = (unsigned int)-1;
std::list<ParamNode> params;
ApiNode() {
this->nodeType = NT_API;
this->params.clear();
}
};
class ModuleNode : public astTreeNode
{
public:
std::list<ApiNode> apis;
std::list<StructNode> structs;
unsigned int name = (unsigned int)-1;
ModuleNode () {
this->nodeType = NT_MODULE;
this->apis.clear();
this->structs.clear();
}
};
class RootNode : public astTreeNode
{
public:
unsigned int version = 0;
std::list<ModuleNode> modules;
RootNode() {
this->nodeType = NT_ROOT;
this->modules.clear();
}
};
#endif //FTRPC_AST_TREE_H
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C++
1
https://gitee.com/wolf-hw/ftrpc.git
git@gitee.com:wolf-hw/ftrpc.git
wolf-hw
ftrpc
ftrpc
master

搜索帮助

0d507c66 1850385 C8b1a773 1850385