aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/file_sys/vfs_cached.h
blob: 1e53007842b4ef9060e3f7defe0923104b8415cc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
// SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later

#pragma once

#include <string_view>
#include <vector>
#include "core/file_sys/vfs.h"

namespace FileSys {

class CachedVfsDirectory : public ReadOnlyVfsDirectory {
public:
    CachedVfsDirectory(VirtualDir&& source_directory);

    ~CachedVfsDirectory() override;
    VirtualFile GetFile(std::string_view file_name) const override;
    VirtualDir GetSubdirectory(std::string_view dir_name) const override;
    std::vector<VirtualFile> GetFiles() const override;
    std::vector<VirtualDir> GetSubdirectories() const override;
    std::string GetName() const override;
    VirtualDir GetParentDirectory() const override;

private:
    std::string name;
    VirtualDir parent;
    std::map<std::string, VirtualDir, std::less<>> dirs;
    std::map<std::string, VirtualFile, std::less<>> files;
};

} // namespace FileSys