10#ifndef INCGUARD_MGL_FILE_DELEGATE_NSFILE_H_1691390916
11#define INCGUARD_MGL_FILE_DELEGATE_NSFILE_H_1691390916
14#if defined(MGL_FILE_DELEGATE_ENABLE_NSFILE)
21#import <Foundation/NSError.h>
32class NSFileDelegate :
public Delegate
45 virtual bool IsManagedSystemNativeFile() const noexcept
override
57 virtual bool IsWritable() const noexcept
override
71 virtual Result Mount([[maybe_unused]] SharedMountWork &mountWork, [[maybe_unused]]
const PathView &path, [[maybe_unused]] MountAccessType accessType)
noexcept override
73 return Result::Succeeded();
82 virtual void Unmount([[maybe_unused]] SharedMountWork &mountWork)
noexcept override
87 virtual AccessWorkPtr Open(Result &result, SharedMountWork &mountWork,
const PathView &path, OpenMode mode)
noexcept override;
88 virtual Result Close(AccessWork *work)
noexcept override;
89 virtual size_t Read(AccessWork *work, Result &result,
void *buffer,
size_t size)
noexcept override;
90 virtual size_t Write(AccessWork *work, Result &result,
const void *buffer,
size_t size)
noexcept override;
91 virtual size_t Seek(AccessWork *work, Result &result, SeekType seekType, int32_t offset)
noexcept override;
92 virtual size_t GetOffset(AccessWork *work, Result &result)
const noexcept override;
93 virtual bool IsEOF(AccessWork *work, Result &result)
const noexcept override;
94 virtual size_t GetSize(AccessWork *work, Result &result)
const noexcept override;
95 virtual size_t GetSize(MountWork *mountWork, Result &result,
const PathView &path)
const noexcept override;
97 virtual Result Move(MountWork *mountWork,
const PathView &sourcePath,
const PathView &destPath)
noexcept override;
98 virtual Result Remove(MountWork *mountWork,
const PathView &path)
noexcept override;
99 virtual bool Exists(MountWork *mountWork, Result &result,
const PathView &path)
noexcept override;
102 struct NSFileWork :
public AccessWork
108 NSFileWork(OpenMode mode) noexcept
109 : AccessWork(mode, kDelegateKey)
116 NSFileWork *GetWork(AccessWork *work, OpenMode mode = OpenMode::None)
const noexcept;
117 const char *GetModeString(OpenMode mode)
const noexcept;
118 Error GetError(
int errorNumber)
const noexcept;
119 Error GetError(
const NSError *nsError)
const 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