AuroraRuntime/Include/Aurora/IO/FS/IFileStream.hpp

72 lines
1.8 KiB
C++

/***
Copyright (C) 2021 J Reece Wilson (a/k/a "Reece"). All rights reserved.
File: IFileStream.hpp
Date: 2022-01-17 (wrong)
Author: Reece
***/
#pragma once
namespace Aurora::IO::FS
{
struct IFileStream
{
/**
* @brief Read memoryview from the filestream at an auto-incrementing offset
* @param parameters
* @return
*/
virtual bool Read(const Memory::MemoryViewStreamWrite &parameters) = 0;
/**
* @brief Writes memoryview to the filestream at an auto-incrementing offset
* @param parameters
* @return
*/
virtual bool Write(const Memory::MemoryViewStreamRead &parameters) = 0;
/**
* @brief Returns the length of the file
* @return
*/
virtual AuUInt64 GetLength() = 0;
/**
* @brief Returns the offset of the internal streams
* @return
*/
virtual AuUInt64 GetOffset() = 0;
/**
* @brief Updates the stream pointer
* @param offset
* @return
*/
virtual bool SetOffset(AuUInt64 offset) = 0;
/**
* @brief Flush read/write streams
*/
virtual void Flush() = 0;
/**
* @brief Termiantes/truncates the file at the current offset
*/
virtual void WriteEoS() = 0;
/**
* @brief Close IFileStream resource
*/
virtual void Close() = 0;
/**
* @brief Indicates that the file should automatically be deleted upon destruction of the stream
*/
virtual void MakeTemporary() = 0;
/**
* @brief Returns the IO handle backing the file stream, if available.
*/
virtual AuSPtr<IIOHandle> GetHandle() = 0;
};
}