summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibCodeComprehension/FileDB.h
blob: 36e1a6efcf4d9ab3b1e880ba866a53d491454010 (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
32
33
/*
 * Copyright (c) 2022, Itamar S. <itamar8910@gmail.com>
 *
 * SPDX-License-Identifier: BSD-2-Clause
 */

#pragma once

#include <AK/String.h>
#include <AK/StringView.h>

namespace CodeComprehension {

class FileDB {
    AK_MAKE_NONCOPYABLE(FileDB);
    AK_MAKE_NONMOVABLE(FileDB);

public:
    virtual ~FileDB() = default;

    virtual Optional<String> get_or_read_from_filesystem(StringView filename) const = 0;
    void set_project_root(StringView project_root) { m_project_root = project_root; }
    String const& project_root() const { return m_project_root; }
    String to_absolute_path(StringView filename) const;

protected:
    FileDB() = default;

private:
    String m_project_root;
};

}