mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 15:40:19 +00:00
35 lines
1.1 KiB
C++
35 lines
1.1 KiB
C++
#pragma once
|
|
|
|
#include "FileSystem.h"
|
|
#include <AK/HashMap.h>
|
|
|
|
class SyntheticFileSystem final : public FileSystem {
|
|
public:
|
|
virtual ~SyntheticFileSystem() override;
|
|
static RetainPtr<SyntheticFileSystem> create();
|
|
|
|
virtual bool initialize() override;
|
|
virtual const char* className() const override;
|
|
virtual InodeIdentifier rootInode() const override;
|
|
virtual ByteBuffer readInode(InodeIdentifier) const override;
|
|
virtual bool writeInode(InodeIdentifier, const ByteBuffer&) override;
|
|
virtual bool enumerateDirectoryInode(InodeIdentifier, std::function<bool(const DirectoryEntry&)>) const override;
|
|
virtual InodeMetadata inodeMetadata(InodeIdentifier) const override;
|
|
virtual bool setModificationTime(InodeIdentifier, dword timestamp) override;
|
|
virtual InodeIdentifier createInode(InodeIdentifier parentInode, const String& name, word mode) override;
|
|
|
|
private:
|
|
SyntheticFileSystem();
|
|
|
|
struct File {
|
|
String name;
|
|
InodeMetadata metadata;
|
|
ByteBuffer data;
|
|
};
|
|
|
|
OwnPtr<File> createTextFile(String&& name, String&& text);
|
|
void addFile(OwnPtr<File>&&);
|
|
|
|
Vector<OwnPtr<File>> m_files;
|
|
};
|
|
|