11 #include <nlohmann/detail/macro_scope.hpp>
20 virtual void write_character(CharType c) = 0;
21 virtual void write_characters(
const CharType* s, std::size_t length) = 0;
26 template<
typename CharType>
30 template<
typename CharType>
38 void write_character(CharType c)
override
43 JSON_HEDLEY_NON_NULL(2)
44 void write_characters(
const CharType* s, std::size_t length)
override
46 std::copy(s, s + length, std::back_inserter(v));
50 std::vector<CharType>& v;
54 template<
typename CharType>
62 void write_character(CharType c)
override
67 JSON_HEDLEY_NON_NULL(2)
68 void write_characters(
const CharType* s, std::size_t length)
override
70 stream.write(s,
static_cast<std::streamsize
>(length));
74 std::basic_ostream<CharType>& stream;
78 template<
typename CharType,
typename StringType = std::basic_
string<CharType>>
86 void write_character(CharType c)
override
91 JSON_HEDLEY_NON_NULL(2)
92 void write_characters(
const CharType* s, std::size_t length)
override
94 str.append(s, length);
101 template<
typename CharType,
typename StringType = std::basic_
string<CharType>>
Definition: output_adapters.hpp:103
output adapter for output streams
Definition: output_adapters.hpp:56
output adapter for basic_string
Definition: output_adapters.hpp:80
output adapter for byte vectors
Definition: output_adapters.hpp:32
std::shared_ptr< output_adapter_protocol< CharType > > output_adapter_t
a type to simplify interfaces
Definition: output_adapters.hpp:27
namespace for Niels Lohmann
Definition: adl_serializer.hpp:9
abstract output adapter interface
Definition: output_adapters.hpp:19