nod/include/NOD/IFileIO.hpp

44 lines
1.2 KiB
C++
Raw Normal View History

2015-06-26 19:30:03 +00:00
#ifndef __NOD_IFILE_IO__
#define __NOD_IFILE_IO__
#include <memory>
#include <stdlib.h>
#include "IDiscIO.hpp"
2015-07-02 18:33:55 +00:00
#include "Util.hpp"
2015-06-26 19:30:03 +00:00
namespace NOD
{
class IFileIO
{
public:
virtual ~IFileIO() {}
virtual uint64_t size()=0;
2015-06-26 19:30:03 +00:00
2015-06-28 05:43:53 +00:00
struct IWriteStream
2015-06-26 19:30:03 +00:00
{
virtual ~IWriteStream() {}
2016-01-21 06:30:37 +00:00
virtual uint64_t write(const void* buf, uint64_t length)=0;
virtual uint64_t copyFromDisc(struct IPartReadStream& discio, uint64_t length)=0;
2015-06-26 19:30:03 +00:00
};
2015-06-30 06:46:19 +00:00
virtual std::unique_ptr<IWriteStream> beginWriteStream() const=0;
2016-01-21 06:30:37 +00:00
virtual std::unique_ptr<IWriteStream> beginWriteStream(size_t offset) const=0;
2015-06-26 19:30:03 +00:00
2015-06-28 05:43:53 +00:00
struct IReadStream
2015-06-26 19:30:03 +00:00
{
virtual ~IReadStream() {}
virtual uint64_t read(void* buf, uint64_t length)=0;
virtual uint64_t copyToDisc(struct IPartWriteStream& discio, uint64_t length)=0;
2015-06-26 19:30:03 +00:00
};
2015-06-30 06:46:19 +00:00
virtual std::unique_ptr<IReadStream> beginReadStream() const=0;
2016-01-21 06:30:37 +00:00
virtual std::unique_ptr<IReadStream> beginReadStream(size_t offset) const=0;
2015-06-26 19:30:03 +00:00
};
2015-07-02 18:33:55 +00:00
std::unique_ptr<IFileIO> NewFileIO(const SystemString& path);
2016-01-21 06:30:37 +00:00
std::unique_ptr<IFileIO> NewFileIO(const SystemChar* path);
std::unique_ptr<IFileIO> NewMemIO(void* buf, uint64_t size);
2015-06-30 06:46:19 +00:00
2015-06-26 19:30:03 +00:00
}
#endif // __NOD_IFILE_IO__