1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-01-19 22:53:53 +00:00
openmw/components/files/streamwithbuffer.hpp

25 lines
502 B
C++
Raw Normal View History

#ifndef OPENMW_COMPONENTS_FILES_STREAMWITHBUFFER_H
#define OPENMW_COMPONENTS_FILES_STREAMWITHBUFFER_H
#include <istream>
#include <memory>
namespace Files
{
template <class Buffer>
class StreamWithBuffer final : public std::istream
{
2022-09-22 18:26:05 +00:00
public:
explicit StreamWithBuffer(std::unique_ptr<Buffer>&& buffer)
: std::istream(buffer.get())
, mBuffer(std::move(buffer))
{
}
2022-09-22 18:26:05 +00:00
private:
std::unique_ptr<Buffer> mBuffer;
};
}
#endif