AuroraRuntime/Source/IO/AuIOHandle.hpp
Jamie Reece Wilson 38bf52e852 [+] Aurora::IO::FS::IMemoryMappedFile
[+] Aurora::IO::Adapters::NewMemoryViewWriteSeekableAdapter
[*] ViewSeekableReadable -> ViewSeekableReader
[+] Aurora::IO::FS::OpenMap
[+] Aurora::IO::FS::OpenMapFromSharedHandle
2024-03-07 06:49:23 +00:00

108 lines
3.1 KiB
C++

/***
Copyright (C) 2023 J Reece Wilson (a/k/a "Reece"). All rights reserved.
File: AuIOHandle.hpp
Date: 2023-7-28
Author: Reece
***/
#pragma once
namespace Aurora::IO::IPC
{
struct IPCPipeImpl;
}
namespace Aurora::IO
{
struct AFileHandle : IIOHandle
{
~AFileHandle();
bool InitFromHandle(AuSPtr<IIOHandle> pHandle) override;
bool InitFromCopy(AuUInt64 uOSHandle) override;
bool InitFromMove(AuUInt64 uOSHandle) override;
bool InitFromPair(AuOptionalEx<AuUInt64> uOSReadHandle,
AuOptionalEx<AuUInt64> uOSWriteHandle) override;
bool InitFromPairMove(AuOptionalEx<AuUInt64> uOSReadHandle,
AuOptionalEx<AuUInt64> uOSWriteHandle) override;
bool InitFromStreamEnum(EStandardStream eStream) override;
bool InitFromSharing(const AuString &handle) override;
bool InitFromPath(HandleCreate create) override;
AuUInt64 GetOSHandle() const override;
AuOptionalEx<AuUInt64> GetOSHandleSafe() const override;
AuUInt64 GetOSReadHandle() const override;
AuOptionalEx<AuUInt64> GetOSReadHandleSafe() const override;
AuUInt64 GetOSWriteHandle() const override;
AuOptionalEx<AuUInt64> GetOSWriteHandleSafe() const override;
bool IsValid() const override;
bool HasUniqueWriteHandle()const override;
bool IsAsync() const override;
AuString GetPath() const override;
bool IsFile() const override;
bool IsTTY() const override;
bool IsPipe() const override;
bool IsFlushOnClose() const override;
void SetFlushOnClose(bool bFlushOnClose) override;
void InitStdIn(bool bSharing = false);
void InitStdOut(bool bError = false, bool bSharing = false);
bool SectionLock(AuUInt64 uOffset,
AuUInt64 uLength,
FS::EFileAdvisoryLockLevel level) override;
bool SectionUnlock(AuUInt64 uOffset,
AuUInt64 uLength) override;
AuString SharingGetString() override;
bool SharingIsShared() override;
void SharingStop() override;
AuUInt64 GetFileLength() override;
AuOptionalEx<AuUInt64> uOSWriteHandle;
AuOptionalEx<AuUInt64> uOSReadHandle;
AuSPtr<IIOHandle> pThat;
bool bIsAsync {}, bFlushOnClose {};
AuString path;
IPC::IPCPipeImpl *pIPCPipe {};
bool bDirectIO {};
mutable AuOptional<bool> optIsFile;
mutable AuOptional<bool> optIsPipe;
mutable AuOptional<bool> optIsTTY;
mutable AuSPtr<AuString> pIPCString;
protected:
// Implement me:
// bool InitFromPath(HandleCreate create) override;
static AuUInt64 DupHandle(AuUInt64 uOSHandle, bool bWriteAccess);
static AuUInt64 DupHandle(AuUInt64 uOSHandle, bool bWriteAccess, bool bShareAccess);
static void CloseHandle(AuUInt64 uOSHandle, bool bFlushOnClose);
inline void CloseHandle(AuUInt64 uOSHandle)
{
CloseHandle(uOSHandle, this->bFlushOnClose);
}
};
}