Jamie Reece Wilson
ac0981ac1b
[+] bool IsHandleTTY(AuUInt uHandle) [+] bool IsHandlePipe(AuUInt uHandle) ...as opposed to forced IOHandle usage [+] AuIOHandle [+] AuSharedIOHandle
76 lines
1.9 KiB
C++
76 lines
1.9 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
|
|
{
|
|
virtual ~AFileHandle();
|
|
|
|
bool InitFromHandle(AuSPtr<IIOHandle> pHandle) override;
|
|
|
|
bool InitFromCopy(AuUInt64 uOSHandle) override;
|
|
|
|
bool InitFromMove(AuUInt64 uOSHandle) override;
|
|
|
|
bool InitFromPair(AuUInt64 uOSReadHandle,
|
|
AuUInt64 uOSWriteHandle) override;
|
|
|
|
bool InitFromPairMove(AuOptionalEx<AuUInt64> uOSReadHandle,
|
|
AuOptionalEx<AuUInt64> uOSWriteHandle) override;
|
|
|
|
AuUInt64 GetOSHandle() override;
|
|
|
|
AuOptionalEx<AuUInt64> GetOSHandleSafe() override;
|
|
|
|
AuUInt64 GetOSReadHandle() override;
|
|
|
|
AuOptionalEx<AuUInt64> GetOSReadHandleSafe() override;
|
|
|
|
AuUInt64 GetOSWriteHandle() override;
|
|
|
|
AuOptionalEx<AuUInt64> GetOSWriteHandleSafe() override;
|
|
|
|
bool IsValid() override;
|
|
|
|
bool HasUniqueWriteHandle() override;
|
|
|
|
bool IsAsync() override;
|
|
|
|
AuString GetPath() override;
|
|
|
|
bool IsFile() override;
|
|
bool IsTTY() override;
|
|
bool IsPipe() override;
|
|
|
|
AuOptionalEx<AuUInt64> uOSWriteHandle;
|
|
AuOptionalEx<AuUInt64> uOSReadHandle;
|
|
AuSPtr<IIOHandle> pThat;
|
|
bool bIsAsync {};
|
|
AuString path;
|
|
IPC::IPCPipeImpl *pIPCPipe {};
|
|
bool bDirectIO {};
|
|
AuOptionalEx<bool> optIsFile;
|
|
AuOptionalEx<bool> optIsPipe;
|
|
AuOptionalEx<bool> optIsTTY;
|
|
|
|
protected:
|
|
// Implement me:
|
|
|
|
// bool InitFromPath(HandleCreate create) override;
|
|
|
|
static AuUInt64 DupHandle(AuUInt64 uOSHandle, bool bWriteAccess);
|
|
static void CloseHandle(AuUInt64 uOSHandle);
|
|
};
|
|
} |