/* SPDX-License-Identifier: BSL-1.0 OR BSD-3-Clause */ #ifndef MPT_IO_READ_FILECURSOR_STDSTREAM_HPP #define MPT_IO_READ_FILECURSOR_STDSTREAM_HPP #include "mpt/base/namespace.hpp" #include "mpt/io_read/filecursor.hpp" #include "mpt/io_read/filecursor_traits_filedata.hpp" #include "mpt/io_read/filecursor_filename_traits.hpp" #include "mpt/io_read/filedata_stdstream.hpp" #include #include #include namespace mpt { inline namespace MPT_INLINE_NS { namespace IO { // Initialize file reader object with a std::istream. template inline FileCursor> make_FileCursor(std::istream & s, std::shared_ptr filename = nullptr) { if (FileDataStdStream::IsSeekable(s)) { return FileCursor>(std::static_pointer_cast(std::make_shared(s)), std::move(filename)); } else { return FileCursor>(std::static_pointer_cast(std::make_shared(s)), std::move(filename)); } } } // namespace IO } // namespace MPT_INLINE_NS } // namespace mpt #endif // MPT_IO_READ_FILECURSOR_STDSTREAM_HPP