mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-01-24 02:03:06 -05:00
b81f6f2c43
TextDocument was not the right name, and got even more confusing with the addition of GTextDocument in LibGUI.
37 lines
836 B
C++
37 lines
836 B
C++
#pragma once
|
|
|
|
#include "ProjectFile.h"
|
|
#include <AK/Noncopyable.h>
|
|
#include <AK/NonnullRefPtrVector.h>
|
|
#include <AK/OwnPtr.h>
|
|
#include <LibGUI/GModel.h>
|
|
|
|
class Project {
|
|
AK_MAKE_NONCOPYABLE(Project)
|
|
AK_MAKE_NONMOVABLE(Project)
|
|
public:
|
|
static OwnPtr<Project> load_from_file(const String& path);
|
|
|
|
[[nodiscard]] bool add_file(const String& filename);
|
|
|
|
ProjectFile* get_file(const String& filename);
|
|
|
|
GModel& model() { return *m_model; }
|
|
|
|
template<typename Callback>
|
|
void for_each_text_file(Callback callback) const
|
|
{
|
|
for (auto& file : m_files) {
|
|
callback(file);
|
|
}
|
|
}
|
|
|
|
|
|
private:
|
|
friend class ProjectModel;
|
|
explicit Project(const String& path, Vector<String>&& files);
|
|
|
|
String m_path;
|
|
RefPtr<GModel> m_model;
|
|
NonnullRefPtrVector<ProjectFile> m_files;
|
|
};
|