This commit is contained in:
jeanlemotan
2024-07-02 18:12:23 +02:00
commit b344afa9fe
89 changed files with 10568 additions and 0 deletions
+49
View File
@@ -0,0 +1,49 @@
#pragma once
#include "tl/ptr.h"
#include "fs/IMapSource.h"
#include "fs/AbsPath.h"
#include "fs/Api.h"
namespace fs
{
class NativeFilesystem;
class FS_API FileMapSource final : public IMapSource
{
friend class NativeFilesystem;
public:
explicit FileMapSource(const AbsPath& filepath);
FileMapSource(const AbsPath& filepath, uint64_t start, size_t size);
~FileMapSource() override;
bool isValid() const;
tl::optional<Error> getLastError() const override;
size_t read(tl::span<uint8_t> data) override;
void seekBeg(uint64_t offset) override;
void seekRel(int64_t offset) override;
uint64_t tell() const override;
uint64_t getSize() const override;
tl::span<const uint8_t> map(size_t size) override;
bool isEOS() const override;
size_t getPreferredBufferSize() const override;
private:
uint64_t m_offset = 0;
mutable tl::optional<Error> m_optLastError;
struct Impl;
tl::unique_ptr<Impl> m_impl;
};
}