Giter Site home page Giter Site logo

gintian / cpp_serialize Goto Github PK

View Code? Open in Web Editor NEW

This project forked from dalerkd/cpp_serialize

0.0 0.0 0.0 31 KB

通过对头文件进行分析构建中间结构,支持广泛的序列化和反序列化代码的自动生成。暂停设计:需要更好的 token分析方案.

C++ 87.36% C 12.64%

cpp_serialize's Introduction

Cpp_Serialize

通过对头文件进行分析构建中间结构,支持广泛的序列化和反序列化代码的自动生成。 最终将提供将任意数据结构序列化成JSON和反序列化的例子.

工具设计:

根据头文件给出的数据结构:生成负责序列化和反序列化的C++代码.

是一种代码翻译器: ana.exe b.h -o result.cpp -of json

谈谈其他

一般我们生成序列化代码是通过:

  • Google Protocol Buffers(protobuf) 不支持C++容器
  • Boost.Serialization 编译相当坑

为了减少其他依赖,看来只能自力更生了.

数据结构->JSON:1.5小时
JSON->数据结构:1小时

在经历以上努力后,在想: 有没有什么办法能解决普通数据结构的序列化呢?

转换工作是可以自动化的,一个比较合理的方法是自动生成转换代码,再编译之. 所以本项目应运而生.

工具设计:

根据头文件给出的数据结构:生成负责序列化和反序列化的C++代码.

原理

数据结构(头文件)->提取中间信息->生成能动态处理数据的代码(cpp文件) 生成部分可以支持多种序列化方式.

工作进度

  • 前端
    • token分析
  • 中间层
    • 符号表管理
    • 中间树管理
  • 后端
    • 翻译成JSON处理代码

cpp_serialize's People

Contributors

dalerkd avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.