2013-06-30 11:46:29 +03:00
|
|
|
#pragma once
|
2014-02-16 17:19:06 +02:00
|
|
|
#include "vfsStream.h"
|
2013-06-30 11:46:29 +03:00
|
|
|
|
2015-04-19 16:19:24 +03:00
|
|
|
enum vfsOpenMode : u32
|
2014-02-16 17:19:06 +02:00
|
|
|
{
|
2015-04-19 16:19:24 +03:00
|
|
|
vfsRead = o_read,
|
|
|
|
|
vfsReadWrite = o_read | o_write,
|
|
|
|
|
vfsWriteNew = o_write | o_create | o_trunc,
|
|
|
|
|
vfsWriteExcl = o_write | o_create | o_excl,
|
2014-02-16 17:19:06 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
class vfsDevice;
|
|
|
|
|
|
|
|
|
|
struct vfsFileBase : public vfsStream
|
2013-06-30 11:46:29 +03:00
|
|
|
{
|
|
|
|
|
protected:
|
2014-04-01 02:33:55 +02:00
|
|
|
std::string m_path;
|
2015-04-19 16:19:24 +03:00
|
|
|
u32 m_mode;
|
2014-02-16 17:19:06 +02:00
|
|
|
vfsDevice* m_device;
|
2013-06-30 11:46:29 +03:00
|
|
|
|
|
|
|
|
public:
|
2014-02-16 17:19:06 +02:00
|
|
|
vfsFileBase(vfsDevice* device);
|
2015-04-20 01:26:28 +03:00
|
|
|
virtual ~vfsFileBase() override;
|
2013-06-30 11:46:29 +03:00
|
|
|
|
2015-04-19 16:19:24 +03:00
|
|
|
virtual bool Open(const std::string& path, u32 mode);
|
2013-09-25 00:11:29 +03:00
|
|
|
virtual bool Close() override;
|
2014-04-01 02:33:55 +02:00
|
|
|
virtual bool Exists(const std::string& path) { return false; }
|
|
|
|
|
virtual bool Rename(const std::string& from, const std::string& to) { return false; }
|
|
|
|
|
virtual bool Remove(const std::string& path) { return false; }
|
2015-04-20 01:26:28 +03:00
|
|
|
virtual bool IsOpened() const override { return !m_path.empty(); }
|
2014-02-16 17:19:06 +02:00
|
|
|
|
2014-04-01 02:33:55 +02:00
|
|
|
std::string GetPath() const;
|
2015-04-19 16:19:24 +03:00
|
|
|
u32 GetOpenMode() const;
|
2013-08-03 12:40:03 +03:00
|
|
|
};
|