Code generator for serializing/deserializing C++ objects to/from JSON using Clang and RapidJSON
Go to file
Martchus 8922c26c3d Add some documentation 2017-10-25 19:18:13 +02:00
generator Split generator tests into multiple files 2017-10-25 18:25:47 +02:00
lib Add some documentation 2017-10-25 19:18:13 +02:00
.gitignore Add project basic project structure 2017-10-19 01:10:51 +02:00
CMakeLists.txt Rename moc -> generator 2017-10-25 17:41:19 +02:00
LICENSE Add project basic project structure 2017-10-19 01:10:51 +02:00
README.md Allow using Boost.Hana instead of code generator 2017-10-25 19:16:55 +02:00

README.md

reflective-rapidjson

The main goal of this project is to provide a code generator for serializing/deserializing C++ objects to/from JSON using Clang and RapidJSON.

However, extending the generator to generate code for other applications of reflection or to provide generic reflection functionallity would be possible as well.

This repository also contains a small, additional header to use RapidJSON with Boost.Hana. This allows to serialize or dezerialize simple data structures using the BOOST_HANA_DEFINE_STRUCT macro rather than requiring the code generator.

Usage

This example shows how the library can be used to make a struct serializable:

TODO

Note that the header included at the bottom must be generated by invoking the code generator appropriately:

TODO

It is possible to use the provided CMake macro to automate this task:

TODO

Using Boost.Hana instead of code generator

The same example as above. However, this time Boost.Hana is used. So it doesn't required to invoking the generator.

TODO

Install instructions

Dependencies

  • C++ compiler and standard library supporting at least C++14
  • the CMake build system
  • LibTooling from Clang for the code generator
  • RapidJSON for JSON (de)serialization
  • c++utilities for various helper functions

Optional:

  • CppUnit for building and running the tests
  • Doxygen for generating API documentation
  • Graphviz for diagrams in the API documentation

Note that reflective-rapidjson and none of these dependencies are required at runtime by an application which makes use of the reflective-rapidjson.

How to build

Install all required dependencies and ensure the CMake script finds them. It is possible to build c++utilities together reflective-rapidjson to ease the build process. The following build script makes use of this. To use system c++utilities, just skip any lines with c++utilities in it.

TODO