summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibCodeComprehension/FileDB.h
blob: 19495ae86ad50fab6d7d5a58a2a0934253896e1e (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/DeprecatedString.h>
#include <AK/StringView.h>

namespace CodeComprehension {

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

public:
    virtual ~FileDB() = default;

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

protected:
    FileDB() = default;

private:
    DeprecatedString m_project_root;
};

}