Skip to content

Commit 2946e7b

Browse files
committed
Update nlhomann json to 3.10.5
1 parent f2d8c49 commit 2946e7b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+3025
-6401
lines changed

vendor/nlohmann/adl_serializer.hpp

100644100755
Lines changed: 25 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,48 @@
11
#pragma once
22

3+
#include <type_traits>
34
#include <utility>
45

56
#include <nlohmann/detail/conversions/from_json.hpp>
67
#include <nlohmann/detail/conversions/to_json.hpp>
8+
#include <nlohmann/detail/meta/identity_tag.hpp>
9+
#include <nlohmann/detail/meta/type_traits.hpp>
710

811
namespace nlohmann
912
{
1013

11-
template<typename, typename>
14+
/// @sa https://json.nlohmann.me/api/adl_serializer/
15+
template<typename ValueType, typename>
1216
struct adl_serializer
1317
{
14-
/*!
15-
@brief convert a JSON value to any value type
16-
17-
This function is usually called by the `get()` function of the
18-
@ref basic_json class (either explicit or via conversion operators).
19-
20-
@param[in] j JSON value to read from
21-
@param[in,out] val value to write to
22-
*/
23-
template<typename BasicJsonType, typename ValueType>
24-
static auto from_json(BasicJsonType&& j, ValueType& val) noexcept(
18+
/// @brief convert a JSON value to any value type
19+
/// @sa https://json.nlohmann.me/api/adl_serializer/from_json/
20+
template<typename BasicJsonType, typename TargetType = ValueType>
21+
static auto from_json(BasicJsonType && j, TargetType& val) noexcept(
2522
noexcept(::nlohmann::from_json(std::forward<BasicJsonType>(j), val)))
2623
-> decltype(::nlohmann::from_json(std::forward<BasicJsonType>(j), val), void())
2724
{
2825
::nlohmann::from_json(std::forward<BasicJsonType>(j), val);
2926
}
3027

31-
/*!
32-
@brief convert any value type to a JSON value
33-
34-
This function is usually called by the constructors of the @ref basic_json
35-
class.
28+
/// @brief convert a JSON value to any value type
29+
/// @sa https://json.nlohmann.me/api/adl_serializer/from_json/
30+
template<typename BasicJsonType, typename TargetType = ValueType>
31+
static auto from_json(BasicJsonType && j) noexcept(
32+
noexcept(::nlohmann::from_json(std::forward<BasicJsonType>(j), detail::identity_tag<TargetType> {})))
33+
-> decltype(::nlohmann::from_json(std::forward<BasicJsonType>(j), detail::identity_tag<TargetType> {}))
34+
{
35+
return ::nlohmann::from_json(std::forward<BasicJsonType>(j), detail::identity_tag<TargetType> {});
36+
}
3637

37-
@param[in,out] j JSON value to write to
38-
@param[in] val value to read from
39-
*/
40-
template<typename BasicJsonType, typename ValueType>
41-
static auto to_json(BasicJsonType& j, ValueType&& val) noexcept(
42-
noexcept(::nlohmann::to_json(j, std::forward<ValueType>(val))))
43-
-> decltype(::nlohmann::to_json(j, std::forward<ValueType>(val)), void())
38+
/// @brief convert any value type to a JSON value
39+
/// @sa https://json.nlohmann.me/api/adl_serializer/to_json/
40+
template<typename BasicJsonType, typename TargetType = ValueType>
41+
static auto to_json(BasicJsonType& j, TargetType && val) noexcept(
42+
noexcept(::nlohmann::to_json(j, std::forward<TargetType>(val))))
43+
-> decltype(::nlohmann::to_json(j, std::forward<TargetType>(val)), void())
4444
{
45-
::nlohmann::to_json(j, std::forward<ValueType>(val));
45+
::nlohmann::to_json(j, std::forward<TargetType>(val));
4646
}
4747
};
48-
4948
} // namespace nlohmann

vendor/nlohmann/byte_container_with_subtype.hpp

100644100755
Lines changed: 26 additions & 98 deletions
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,47 @@
11
#pragma once
22

3-
#include <cstdint> // uint8_t
3+
#include <cstdint> // uint8_t, uint64_t
44
#include <tuple> // tie
55
#include <utility> // move
66

77
namespace nlohmann
88
{
99

10-
/*!
11-
@brief an internal type for a backed binary type
12-
13-
This type extends the template parameter @a BinaryType provided to `basic_json`
14-
with a subtype used by BSON and MessagePack. This type exists so that the user
15-
does not have to specify a type themselves with a specific naming scheme in
16-
order to override the binary type.
17-
18-
@tparam BinaryType container to store bytes (`std::vector<std::uint8_t>` by
19-
default)
20-
21-
@since version 3.8.0
22-
*/
10+
/// @brief an internal type for a backed binary type
11+
/// @sa https://json.nlohmann.me/api/byte_container_with_subtype/
2312
template<typename BinaryType>
2413
class byte_container_with_subtype : public BinaryType
2514
{
2615
public:
27-
/// the type of the underlying container
2816
using container_type = BinaryType;
17+
using subtype_type = std::uint64_t;
2918

19+
/// @sa https://json.nlohmann.me/api/byte_container_with_subtype/byte_container_with_subtype/
3020
byte_container_with_subtype() noexcept(noexcept(container_type()))
3121
: container_type()
3222
{}
3323

24+
/// @sa https://json.nlohmann.me/api/byte_container_with_subtype/byte_container_with_subtype/
3425
byte_container_with_subtype(const container_type& b) noexcept(noexcept(container_type(b)))
3526
: container_type(b)
3627
{}
3728

29+
/// @sa https://json.nlohmann.me/api/byte_container_with_subtype/byte_container_with_subtype/
3830
byte_container_with_subtype(container_type&& b) noexcept(noexcept(container_type(std::move(b))))
3931
: container_type(std::move(b))
4032
{}
4133

42-
byte_container_with_subtype(const container_type& b, std::uint8_t subtype) noexcept(noexcept(container_type(b)))
34+
/// @sa https://json.nlohmann.me/api/byte_container_with_subtype/byte_container_with_subtype/
35+
byte_container_with_subtype(const container_type& b, subtype_type subtype_) noexcept(noexcept(container_type(b)))
4336
: container_type(b)
44-
, m_subtype(subtype)
37+
, m_subtype(subtype_)
4538
, m_has_subtype(true)
4639
{}
4740

48-
byte_container_with_subtype(container_type&& b, std::uint8_t subtype) noexcept(noexcept(container_type(std::move(b))))
41+
/// @sa https://json.nlohmann.me/api/byte_container_with_subtype/byte_container_with_subtype/
42+
byte_container_with_subtype(container_type&& b, subtype_type subtype_) noexcept(noexcept(container_type(std::move(b))))
4943
: container_type(std::move(b))
50-
, m_subtype(subtype)
44+
, m_subtype(subtype_)
5145
, m_has_subtype(true)
5246
{}
5347

@@ -62,104 +56,38 @@ class byte_container_with_subtype : public BinaryType
6256
return !(rhs == *this);
6357
}
6458

65-
/*!
66-
@brief sets the binary subtype
67-
68-
Sets the binary subtype of the value, also flags a binary JSON value as
69-
having a subtype, which has implications for serialization.
70-
71-
@complexity Constant.
72-
73-
@exceptionsafety No-throw guarantee: this member function never throws
74-
exceptions.
75-
76-
@sa @ref subtype() -- return the binary subtype
77-
@sa @ref clear_subtype() -- clears the binary subtype
78-
@sa @ref has_subtype() -- returns whether or not the binary value has a
79-
subtype
80-
81-
@since version 3.8.0
82-
*/
83-
void set_subtype(std::uint8_t subtype) noexcept
59+
/// @brief sets the binary subtype
60+
/// @sa https://json.nlohmann.me/api/byte_container_with_subtype/set_subtype/
61+
void set_subtype(subtype_type subtype_) noexcept
8462
{
85-
m_subtype = subtype;
63+
m_subtype = subtype_;
8664
m_has_subtype = true;
8765
}
8866

89-
/*!
90-
@brief return the binary subtype
91-
92-
Returns the numerical subtype of the value if it has a subtype. If it does
93-
not have a subtype, this function will return size_t(-1) as a sentinel
94-
value.
95-
96-
@return the numerical subtype of the binary value
97-
98-
@complexity Constant.
99-
100-
@exceptionsafety No-throw guarantee: this member function never throws
101-
exceptions.
102-
103-
@sa @ref set_subtype() -- sets the binary subtype
104-
@sa @ref clear_subtype() -- clears the binary subtype
105-
@sa @ref has_subtype() -- returns whether or not the binary value has a
106-
subtype
107-
108-
@since version 3.8.0
109-
*/
110-
constexpr std::uint8_t subtype() const noexcept
67+
/// @brief return the binary subtype
68+
/// @sa https://json.nlohmann.me/api/byte_container_with_subtype/subtype/
69+
constexpr subtype_type subtype() const noexcept
11170
{
112-
return m_subtype;
71+
return m_has_subtype ? m_subtype : static_cast<subtype_type>(-1);
11372
}
11473

115-
/*!
116-
@brief return whether the value has a subtype
117-
118-
@return whether the value has a subtype
119-
120-
@complexity Constant.
121-
122-
@exceptionsafety No-throw guarantee: this member function never throws
123-
exceptions.
124-
125-
@sa @ref subtype() -- return the binary subtype
126-
@sa @ref set_subtype() -- sets the binary subtype
127-
@sa @ref clear_subtype() -- clears the binary subtype
128-
129-
@since version 3.8.0
130-
*/
74+
/// @brief return whether the value has a subtype
75+
/// @sa https://json.nlohmann.me/api/byte_container_with_subtype/has_subtype/
13176
constexpr bool has_subtype() const noexcept
13277
{
13378
return m_has_subtype;
13479
}
13580

136-
/*!
137-
@brief clears the binary subtype
138-
139-
Clears the binary subtype and flags the value as not having a subtype, which
140-
has implications for serialization; for instance MessagePack will prefer the
141-
bin family over the ext family.
142-
143-
@complexity Constant.
144-
145-
@exceptionsafety No-throw guarantee: this member function never throws
146-
exceptions.
147-
148-
@sa @ref subtype() -- return the binary subtype
149-
@sa @ref set_subtype() -- sets the binary subtype
150-
@sa @ref has_subtype() -- returns whether or not the binary value has a
151-
subtype
152-
153-
@since version 3.8.0
154-
*/
81+
/// @brief clears the binary subtype
82+
/// @sa https://json.nlohmann.me/api/byte_container_with_subtype/clear_subtype/
15583
void clear_subtype() noexcept
15684
{
15785
m_subtype = 0;
15886
m_has_subtype = false;
15987
}
16088

16189
private:
162-
std::uint8_t m_subtype = 0;
90+
subtype_type m_subtype = 0;
16391
bool m_has_subtype = false;
16492
};
16593

0 commit comments

Comments
 (0)