AuroraRuntime/Source/IO/FS/FileStream.NT.hpp
Jamie Reece Wilson 232a136bfe [+] IOHandle::IsWriteEoSOnClose
[+] IOHandle::SetWriteEoSOnClose
[+] IOHandle::HandleCreate::bFlushOnClose
[+] IOHandle::HandleCreate::bWriteEoSOnClose
[*] Unified grug based auto-truncating. Previously we were truncating on the final derefing thread; now, we truncate on the grug thread.
[*] Refactor/Cleanup IOHandle
2024-03-27 03:15:01 +00:00

53 lines
1.7 KiB
C++

/***
Copyright (C) 2021 J Reece Wilson (a/k/a "Reece"). All rights reserved.
File: FileStream.NT.hpp
Date: 2021-6-12
Author: Reece
***/
#pragma once
#if !defined(_AURUNTIME_GENERICFILESTREAM)
namespace Aurora::IO::FS
{
struct WinFileStream : IFileStream
{
WinFileStream();
~WinFileStream();
void Init(AuSPtr<IIOHandle> pHandle);
AuUInt64 GetOffset() override;
bool SetOffset(AuUInt64 offset) override;
AuUInt64 GetLength() override;
bool Read(const Memory::MemoryViewStreamWrite &parameters) override;
bool Write(const Memory::MemoryViewStreamRead & parameters) override;
void Close() override;
void Flush() override;
void WriteEoS() override;
void MakeTemporary() override;
AuSPtr<IIOHandle> GetHandle() override;
bool IsFlushOnClose() const override;
void SetFlushOnClose(bool bFlushOnClose) override;
bool IsWriteEoSOnClose() const override;
void SetWriteEoSOnClose(bool bFlushOnClose) override;
IO::IStreamReader *ToStreamReader() override;
IO::IStreamWriter *ToStreamWriter() override;
IO::ISeekingReader *ToStreamSeekingReader() override;
IO::ISeekingWriter *ToStreamSeekingWriter() override;
HANDLE GetWin32Handle(bool bReadOnly = false);
private:
AuSPtr<IIOHandle> pHandle_;
bool bShouldDelete {};
HANDLE hEventHandle_ { INVALID_HANDLE_VALUE };
AuFS::FileReader reader_;
AuFS::FileWriter writer_;
AuFS::FileSeekableReader sreader_;
AuFS::FileSeekableWriter swriter_;
AuMutex mutex_;
};
}
#endif