reflective-rapidjson/lib
Martchus 0d17d5f20b Allow using Boost.Hana instead of code generator 2017-10-25 19:16:55 +02:00
..
cmake/modules Rename moc -> generator 2017-10-25 17:41:19 +02:00
tests Allow using Boost.Hana instead of code generator 2017-10-25 19:16:55 +02:00
CMakeLists.txt Allow using Boost.Hana instead of code generator 2017-10-25 19:16:55 +02:00
README.md Add project basic project structure 2017-10-19 01:10:51 +02:00
global.h Add project basic project structure 2017-10-19 01:10:51 +02:00
jsonreflector-boosthana.h Allow using Boost.Hana instead of code generator 2017-10-25 19:16:55 +02:00
jsonreflector.h Clear interatables before pulling array elements 2017-10-25 16:37:49 +02:00
jsonserializable.h Rename Reflectable -> JSONSerializable 2017-10-23 00:41:10 +02:00
reflectable.h Rename Reflectable -> JSONSerializable 2017-10-23 00:41:10 +02:00
someclass.cpp Add project basic project structure 2017-10-19 01:10:51 +02:00
someclass.h Add project basic project structure 2017-10-19 01:10:51 +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