2015-02-17 12:26:28 +01:00
|
|
|
#include "constrainedfilestream.hpp"
|
|
|
|
|
2015-02-27 19:58:43 +01:00
|
|
|
namespace Files
|
|
|
|
{
|
2022-04-14 17:01:36 +02:00
|
|
|
ConstrainedFileStream::ConstrainedFileStream(std::unique_ptr<ConstrainedFileStreamBuf> buf)
|
2018-09-08 23:04:42 +04:00
|
|
|
: std::istream(buf.get())
|
|
|
|
, mBuf(std::move(buf))
|
2015-02-17 12:26:28 +01:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2022-04-10 17:25:26 +02:00
|
|
|
IStreamPtr openConstrainedFileStream(const std::string& filename, std::size_t start, std::size_t length)
|
2015-02-20 17:57:18 +01:00
|
|
|
{
|
2022-04-10 17:25:26 +02:00
|
|
|
return std::make_shared<ConstrainedFileStream>(std::make_unique<ConstrainedFileStreamBuf>(filename, start, length));
|
2015-02-20 17:57:18 +01:00
|
|
|
}
|
2015-02-17 12:26:28 +01:00
|
|
|
}
|