mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-28 04:08:08 +00:00
Import all this stuff into a single repo called Serenity.
This commit is contained in:
35
VirtualFileSystem/SyntheticFileSystem.h
Normal file
35
VirtualFileSystem/SyntheticFileSystem.h
Normal file
@@ -0,0 +1,35 @@
|
||||
#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;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user