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() {}
|
2016-01-25 05:55:31 +00:00
|
|
|
virtual bool exists()=0;
|
2015-06-30 19:38:51 +00:00
|
|
|
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;
|
2015-06-30 19:38:51 +00:00
|
|
|
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-22 02:30:17 +00:00
|
|
|
virtual std::unique_ptr<IWriteStream> beginWriteStream(uint64_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() {}
|
2016-01-25 05:55:31 +00:00
|
|
|
virtual void seek(int64_t offset, int whence)=0;
|
2016-01-26 02:01:55 +00:00
|
|
|
virtual int64_t position()=0;
|
2015-06-30 19:38:51 +00:00
|
|
|
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-22 02:30:17 +00:00
|
|
|
virtual std::unique_ptr<IReadStream> beginReadStream(uint64_t offset) const=0;
|
2015-06-26 19:30:03 +00:00
|
|
|
};
|
|
|
|
|
2016-02-02 21:18:16 +00:00
|
|
|
std::unique_ptr<IFileIO> NewFileIO(const SystemString& path, int64_t maxWriteSize=-1);
|
|
|
|
std::unique_ptr<IFileIO> NewFileIO(const SystemChar* path, int64_t maxWriteSize=-1);
|
2015-06-30 06:46:19 +00:00
|
|
|
|
2015-06-26 19:30:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif // __NOD_IFILE_IO__
|