| 14862 | /// output adapter for output streams |
| 14863 | template<typename CharType> |
| 14864 | class output_stream_adapter : public output_adapter_protocol<CharType> |
| 14865 | { |
| 14866 | public: |
| 14867 | explicit output_stream_adapter(std::basic_ostream<CharType>& s) noexcept |
| 14868 | : stream(s) |
| 14869 | {} |
| 14870 | |
| 14871 | void write_character(CharType c) override |
| 14872 | { |
| 14873 | stream.put(c); |
| 14874 | } |
| 14875 | |
| 14876 | JSON_HEDLEY_NON_NULL(2) |
| 14877 | void write_characters(const CharType* s, std::size_t length) override |
| 14878 | { |
| 14879 | stream.write(s, static_cast<std::streamsize>(length)); |
| 14880 | } |
| 14881 | |
| 14882 | private: |
| 14883 | std::basic_ostream<CharType>& stream; |
| 14884 | }; |
| 14885 | #endif // JSON_NO_IO |
| 14886 | |
| 14887 | /// output adapter for basic_string |