Skip to content

Commit

Permalink
Add binary type support to all binary file formats, as well as an int…
Browse files Browse the repository at this point in the history
…ernally represented binary type
  • Loading branch information
OmnipotentEntity committed Apr 14, 2020
1 parent 6121fc5 commit 012c966
Show file tree
Hide file tree
Showing 21 changed files with 3,031 additions and 129 deletions.
22 changes: 22 additions & 0 deletions include/nlohmann/detail/conversions/to_json.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,28 @@ struct external_constructor<value_t::string>
}
};

template<>
struct external_constructor<value_t::binary>
{
template<typename BasicJsonType>
static void construct(BasicJsonType& j, const typename BasicJsonType::binary_t& b)
{
j.m_type = value_t::binary;
typename BasicJsonType::internal_binary_t value{b};
j.m_value = value;
j.assert_invariant();
}

template<typename BasicJsonType>
static void construct(BasicJsonType& j, typename BasicJsonType::binary_t&& b)
{
j.m_type = value_t::binary;
typename BasicJsonType::internal_binary_t value{std::move(b)};
j.m_value = value;
j.assert_invariant();
}
};

template<>
struct external_constructor<value_t::number_float>
{
Expand Down

0 comments on commit 012c966

Please sign in to comment.