2016-01-07 08:14:33 +00:00
|
|
|
#pragma once
|
2012-01-15 08:29:57 +00:00
|
|
|
|
|
|
|
namespace nall {
|
|
|
|
|
|
|
|
#define autostream(...) (*makestream(__VA_ARGS__))
|
|
|
|
|
2015-12-14 09:41:06 +00:00
|
|
|
inline auto makestream(const string& path) -> std::unique_ptr<stream> {
|
2013-12-03 10:01:59 +00:00
|
|
|
if(path.iendsWith(".gz")) return std::unique_ptr<stream>(new gzipstream(filestream{path}));
|
|
|
|
if(path.iendsWith(".zip")) return std::unique_ptr<stream>(new zipstream(filestream{path}));
|
2012-01-15 08:29:57 +00:00
|
|
|
return std::unique_ptr<stream>(new mmapstream(path));
|
|
|
|
}
|
|
|
|
|
2015-12-14 09:41:06 +00:00
|
|
|
inline auto makestream(uint8* data, uint size) -> std::unique_ptr<stream> {
|
2012-01-15 08:29:57 +00:00
|
|
|
return std::unique_ptr<stream>(new memorystream(data, size));
|
|
|
|
}
|
|
|
|
|
2015-12-14 09:41:06 +00:00
|
|
|
inline auto makestream(const uint8* data, uint size) -> std::unique_ptr<stream> {
|
2012-01-15 08:29:57 +00:00
|
|
|
return std::unique_ptr<stream>(new memorystream(data, size));
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|