Watch Star Fork

RonxBulld / ftrpcC++GPL-3.0

Sign up for free
Explore and code with more than 2 million developers,Free private repositories !:)
Sign up
这是一个简单的异步RPC框架,基于JSON进行传输。程序只进行打/解包参数工作,不涉及具体通信方式,socket、websocket都可以使用。目前作者使用此项目生成 typescript 前端和 C++ 后端,更多语言将被支持。 https://gitee.com/RonxBulld/ftrpc/wikis
Copy Edit Raw Blame History
//
// 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;
bool isArray = false;
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

Comment ( 0 )

You need to Sign in for post a comment

Help Search