Commit Graph

43 Commits

Author SHA1 Message Date
Martchus 091d521152 Use `pubsetbuf` only with `libstdc++`
This usage of the function seems only to work as intended with that
standard lib. With `libc++` and the MSVC standard lib the call has no
effect.
2023-02-28 21:19:40 +01:00
Martchus 10bb97bbc4 Apply clang-format 2022-10-13 19:59:20 +02:00
Martchus 762540f5e5 Add support for `std::optional` 2022-05-07 18:40:37 +02:00
Martchus efaa8a8441 Avoid warnings about using uninitialized variable 2022-02-22 20:03:49 +01:00
Martchus 0a902ac30c Add experimental versioning for binary (de)serializer 2021-07-13 00:37:05 +02:00
Martchus 5e72012ed5 Fix typos found via `codespell --skip .git -w` 2021-07-03 19:50:25 +02:00
Martchus 30735ba187 Fix warnings 2021-03-20 21:25:56 +01:00
Martchus 450588af89 Support multimap and unordered_multimap
The previously (undocumented) implementation used non-unique
keys in JSON objects. This is not strictly forbidden by the
RFC but not recommended. Multiple values are now stored within
an array instead.
2019-12-27 01:40:34 +01:00
Martchus 1024b8e391 Use override in test fixtures 2019-11-03 22:33:29 +01:00
Martchus c3dc381425 Support `std::variant` 2019-11-03 22:02:56 +01:00
Martchus f21f255e94 Don't use the same enum names twice
Prevents

```
[  168s] /home/abuild/rpmbuild/BUILD/reflective-rapidjson-1563638877.5f7c18b/lib/tests/jsonreflector.cpp:41:12: warning: type 'SomeEnumClass' violates the C++ One Definition Rule [-Wodr]
[  168s]    41 | enum class SomeEnumClass {
[  168s]       |            ^
[  168s] /home/abuild/rpmbuild/BUILD/reflective-rapidjson-1563638877.5f7c18b/lib/tests/binaryreflector.cpp:39:12: note: a type with different precision is defined in another translation unit
[  168s]    39 | enum class SomeEnumClass : std::uint16_t {
[  168s]       |            ^
```

observed in LTO-enabled builds
2019-08-09 17:48:08 +02:00
Martchus 8cac133104 Adapt to changes in c++utilities 2019-06-10 22:46:06 +02:00
Martchus dd174920fe Adapt to c++utilities v5 2019-05-04 16:09:58 +02:00
Martchus 0bf19df0d9 Add explicit test for type mismatch on binary serialization 2019-03-08 17:40:36 +01:00
Martchus 04852627b2 Fix binary serializiation of shared_ptr too big for variable length encoding
* Retain backward compatibility by using either variable length int
  or regular 64-bit int extending the flags
* Add test for both cases
2019-03-08 17:40:08 +01:00
Martchus 39dcba215e Let CMake generate code for test application 2019-01-13 22:27:35 +01:00
Martchus 712eb4fb28 Fix compiling with GCC
Template specializations produced by the macros apparently
must be in the same namespace for GCC (not sure whether this
is actually enforced by the standard).
2018-11-01 04:54:46 +00:00
Martchus d64174c000 Add experimental support for multimap
Makes sense for binary (de)serialization, not sure about
JSON (de)serialization
2018-11-01 04:54:46 +00:00
Martchus f77229471a Allow to teat custom types as std::map/std::set 2018-11-01 04:54:46 +00:00
Martchus f140c7f436 Use C++ 17 2018-06-26 00:07:59 +02:00
Martchus 6117ef3e1d Rename functions of BinarySerializable
So the names are more like the ones in JsonSerializable.
2018-06-23 17:24:28 +02:00
Martchus ac1fe81497 Add Boost.Hana support for binary (de)serialization 2018-06-23 15:30:51 +02:00
Martchus 316c1ba838 Add library for basic binary (de)serialization 2018-06-23 14:35:43 +02:00
Martchus 03e3a4bc67 Support std::(unordered_)?(multi)?set 2018-02-26 22:39:09 +01:00
Martchus ec66f14e4c Just use IsNumber() to check for numbers
Otherwise deserializing doubles does not work
when there's no explicit decimal point in the
JSON file.
2017-12-22 20:44:04 +01:00
Martchus 86a577748e Allow direct serialization of iteratables 2017-11-18 00:28:24 +01:00
Martchus a7f587cb84 Support std::map and std::unordered_map 2017-11-13 20:16:43 +01:00
Martchus f24390a00b Support smart pointer 2017-11-12 23:18:01 +01:00
Martchus 76a8f649bc Add example for custom (de)serialization 2017-11-03 17:45:16 +01:00
Martchus daf1a8602c Rename Reflector -> JsonReflector
So helper methods for other applications of reflections
would go into a separate namespace to prevent conflicts.
2017-11-02 23:35:56 +01:00
Martchus 407de04d91 Allow deserializing tuples 2017-10-29 22:53:02 +01:00
Martchus d849144504 Allow serializing tuples 2017-10-29 22:14:04 +01:00
Martchus ae3d8030b6 Allow serializing enums
Note that deserializing is not so simple because
we would need to check whether the integer actually
is an item of the expected enumeration type.
2017-10-29 21:31:23 +01:00
Martchus 0520341411 Fix passing temporary to Reflector::push() 2017-10-28 18:29:15 +02:00
Martchus 104e362762 Imporve documentation and build script 2017-10-28 18:24:12 +02:00
Martchus c94c896f6c Refactor RapidJSON wrapper
* Move all JSON related files into own directory
* Move helper for error handling in own header
* Remove some leftovers from debugging
* Rename classes, use Json instead of JSON
2017-10-28 16:23:39 +02:00
Martchus 5d441cf5ab Fix Boost.Hana tests
Boost.Hana doesn't make the record name accessible so
it can not be provided in the error case.
2017-10-28 15:53:16 +02:00
Martchus ad03afb1f2 Keep track of errors and fix usage of Boost.Hana
* Optionally save errors which occur during deserialization
  to allow error handling
* Don't operate on copies when using Boost.Hana
2017-10-28 15:50:16 +02:00
Martchus 1b1d07ef8c Improve error handling
* Throw ParseResult when parsing error occurs
* Silence type mismatch or missing members for now
2017-10-27 20:59:08 +02:00
Martchus ef6a91076f Apply clang-format 2017-10-27 15:48:26 +02:00
Martchus 0d17d5f20b Allow using Boost.Hana instead of code generator 2017-10-25 19:16:55 +02:00
Martchus 4a8ebc99a3 Rename Reflectable -> JSONSerializable
This allows to provide multiple independently
functional reflection features by simply using
different base classes for them.
2017-10-23 00:41:10 +02:00
Martchus 8344a99778 Add project basic project structure
* Implement simple RapidJSON wrapper
* Add skeleton for code generator to play around with
  LibTooling and LibClang
2017-10-19 01:10:51 +02:00