mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2024-12-29 03:19:44 +00:00
25 lines
502 B
C++
25 lines
502 B
C++
|
#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
|
||
|
{
|
||
|
public:
|
||
|
explicit StreamWithBuffer(std::unique_ptr<Buffer>&& buffer)
|
||
|
: std::istream(buffer.get())
|
||
|
, mBuffer(std::move(buffer))
|
||
|
{
|
||
|
}
|
||
|
|
||
|
private:
|
||
|
std::unique_ptr<Buffer> mBuffer;
|
||
|
};
|
||
|
}
|
||
|
|
||
|
#endif
|