Debian Codegraph @

src/mpt/io_read/filecursor_memory.hpp

raw
1 /* SPDX-License-Identifier: BSL-1.0 OR BSD-3-Clause */
2
3 #ifndef MPT_IO_READ_FILECURSOR_MEMORY_HPP
4 #define MPT_IO_READ_FILECURSOR_MEMORY_HPP
5
6
7
8 #include "mpt/base/namespace.hpp"
9 #include "mpt/base/span.hpp"
10 #include "mpt/io_read/filecursor.hpp"
11 #include "mpt/io_read/filecursor_filename_traits.hpp"
12 #include "mpt/io_read/filecursor_traits_filedata.hpp"
13
14 #include <memory>
15 #include <utility>
16
17
18
19 namespace mpt {
20 inline namespace MPT_INLINE_NS {
21
22
23
24 namespace IO {
25
26
27
28 // Initialize file reader object with pointer to data and data length.
29 template <typename Tpath, typename Tbyte>
30 inline FileCursor<FileCursorTraitsFileData, FileCursorFilenameTraits<Tpath>> make_FileCursor(mpt::span<Tbyte> bytedata, std::shared_ptr<Tpath> filename = nullptr) {
31 return FileCursor<FileCursorTraitsFileData, FileCursorFilenameTraits<Tpath>>(mpt::byte_cast<mpt::const_byte_span>(bytedata), std::move(filename));
32 }
33
34
35
36 } // namespace IO
37
38
39
40 } // namespace MPT_INLINE_NS
41 } // namespace mpt
42
43
44
45 #endif // MPT_IO_READ_FILECURSOR_STDSTREAM_HPP