[-] OS specific types derived from AFileHandle

This commit is contained in:
Reece Wilson 2023-09-28 11:53:42 +01:00
parent 5555e99488
commit c5ab03cbfc
4 changed files with 16 additions and 36 deletions

View File

@ -93,12 +93,7 @@ namespace Aurora::IO
}
}
struct NTIOHandle final : AFileHandle
{
bool InitFromPath(HandleCreate create) override;
};
bool NTIOHandle::InitFromPath(HandleCreate create)
bool AFileHandle::InitFromPath(HandleCreate create)
{
HANDLE hFileHandle;
@ -367,16 +362,4 @@ namespace Aurora::IO
return dwType == FILE_TYPE_DISK;
}
AUKN_SYM IIOHandle *IOHandleNew()
{
return _new NTIOHandle();
}
AUKN_SYM void IOHandleRelease(IIOHandle *pIOHandle)
{
AuSafeDelete<NTIOHandle *>(pIOHandle);
}
AUROXTL_INTERFACE_SOO_SRC_EX(AURORA_SYMBOL_EXPORT, IOHandle, NTIOHandle)
}

View File

@ -104,12 +104,7 @@ namespace Aurora::IO
this->uOSReadHandle = this->uOSWriteHandle = DupHandle(bError ? STDERR_FILENO : STDOUT_FILENO, true, bSharing);
}
struct UnixIOHandle final : AFileHandle
{
bool InitFromPath(HandleCreate create) override;
};
bool UnixIOHandle::InitFromPath(HandleCreate create)
bool AFileHandle::InitFromPath(HandleCreate create)
{
int iFileDescriptor { -1 };
@ -274,16 +269,4 @@ namespace Aurora::IO
return S_ISREG(st.st_mode);
}
AUKN_SYM IIOHandle *IOHandleNew()
{
return _new UnixIOHandle();
}
AUKN_SYM void IOHandleRelease(IIOHandle *pIOHandle)
{
AuSafeDelete<UnixIOHandle *>(pIOHandle);
}
AUROXTL_INTERFACE_SOO_SRC_EX(AURORA_SYMBOL_EXPORT, IOHandle, UnixIOHandle)
}

View File

@ -286,4 +286,16 @@ namespace Aurora::IO
{
return FS::UnapplyFileSectionLock(AuUnsafeRaiiToShared(this), uOffset, uLength);
}
AUKN_SYM IIOHandle *IOHandleNew()
{
return _new AFileHandle();
}
AUKN_SYM void IOHandleRelease(IIOHandle *pIOHandle)
{
AuSafeDelete<AFileHandle *>(pIOHandle);
}
AUROXTL_INTERFACE_SOO_SRC_EX(AURORA_SYMBOL_EXPORT, IOHandle, AFileHandle)
}

View File

@ -32,6 +32,8 @@ namespace Aurora::IO
bool InitFromStreamEnum(EStandardStream eStream) override;
bool InitFromPath(HandleCreate create) override;
AuUInt64 GetOSHandle() override;
AuOptionalEx<AuUInt64> GetOSHandleSafe() override;