From b81f6f2c43b04a221a74880a58b1ced0cbad4a25 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Fri, 1 Nov 2019 18:40:32 +0100 Subject: [PATCH] HackStudio: Rename TextDocument => ProjectFile TextDocument was not the right name, and got even more confusing with the addition of GTextDocument in LibGUI. --- DevTools/HackStudio/Makefile | 2 +- DevTools/HackStudio/Project.cpp | 6 +++--- DevTools/HackStudio/Project.h | 6 +++--- DevTools/HackStudio/{TextDocument.cpp => ProjectFile.cpp} | 8 ++++---- DevTools/HackStudio/{TextDocument.h => ProjectFile.h} | 8 ++++---- 5 files changed, 15 insertions(+), 15 deletions(-) rename DevTools/HackStudio/{TextDocument.cpp => ProjectFile.cpp} (86%) rename DevTools/HackStudio/{TextDocument.h => ProjectFile.h} (69%) diff --git a/DevTools/HackStudio/Makefile b/DevTools/HackStudio/Makefile index 8d874da8cf..e37a4dd47b 100644 --- a/DevTools/HackStudio/Makefile +++ b/DevTools/HackStudio/Makefile @@ -2,7 +2,7 @@ include ../../Makefile.common OBJS = \ Project.o \ - TextDocument.o \ + ProjectFile.o \ TerminalWrapper.o \ FindInFilesWidget.o \ ProcessStateWidget.o \ diff --git a/DevTools/HackStudio/Project.cpp b/DevTools/HackStudio/Project.cpp index f841e33d85..0cbcc67bbd 100644 --- a/DevTools/HackStudio/Project.cpp +++ b/DevTools/HackStudio/Project.cpp @@ -37,7 +37,7 @@ Project::Project(const String& path, Vector&& filenames) : m_path(path) { for (auto& filename : filenames) { - m_files.append(TextDocument::construct_with_name(filename)); + m_files.append(ProjectFile::construct_with_name(filename)); } m_model = adopt(*new ProjectModel(*this)); } @@ -75,12 +75,12 @@ bool Project::add_file(const String& filename) if (!project_file->close()) return false; - m_files.append(TextDocument::construct_with_name(filename)); + m_files.append(ProjectFile::construct_with_name(filename)); m_model->update(); return true; } -TextDocument* Project::get_file(const String& filename) +ProjectFile* Project::get_file(const String& filename) { for (auto& file : m_files) { if (file.name() == filename) diff --git a/DevTools/HackStudio/Project.h b/DevTools/HackStudio/Project.h index f564ae15c6..458f8ce53f 100644 --- a/DevTools/HackStudio/Project.h +++ b/DevTools/HackStudio/Project.h @@ -1,6 +1,6 @@ #pragma once -#include "TextDocument.h" +#include "ProjectFile.h" #include #include #include @@ -14,7 +14,7 @@ public: [[nodiscard]] bool add_file(const String& filename); - TextDocument* get_file(const String& filename); + ProjectFile* get_file(const String& filename); GModel& model() { return *m_model; } @@ -33,5 +33,5 @@ private: String m_path; RefPtr m_model; - NonnullRefPtrVector m_files; + NonnullRefPtrVector m_files; }; diff --git a/DevTools/HackStudio/TextDocument.cpp b/DevTools/HackStudio/ProjectFile.cpp similarity index 86% rename from DevTools/HackStudio/TextDocument.cpp rename to DevTools/HackStudio/ProjectFile.cpp index 6bcd83efb3..9c95356106 100644 --- a/DevTools/HackStudio/TextDocument.cpp +++ b/DevTools/HackStudio/ProjectFile.cpp @@ -1,8 +1,8 @@ -#include "TextDocument.h" +#include "ProjectFile.h" #include #include -const GTextDocument& TextDocument::document() const +const GTextDocument& ProjectFile::document() const { if (!m_document) { m_document = GTextDocument::create(nullptr); @@ -11,7 +11,7 @@ const GTextDocument& TextDocument::document() const return *m_document; } -const ByteBuffer& TextDocument::contents() const +const ByteBuffer& ProjectFile::contents() const { if (m_contents.is_null()) { auto file = CFile::construct(m_name); @@ -21,7 +21,7 @@ const ByteBuffer& TextDocument::contents() const return m_contents; } -Vector TextDocument::find(const StringView& needle) const +Vector ProjectFile::find(const StringView& needle) const { // NOTE: This forces us to load the contents if we hadn't already. contents(); diff --git a/DevTools/HackStudio/TextDocument.h b/DevTools/HackStudio/ProjectFile.h similarity index 69% rename from DevTools/HackStudio/TextDocument.h rename to DevTools/HackStudio/ProjectFile.h index 6d52960e3b..596442676e 100644 --- a/DevTools/HackStudio/TextDocument.h +++ b/DevTools/HackStudio/ProjectFile.h @@ -6,11 +6,11 @@ #include #include -class TextDocument : public RefCounted { +class ProjectFile : public RefCounted { public: - static NonnullRefPtr construct_with_name(const String& name) + static NonnullRefPtr construct_with_name(const String& name) { - return adopt(*new TextDocument(name)); + return adopt(*new ProjectFile(name)); } const String& name() const { return m_name; } @@ -22,7 +22,7 @@ public: const GTextDocument& document() const; private: - explicit TextDocument(const String& name) + explicit ProjectFile(const String& name) : m_name(name) { }