2024-02-05 22:25:30 -08:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "ehs/EHS.h"
|
|
|
|
#include "ehs/Str.h"
|
|
|
|
#include "ehs/UTF.h"
|
|
|
|
#include "ehs/Vector.h"
|
|
|
|
#include "ehs/Array.h"
|
|
|
|
#include "ehs/Serializer.h"
|
|
|
|
#include "BaseFile.h"
|
|
|
|
|
|
|
|
namespace ehs
|
|
|
|
{
|
2024-07-24 01:36:20 -07:00
|
|
|
class EHS_LIB_IO File : public BaseFile
|
2024-02-05 22:25:30 -08:00
|
|
|
{
|
|
|
|
private:
|
|
|
|
HANDLE hdl;
|
|
|
|
HANDLE map;
|
|
|
|
Byte* view;
|
|
|
|
UInt_64 viewSize;
|
|
|
|
|
|
|
|
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);
|
|
|
|
};
|
|
|
|
}
|