Update README.md
This commit is contained in:
parent
40b85b411e
commit
98b25c813e
28
README.md
28
README.md
|
@ -3,10 +3,13 @@
|
|||
The main goal of this project is to provide a code generator for serializing/deserializing C++ objects to/from JSON
|
||||
using Clang and RapidJSON.
|
||||
|
||||
It is also possible to serialize/deserialize C++ objects to a platform independent binary format.
|
||||
Extending the generator to generate code for other formats or other applications of reflection is possible as well.
|
||||
A serializer/deserializer for a platform independent binary format has already been implemented.
|
||||
|
||||
Extending the generator to generate code for other applications of reflection or to provide generic
|
||||
reflection would be possible as well.
|
||||
It would also be possible to extend the library/generator to provide generic reflection (not implemented yet).
|
||||
|
||||
The following documentation focuses on the JSON (de)serializer. However, most of it is also true for the mentioned
|
||||
binary (de)serializer which works quite similar.
|
||||
|
||||
## Open for other reflection approaches
|
||||
The reflection implementation used behind the scenes of this library is exchangeable:
|
||||
|
@ -69,12 +72,18 @@ The following table shows the mapping of supported C++ types to supported JSON t
|
|||
* Enums are (de)serialized as their underlying integer value. When deserializing, it is currently *not* checked
|
||||
whether the present integer value is a valid enumeration item.
|
||||
* The JSON type for smart pointer depends on the type the pointer refers to. It can also be `null`.
|
||||
* If multiple `std::shared_ptr` instance might point to the same object this object is serialized multiple times.
|
||||
When deserializing those identical objects, it is currently not possible to share the memory (again). So each
|
||||
`std::shared_ptr` will point to its own copy. Note that this limitation is *not* true when using binary
|
||||
serialization.
|
||||
* For deserialization
|
||||
* iteratables must provide an `emplace_back` method. So deserialization of eg. `std::forward_list`
|
||||
is currently not supported.
|
||||
* custom types must provide a default constructor.
|
||||
* constant member variables are skipped.
|
||||
* For custom (de)serialization, see the section below.
|
||||
* The binary (de)serializer supports approximately the same C++ types but obviously maps them to a platform
|
||||
independent binary representation rather than a JSON type.
|
||||
|
||||
## Usage
|
||||
This example shows how the library can be used to make a `struct` serializable:
|
||||
|
@ -116,6 +125,11 @@ reflective_rapidjson_generator \
|
|||
--output-file "$builddir/reflection/code-defining-structs.h"
|
||||
</pre>
|
||||
|
||||
There are further arguments available, see:
|
||||
<pre>
|
||||
reflective_rapidjson_generator --help
|
||||
</pre>
|
||||
|
||||
#### Binary (de)serialization
|
||||
It works very similar to the example above. Just use the `BinarySerializable` class instead (or in addition):
|
||||
|
||||
|
@ -356,16 +370,18 @@ Reflective RapidJSON.
|
|||
provided (so far).
|
||||
* I usually develop using the latest version of those dependencies. So it is recommend to get the
|
||||
the latest versions as well. I tested the following versions so far:
|
||||
* GCC 7.2.1/7.3.0 or Clang 5.0 as compiler
|
||||
* libstdc++ from GCC 7.2.1
|
||||
* GCC 7.2.1/7.3.0/8.1.0 or Clang 5.0/6.0/7.0 as compiler
|
||||
* libstdc++ from GCC 7.2.1/7.3.0/8.1.0
|
||||
* CMake 3.10.1
|
||||
* Clang 5.0.0/5.0.1 for LibTooling
|
||||
* RapidJSON 1.1.0
|
||||
* C++ utilities 4.12
|
||||
* Boost.Hana 1.65.1 and 1.66.0
|
||||
* Boost.Hana 1.65.1, 1.66.0, 1.67.0, 1.68.0
|
||||
* CppUnit 1.14.0
|
||||
* Doxygen 1.8.13
|
||||
* Graphviz 2.40.1
|
||||
* The binary (de)serializer requires C++ utilities at runtime. So when using it, it is required to
|
||||
link against C++ utilities.
|
||||
|
||||
### How to build
|
||||
#### 1. Install dependencies
|
||||
|
|
Loading…
Reference in New Issue