Document supported datatypes
This commit is contained in:
parent
407de04d91
commit
c0e6570848
23
README.md
23
README.md
|
@ -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
|
or dezerialize simple data structures using the `BOOST_HANA_DEFINE_STRUCT` macro rather than requiring the code
|
||||||
generator.
|
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
|
## Usage
|
||||||
This example shows how the library can be used to make a `struct` serializable:
|
This example shows how the library can be used to make a `struct` serializable:
|
||||||
```
|
```
|
||||||
|
|
Loading…
Reference in New Issue