2017-10-18 23:07:17 +02:00
|
|
|
# reflective-rapidjson
|
|
|
|
|
2017-10-24 18:00:51 +02:00
|
|
|
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 provide generic
|
|
|
|
functionallity would be possible as well.
|
|
|
|
|
|
|
|
## 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
|
|
|
|
```
|