includes some macros to be defined for using without file io.
This commit is contained in:
David Pfahler committed 2021-04-21 10:24:01 +02:00
1 parent db78ac1d77
commit 1a1381f071
3 files changed
+12 -4

No files matched your search

@@ -50,6 +50,7 @@ class output_vector_adapter : public output_adapter_protocol<CharType>
std::vector<CharType>& v;
};
#ifndef JSON_NO_IO
/// output adapter for output streams
template<typename CharType>
class output_stream_adapter : public output_adapter_protocol<CharType>
@@ -73,6 +74,7 @@ class output_stream_adapter : public output_adapter_protocol<CharType>
private:
std::basic_ostream<CharType>& stream;
};
#endif // JSON_NO_IO
/// output adapter for basic_string
template<typename CharType, typename StringType = std::basic_string<CharType>>
@@ -105,8 +107,10 @@ class output_adapter
output_adapter(std::vector<CharType>& vec)
: oa(std::make_shared<output_vector_adapter<CharType>>(vec)) {}
#ifndef JSON_NO_IO
output_adapter(std::basic_ostream<CharType>& s)
: oa(std::make_shared<output_stream_adapter<CharType>>(s)) {}
#endif // JSON_NO_IO
output_adapter(StringType& s)
: oa(std::make_shared<output_string_adapter<CharType, StringType>>(s)) {}