11#ifndef INCGUARD_MGL_FILE_DELEGATE_POSIX_H_1611110145
12#define INCGUARD_MGL_FILE_DELEGATE_POSIX_H_1611110145
15#if defined(MGL_FILE_DELEGATE_ENABLE_POSIX)
24class POSIXDelegate :
public Delegate
37 [[nodiscard]]
bool IsManagedSystemNativeFile() const noexcept
override
49 [[nodiscard]]
bool IsWritable() const noexcept
override
63 Result Mount([[maybe_unused]] SharedMountWork &mountWork, [[maybe_unused]]
const PathView &path, [[maybe_unused]] MountAccessType accessType)
noexcept override
65 return Result::Succeeded();
74 void Unmount([[maybe_unused]] SharedMountWork &mountWork)
noexcept override
78 AccessWorkPtr Open(Result &result, SharedMountWork &mountWork,
const PathView &path, OpenMode mode)
noexcept override;
80 size_t Read(AccessWork *work, Result &result,
void *buffer,
size_t size)
noexcept override;
81 size_t Write(AccessWork *work, Result &result,
const void *buffer,
size_t size)
noexcept override;
82 size_t Seek(AccessWork *work, Result &result, SeekType seekType, int32_t offset)
noexcept override;
83 size_t GetOffset(AccessWork *work, Result &result)
const noexcept override;
84 bool IsEOF(AccessWork *work, Result &result)
const noexcept override;
85 size_t GetSize(AccessWork *work, Result &result)
const noexcept override;
86 size_t GetSize(MountWork *mountWork, Result &result,
const PathView &path)
const noexcept override;
88 Result Move(MountWork *mountWork,
const PathView &sourcePath,
const PathView &destPath)
noexcept override;
89 Result Remove(MountWork *mountWork,
const PathView &path)
noexcept override;
90 bool Exists(MountWork *mountWork, Result &result,
const PathView &path)
noexcept override;
93 struct POSIXWork :
public AccessWork
99 POSIXWork(OpenMode mode) noexcept
100 : AccessWork(mode, kDelegateKey)
106 static POSIXWork *GetWork(AccessWork *work, OpenMode mode = OpenMode::None)
noexcept;
107 [[nodiscard]]
static const char *GetModeString(OpenMode mode)
noexcept;
108 [[nodiscard]]
static Error GetError(
int errorNumber)
noexcept;
STL::unique_ptr< AccessWork > AccessWorkPtr
ファイルアクセスのためのワークのポインタ型
Definition mgl_file_access_work.h:130
Result Close(AccessWorkPtr &work) noexcept
ファイルをクローズ
Definition mgl_file_accessor.cc:138
size_t GetOffset(AccessWorkPtr &work, Result &result) noexcept
ストリーム位置を取得
Definition mgl_file_accessor.cc:300
Result MakeDirectory(const PathView &path) noexcept
ディレクトリを作成する
Definition mgl_file_accessor.cc:439
AccessWorkPtr Open(Result &result, const PathView &path, OpenMode mode) noexcept
ファイルをオープン
Definition mgl_file_accessor.cc:94
Result Remove(const PathView &path) noexcept
ファイルの削除
Definition mgl_file_accessor.cc:510
size_t Seek(AccessWorkPtr &work, Result &result, SeekType seekType, int32_t offset) noexcept
ストリーム位置を設定
Definition mgl_file_accessor.cc:257
size_t Read(AccessWorkPtr &work, Result &result, void *buffer, size_t size) noexcept
ファイルを読み込み
Definition mgl_file_accessor.cc:181
Result Unmount(const PathView &mountName) noexcept
マウント解除
Definition mgl_file_accessor.cc:678
size_t GetSize(AccessWorkPtr &work, Result &result) noexcept
オープンしているファイルのサイズを取得
Definition mgl_file_accessor.cc:374
Result Mount(const PathView &mountName, const PathView &path, MountAccessType accessType, DelegateKey delegateKey=Mounter::kDefaultDelegateKey) noexcept
マウント
Definition mgl_file_accessor.cc:658
bool IsEOF(AccessWorkPtr &work, Result &result) noexcept
ファイルストリームが終端に達しているかを取得
Definition mgl_file_accessor.cc:338
size_t Write(AccessWorkPtr &work, Result &result, const void *buffer, size_t size) noexcept
ファイルに書き込み
Definition mgl_file_accessor.cc:219
Result Move(const PathView &sourcePath, const PathView &destPath) noexcept
ファイルの移動・リネーム
Definition mgl_file_accessor.cc:463
bool Exists(Result &result, const PathView &path) noexcept
ファイルの存在をチェック
Definition mgl_file_accessor.cc:598
DelegateKey
デリゲートキーの型
Definition mgl_file_defs.h:23
Error
エラー定義
Definition mgl_file_defs.h:71
MGL::ResultWrapper< Error, Error::None, Error::NoOperation > Result
ファイル関連の処理結果
Definition mgl_file_defs.h:106
constexpr DelegateKey MakeDelegateKey(const char *keyString, uint32_t seed=kDefaultDelegateKeySeed) noexcept
デリゲートキーの生成
Definition mgl_file_defs.h:36