Document supported datatypes

This commit is contained in:
Martchus 2017-10-29 23:46:11 +01:00
parent 407de04d91
commit c0e6570848
1 changed files with 23 additions and 0 deletions

View File

@ -10,6 +10,29 @@ This repository also contains a small, additional header to use RapidJSON with B
or dezerialize simple data structures using the `BOOST_HANA_DEFINE_STRUCT` macro rather than requiring the code
generator.
## Supported datatypes
The following table shows the mapping of supported C++ types to supported JSON types:
| C++ type | JSON type |
| ---------------------------------------- |:---------:|
| custom structures/classes | object |
| bool | true/false|
| signed and unsigned integral types | number |
| float and double | number |
| enum and enum class | number |
| std::string | string |
| const char * | string |
| iteratables (std::vector, std::list, ...)| array |
| std::tuple | array |
### Remarks
* `const char *` is only supported for serialization.
* Enums are only supported for serialization.
* For deserialization, iteratables must provide an `emplace_back` method. So deserialization of eg. `std::forward_list`
is currently not supported.
* Using pointers is not supported yet.
* The JSON type `null` is not supported yet.
## Usage
This example shows how the library can be used to make a `struct` serializable:
```