1
0
mirror of https://github.com/nlohmann/json.git synced 2025-08-07 18:02:57 +03:00
includes some macros to be defined for using without file io.
This commit is contained in:
David Pfahler
2021-04-21 10:24:01 +02:00
parent db78ac1d77
commit 1a1381f071
3 changed files with 12 additions and 4 deletions

View File

@@ -26,6 +26,7 @@ enum class input_format_t { json, cbor, msgpack, ubjson, bson };
// input adapters //
////////////////////
#ifndef JSON_NO_IO
/*!
Input adapter for stdio file access. This adapter read only 1 byte and do not use any
buffer. This adapter is a very low level adapter.
@@ -115,6 +116,7 @@ class input_stream_adapter
std::istream* is = nullptr;
std::streambuf* sb = nullptr;
};
#endif // JSON_NO_IO
// General-purpose iterator-based adapter. It might not be as fast as
// theoretically possible for some containers, but it is extremely versatile.
@@ -381,6 +383,7 @@ auto input_adapter(const ContainerType& container) -> decltype(input_adapter(beg
return input_adapter(begin(container), end(container));
}
#ifndef JSON_NO_IO
// Special cases with fast paths
inline file_input_adapter input_adapter(std::FILE* file)
{
@@ -396,6 +399,7 @@ inline input_stream_adapter input_adapter(std::istream&& stream)
{
return input_stream_adapter(stream);
}
#endif // JSON_NO_IO
using contiguous_bytes_input_adapter = decltype(input_adapter(std::declval<const char*>(), std::declval<const char*>()));