1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 11:38:11 +00:00

HackStudio: Rename TextDocument => ProjectFile

TextDocument was not the right name, and got even more confusing with
the addition of GTextDocument in LibGUI.
This commit is contained in:
Andreas Kling 2019-11-01 18:40:32 +01:00
parent 45e0c841ad
commit b81f6f2c43
5 changed files with 15 additions and 15 deletions

View file

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

View file

@ -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)

View file

@ -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;
};

View file

@ -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();

View file

@ -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)
{
}