there are several lib out there support serialization,like protobuffer,flatbuffers,capnproto. Need schema file for generating source files, which is cool between peers of different language. but that is too heavy for only local serialization. so I wrote this lite version.only support c++. If your just want to serialize & deserialize data on the same machine. I think it is a good choice. simple as it is , hack whatever u want.
src/core/serialization.h
that`s it!You are set to go!
- vector
- list
- map
- set
- string
- primitives(int,double,long,...)
- nesting container support
Obj : implements serialize:I interface
vector<map<int, Obj*> >
vector<vector<string> >
vector<list<string> >
vector<customer_struct>
vector<Obj>
vector<string>
- endian auto conversion
no need to worry about endian problem.all data is writed in little endian.
use char instead bool in STL why
you can build this project by CMake. or just import serialization.h into your project.
cmake build process:
mkdir prj
cd prj
cmake ..
if it doesn`t work. set compile flags to c++11
check testSerialization.cpp