summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorItamar <itamar8910@gmail.com>2021-12-03 09:38:03 +0200
committerAndreas Kling <kling@serenityos.org>2021-12-03 15:38:21 +0100
commit3e9a96f1d8e5037ea164f1c180853d5366880083 (patch)
tree512a0672bf0094e8f877218c46d8d55709d8d105
parent3a44b8111b7a9bd058aabf712ded8d1e86830d37 (diff)
downloadserenity-3e9a96f1d8e5037ea164f1c180853d5366880083.zip
HackStudio: Add HackStudio::for_each_open_file
-rw-r--r--Userland/DevTools/HackStudio/HackStudio.h1
-rw-r--r--Userland/DevTools/HackStudio/HackStudioWidget.cpp7
-rw-r--r--Userland/DevTools/HackStudio/HackStudioWidget.h1
-rw-r--r--Userland/DevTools/HackStudio/main.cpp5
4 files changed, 14 insertions, 0 deletions
diff --git a/Userland/DevTools/HackStudio/HackStudio.h b/Userland/DevTools/HackStudio/HackStudio.h
index c8ad04170f..962c9d3b69 100644
--- a/Userland/DevTools/HackStudio/HackStudio.h
+++ b/Userland/DevTools/HackStudio/HackStudio.h
@@ -21,6 +21,7 @@ void open_file(const String&, size_t line, size_t column);
Project& project();
String currently_open_file();
void set_current_editor_wrapper(RefPtr<EditorWrapper>);
+void for_each_open_file(Function<void(ProjectFile const&)>);
class Locator;
Locator& locator();
diff --git a/Userland/DevTools/HackStudio/HackStudioWidget.cpp b/Userland/DevTools/HackStudio/HackStudioWidget.cpp
index 1e47b20aba..7bf0509c1f 100644
--- a/Userland/DevTools/HackStudio/HackStudioWidget.cpp
+++ b/Userland/DevTools/HackStudio/HackStudioWidget.cpp
@@ -1484,4 +1484,11 @@ void HackStudioWidget::open_coredump(String const& coredump_path)
}
}
+void HackStudioWidget::for_each_open_file(Function<void(ProjectFile const&)> func)
+{
+ for (auto& open_file : m_open_files) {
+ func(*open_file.value);
+ }
+}
+
}
diff --git a/Userland/DevTools/HackStudio/HackStudioWidget.h b/Userland/DevTools/HackStudio/HackStudioWidget.h
index 1e6342d486..7a9ea47fe0 100644
--- a/Userland/DevTools/HackStudio/HackStudioWidget.h
+++ b/Userland/DevTools/HackStudio/HackStudioWidget.h
@@ -69,6 +69,7 @@ public:
};
void open_coredump(String const& coredump_path);
+ void for_each_open_file(Function<void(ProjectFile const&)>);
private:
static String get_full_path_of_serenity_source(const String& file);
diff --git a/Userland/DevTools/HackStudio/main.cpp b/Userland/DevTools/HackStudio/main.cpp
index a0c4650dc8..4ead5ec113 100644
--- a/Userland/DevTools/HackStudio/main.cpp
+++ b/Userland/DevTools/HackStudio/main.cpp
@@ -168,4 +168,9 @@ Locator& locator()
return s_hack_studio_widget->locator();
}
+void for_each_open_file(Function<void(ProjectFile const&)> func)
+{
+ s_hack_studio_widget->for_each_open_file(move(func));
+}
+
}