EHS/include/IO/File_UNX.h
2023-12-17 03:29:08 -08:00

74 lines
1.4 KiB
C++

#pragma once
#include "../EHS.h"
#include "../Str.h"
#include "../UTF.h"
#include "../Vector.h"
#include "../Array.h"
#include "../Serializer.h"
#include "BaseFile.h"
namespace lwe
{
class File : public BaseFile
{
private:
int hdl;
void* map;
UInt_64 mapSize;
public:
~File() override;
File();
File(const Str_8& filePath, const Mode mode, const Disposition disposition);
File(File&& file) noexcept;
File(const File& file);
File& operator=(File&& file) noexcept;
File& operator=(const File& file);
operator const Byte*() const override;
operator Byte*() override;
void Release() override;
bool IsMapped() const override;
UInt_64 MapSize() const override;
void Map(const UInt_64 offset, const UInt_64 size) override;
void Unmap() override;
void FlushMap() override;
UInt_64 Write(const Byte* const data, const UInt_64 size) override;
UInt_64 Read(Byte* const buffer, const UInt_64 size) override;
void Seek(UInt_64 index) override;
void SeekBeginning() override;
void SeekEnd() override;
void Truncate(const UInt_64 size) override;
UInt_64 Size() const override;
bool IsValid() const override;
static void Rename_32(const Str_32& filePath, const Str_32& newName);
static void Rename_16(const Str_16& filePath, const Str_16& newName);
static void Rename_8(const Str_8& filePath, const Str_8& newName);
};
}