FileDB.h 703 B

123456789101112131415161718192021222324252627282930313233
  1. /*
  2. * Copyright (c) 2022, Itamar S. <itamar8910@gmail.com>
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #pragma once
  7. #include <AK/String.h>
  8. #include <AK/StringView.h>
  9. namespace CodeComprehension {
  10. class FileDB {
  11. AK_MAKE_NONCOPYABLE(FileDB);
  12. AK_MAKE_NONMOVABLE(FileDB);
  13. public:
  14. virtual ~FileDB() = default;
  15. virtual Optional<String> get_or_read_from_filesystem(StringView filename) const = 0;
  16. void set_project_root(StringView project_root) { m_project_root = project_root; }
  17. String const& project_root() const { return m_project_root; }
  18. String to_absolute_path(StringView filename) const;
  19. protected:
  20. FileDB() = default;
  21. private:
  22. String m_project_root;
  23. };
  24. }