Play-/Source/iop/Ioman_Device.h

51 lines
1.3 KiB
C
Raw Permalink Normal View History

2018-08-26 20:22:38 -04:00
#pragma once
#include "Stream.h"
2023-01-05 20:07:15 -05:00
#include "Ioman_Defs.h"
#include "Ioman_DirectoryIterator.h"
2022-02-25 17:43:25 -05:00
#include "filesystem_def.h"
namespace Iop
{
namespace Ioman
{
class CDevice
{
public:
enum OPEN_FLAGS
{
2018-04-30 21:01:23 +01:00
OPEN_FLAG_RDONLY = 0x00000001,
OPEN_FLAG_WRONLY = 0x00000002,
OPEN_FLAG_RDWR = 0x00000003,
OPEN_FLAG_ACCMODE = 0x00000003,
OPEN_FLAG_CREAT = 0x00000200,
2018-05-10 19:19:01 -04:00
OPEN_FLAG_TRUNC = 0x00000400,
2019-08-01 18:09:58 -04:00
OPEN_FLAG_NOWAIT = 0x00008000, //This is probably only used by EE's FIO library
};
2018-08-26 20:22:38 -04:00
virtual ~CDevice() = default;
2018-04-30 21:01:23 +01:00
virtual Framework::CStream* GetFile(uint32, const char*) = 0;
virtual DirectoryIteratorPtr GetDirectory(const char*) = 0;
virtual void MakeDirectory(const char*)
{
throw std::runtime_error("Directory creation not supported.");
}
2023-01-03 21:18:18 -05:00
virtual std::shared_ptr<CDevice> Mount(const char*)
{
throw std::runtime_error("Mounting not supported.");
}
2023-01-05 20:07:15 -05:00
virtual bool TryGetStat(const char*, bool&, STAT&)
{
//Return false to indicate that device doesn't support GetStat.
return false;
}
2024-08-12 18:10:33 -04:00
virtual void Rename(const char*, const char*)
{
throw std::runtime_error("Renaming not supported.");
}
};
2023-01-06 12:26:39 -05:00
2023-01-03 21:18:18 -05:00
typedef std::shared_ptr<CDevice> DevicePtr;
}
}