Reviewed-on: #3 Co-authored-by: Persson-dev <sim16.prib@gmail.com> Co-committed-by: Persson-dev <sim16.prib@gmail.com>
34 lines
585 B
C++
34 lines
585 B
C++
#pragma once
|
|
|
|
#include <fstream>
|
|
#include <sp/io/IOInterface.h>
|
|
|
|
namespace sp {
|
|
namespace io {
|
|
|
|
struct FileTag {
|
|
enum OpenMode {
|
|
In = 1,
|
|
Out = 1 << 1,
|
|
};
|
|
};
|
|
|
|
template <>
|
|
class IOInterface<FileTag> {
|
|
private:
|
|
std::unique_ptr<std::ifstream> m_FileInput;
|
|
std::unique_ptr<std::ofstream> m_FileOutput;
|
|
|
|
public:
|
|
IOInterface(const std::string& a_FilePath, unsigned int a_OpenMode);
|
|
IOInterface(IOInterface&& other);
|
|
|
|
DataBuffer Read(std::size_t a_Amount);
|
|
void Write(const sp::DataBuffer& a_Data);
|
|
};
|
|
|
|
using File = IOInterface<FileTag>;
|
|
|
|
} // namespace io
|
|
} // namespace sp
|