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
+42
View File
@@ -0,0 +1,42 @@
#pragma once
#include "tl/ptr.h"
#include "fs/IMapSink.h"
#include "fs/AbsPath.h"
#include "tl/flag_set2.h"
#include "fs/Mode.h"
#include "fs/Api.h"
namespace fs
{
class NativeFilesystem;
class FS_API FileMapSink final : public IMapSink
{
friend class NativeFilesystem;
public:
FileMapSink(const AbsPath& filepath, size_t size, Mode mode = Mode::CreateOrOpenAndClear, Flags flags = Flags());
~FileMapSink() override;
bool isValid() const;
tl::optional<Error> getLastError() const override;
size_t write(tl::span<const 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<uint8_t> map(size_t size) 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;
};
}