From fa7f1a524e8cb414de67f6da51d364ea66bf8f2d Mon Sep 17 00:00:00 2001 From: Jonathan Dumaresq Date: Wed, 12 Dec 2018 10:19:22 -0500 Subject: [PATCH] new unified json.hpp generated with make amalgamate --- single_include/nlohmann/json.hpp | 45 +++++++++++++++++--------------- 1 file changed, 24 insertions(+), 21 deletions(-) diff --git a/single_include/nlohmann/json.hpp b/single_include/nlohmann/json.hpp index 2e1fdbd5..871bb9ae 100644 --- a/single_include/nlohmann/json.hpp +++ b/single_include/nlohmann/json.hpp @@ -55,7 +55,6 @@ SOFTWARE. #include // allocator #include // string #include // vector -#include /*! @brief namespace for Niels Lohmann @@ -2059,6 +2058,7 @@ constexpr const auto& to_json = detail::static_const::value; #include // string, char_traits #include // enable_if, is_base_of, is_pointer, is_integral, remove_pointer #include // pair, declval +#include //FILE * // #include @@ -2095,6 +2095,27 @@ struct input_adapter_protocol /// a type to simplify interfaces using input_adapter_t = std::shared_ptr; +/*! +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. This adapter +*/ +class file_input_adapter : public input_adapter_protocol +{ + public: + explicit file_input_adapter(const FILE* file) noexcept + : file(file) + {} + + std::char_traits::int_type get_character() noexcept override + { + return fgetc(const_cast(file)); + } + private: + /// the file pointer to read from + const FILE* file; +}; + + /*! Input adapter for a (caching) istream. Ignores a UFT Byte Order Mark at beginning of input. Does not support changing the underlying std::streambuf @@ -2286,22 +2307,6 @@ struct wide_string_input_helper } }; -class file_input_adapter : public input_adapter_protocol -{ -public: - explicit file_input_adapter(const FILE *file) noexcept - : file(file) - {} - - std::char_traits::int_type get_character() noexcept override - { - return fgetc(const_cast(file)); - } -private: - /// the file pointer to read from - const FILE * file; -}; - template class wide_string_input_adapter : public input_adapter_protocol { @@ -2353,7 +2358,8 @@ class input_adapter { public: // native support - + input_adapter(FILE* file) + : ia(std::make_shared(file)) {} /// input adapter for input stream input_adapter(std::istream& i) : ia(std::make_shared(i)) {} @@ -2371,9 +2377,6 @@ class input_adapter input_adapter(const std::u32string& ws) : ia(std::make_shared>(ws)) {} - input_adapter(const FILE *file) - : ia(std::make_shared(file)) {} - /// input adapter for buffer template