Commit Graph

58 Commits

Author SHA1 Message Date
Martchus 9a6d550d8f Apply clang-format/cmake-format 2023-02-03 13:34:19 +01:00
Martchus 5c7a6cba8c Add default operator== to serializable classes
Otherwise derived classes cannot use add a default themselves. Maybe this
makes sense for more comparision operators. Note that I'm still testing the
usefulness. It already breaks when using multiple inheritane so maybe there
is a better way.

The operator is guarded by a version constraint because it is a C++20
feature.
2022-05-15 21:03:20 +02:00
Martchus 1e3417f8d0 Fix (de)serialization of std::int8_t/std::uint8_t
Those types are not supported by RapidJSON and therefore need extra
handling.
2022-05-15 03:11:39 +02:00
Martchus 762540f5e5 Add support for `std::optional` 2022-05-07 18:40:37 +02:00
Martchus 0633923935 Simplify use of type traits in `json/reflector.h` 2022-05-07 16:52:32 +02:00
Martchus efaa8a8441 Avoid warnings about using uninitialized variable 2022-02-22 20:03:49 +01:00
Martchus 59ff3c19eb Allow reporting a type mismatch specifying the expected RapidJSON type directly 2022-01-03 23:24:40 +01:00
Martchus f8f551a78a Fix include and namespace-prefix for using `std::move` in JSON reflector 2021-12-05 23:34:39 +01: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 5110cff5eb Fix documentation for std::string_view's push/toJsonDocument function 2021-01-15 17:48:46 +01:00
Martchus 1e95c3d1ca Don't use StringRef with RapidJSON's SetString and allocator
There is no overload taking a RAPIDJSON_NAMESPACE::StringRef and an
allocator. So the StringRef will be implicitly converted back to a plain
CharType pointer causing an additional length calculation.
2020-06-29 20:26:19 +02:00
Martchus c33e1687cb Support serializing std::string_view 2020-06-26 22:08:05 +02:00
Martchus 442359f5bf Add a function to format JSON deserialization errors 2020-02-29 22:35:02 +01:00
Martchus 6e4077eed2 Add JsonDeserializationErrors::ThrowOn::All 2020-01-26 20:38:24 +01:00
Martchus 48639b42b2 Support serialization of std::pair 2019-12-27 01:43:28 +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 456702e009 Remove unused std::monostate handling
This wasn't useful after all.
2019-11-03 22:38:27 +01:00
Martchus e29db0fa87 Prevent warnings about unused lambda captures 2019-11-03 22:37:19 +01:00
Martchus c3dc381425 Support `std::variant` 2019-11-03 22:02:56 +01:00
Martchus d8e626d259 Fix toJsonDocument() for maps 2019-10-05 01:05:48 +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 974c0b0396 Allow to obtain only the JSON document
So the final serialization can be customized
2018-11-11 22:55:59 +01: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 9dc7bd371c Apply clang-format 2018-06-23 14:35:53 +02:00
Martchus 8628427e6d Fix usage of enable_if with GCC 8
Seems like the trick with the three dots isn't working
with GCC 8 anymore. So let's make it a default template
parameter then.

Not sure whether GCC 8 is here correct and whether this
workaround causes further trouble.
2018-05-07 23:48:37 +02:00
Martchus 03e3a4bc67 Support std::(unordered_)?(multi)?set 2018-02-26 22:39:09 +01:00
Martchus ca2a6acb2a Add dummy for pulling C-style string
So at least everything can compile and the type-check
is done.
2017-12-24 02:13:16 +01:00
Martchus 272ec99bb0 Allow parsing any number as any kind of integral/floating point
Makes sense because JSON does not distinguish different kinds of
numbers anyways
2017-12-24 02:12:01 +01:00
Martchus 0bb06d5190 Ensure all pull helper are declared prior to the call site 2017-12-24 00:57:08 +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 489d4c71c0 Fix typo 2017-12-22 20:31:48 +01:00
Martchus 29b39bc7bc Use uint64/int64 to serialize enums
Otherwise, enums using char as underlying types
can not not be serialized.
2017-12-22 20:30:55 +01:00
Martchus 9a2c2cfef6 Deserialize enums as well 2017-12-22 20:30:01 +01:00
Martchus 86a577748e Allow direct serialization of iteratables 2017-11-18 00:28:24 +01:00
Martchus add8ddaeec Apply clang-format 2017-11-17 22:04:11 +01:00
Martchus d5144d8e75 Restore GCC compatibility 2017-11-16 01:56:04 +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 ce89e3d878 Only include required Boost.Hana headers 2017-11-12 20:13:17 +01:00
Martchus 61a343bda1 Refactor redundant type checks 2017-11-12 20:07:43 +01:00
Martchus e9324f0ec3 Fix incomplete use of AdaptedJsonSerializable and handling tuple 2017-11-12 00:44:47 +01:00
Martchus 0d74d915f8 Allow optionally (de)serializing private members 2017-11-09 01:11:00 +01:00
Martchus 062f8c0d27 Allow enabling (de)serialization for 3rd party structs 2017-11-06 23:27:27 +01:00
Martchus 516f80b325 Use "is_base_of"-trait also for pushing objects 2017-11-04 15:16:05 +01:00
Martchus f212fc8de7 Prevent overflow on size type conversion 2017-11-04 15:15:12 +01:00
Martchus a4fac7c515 Further simplify JSON reflector 2017-11-04 02:33:34 +01:00
Martchus 4dbb5a3982 Prevent code duplication for iterator variants of pull() 2017-11-03 23:00:15 +01:00
Martchus 423d9ee393 Move all helper functions inside JsonReflector namespace 2017-11-03 22:42:18 +01:00