Просмотр исходного кода

HackStudio: Rename TextDocument => ProjectFile

TextDocument was not the right name, and got even more confusing with
the addition of GTextDocument in LibGUI.
Andreas Kling 5 лет назад
Родитель
Сommit
b81f6f2c43

+ 1 - 1
DevTools/HackStudio/Makefile

@@ -2,7 +2,7 @@ include ../../Makefile.common
 
 OBJS = \
     Project.o \
-    TextDocument.o \
+    ProjectFile.o \
     TerminalWrapper.o \
     FindInFilesWidget.o \
     ProcessStateWidget.o \

+ 3 - 3
DevTools/HackStudio/Project.cpp

@@ -37,7 +37,7 @@ Project::Project(const String& path, Vector<String>&& 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)

+ 3 - 3
DevTools/HackStudio/Project.h

@@ -1,6 +1,6 @@
 #pragma once
 
-#include "TextDocument.h"
+#include "ProjectFile.h"
 #include <AK/Noncopyable.h>
 #include <AK/NonnullRefPtrVector.h>
 #include <AK/OwnPtr.h>
@@ -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<GModel> m_model;
-    NonnullRefPtrVector<TextDocument> m_files;
+    NonnullRefPtrVector<ProjectFile> m_files;
 };

+ 4 - 4
DevTools/HackStudio/TextDocument.cpp → DevTools/HackStudio/ProjectFile.cpp

@@ -1,8 +1,8 @@
-#include "TextDocument.h"
+#include "ProjectFile.h"
 #include <LibCore/CFile.h>
 #include <string.h>
 
-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<int> TextDocument::find(const StringView& needle) const
+Vector<int> ProjectFile::find(const StringView& needle) const
 {
     // NOTE: This forces us to load the contents if we hadn't already.
     contents();

+ 4 - 4
DevTools/HackStudio/TextDocument.h → DevTools/HackStudio/ProjectFile.h

@@ -6,11 +6,11 @@
 #include <AK/String.h>
 #include <LibGUI/GTextDocument.h>
 
-class TextDocument : public RefCounted<TextDocument> {
+class ProjectFile : public RefCounted<ProjectFile> {
 public:
-    static NonnullRefPtr<TextDocument> construct_with_name(const String& name)
+    static NonnullRefPtr<ProjectFile> 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)
     {
     }