From 2d39da5405a4527e91e853ddb1e56a539c96c6c1 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Sun, 2 Feb 2020 12:34:39 +0100 Subject: LibCore: Put all classes in the Core namespace and remove the leading C I've been wanting to do this for a long time. It's time we start being consistent about how this stuff works. The new convention is: - "LibFoo" is a userspace library that provides the "Foo" namespace. That's it :^) This was pretty tedious to convert and I didn't even start on LibGUI yet. But it's coming up next. --- DevTools/HackStudio/Editor.cpp | 10 +++++----- DevTools/HackStudio/Editor.h | 4 ++-- DevTools/HackStudio/EditorWrapper.h | 2 +- DevTools/HackStudio/ProcessStateWidget.cpp | 4 ++-- DevTools/HackStudio/ProcessStateWidget.h | 7 +++++-- DevTools/HackStudio/Project.cpp | 10 +++++----- DevTools/HackStudio/ProjectFile.cpp | 4 ++-- DevTools/HackStudio/TerminalWrapper.cpp | 2 +- DevTools/HackStudio/main.cpp | 4 ++-- 9 files changed, 25 insertions(+), 22 deletions(-) (limited to 'DevTools/HackStudio') diff --git a/DevTools/HackStudio/Editor.cpp b/DevTools/HackStudio/Editor.cpp index 09b598ccc6..82cb12af10 100644 --- a/DevTools/HackStudio/Editor.cpp +++ b/DevTools/HackStudio/Editor.cpp @@ -67,7 +67,7 @@ const EditorWrapper& Editor::wrapper() const return static_cast(*parent()); } -void Editor::focusin_event(CEvent& event) +void Editor::focusin_event(Core::Event& event) { wrapper().set_editor_has_focus({}, true); if (on_focus) @@ -75,7 +75,7 @@ void Editor::focusin_event(CEvent& event) GTextEditor::focusin_event(event); } -void Editor::focusout_event(CEvent& event) +void Editor::focusout_event(Core::Event& event) { wrapper().set_editor_has_focus({}, false); GTextEditor::focusout_event(event); @@ -103,7 +103,7 @@ static HashMap& man_paths() static HashMap paths; if (paths.is_empty()) { // FIXME: This should also search man3, possibly other places.. - CDirIterator it("/usr/share/man/man2", CDirIterator::Flags::SkipDots); + Core::DirIterator it("/usr/share/man/man2", Core::DirIterator::Flags::SkipDots); while (it.has_next()) { auto path = String::format("/usr/share/man/man2/%s", it.next_path().characters()); auto title = FileSystemPath(path).title(); @@ -132,8 +132,8 @@ void Editor::show_documentation_tooltip_if_available(const String& hovered_token #ifdef EDITOR_DEBUG dbg() << "opening " << it->value; #endif - auto file = CFile::construct(it->value); - if (!file->open(CFile::ReadOnly)) { + auto file = Core::File::construct(it->value); + if (!file->open(Core::File::ReadOnly)) { dbg() << "failed to open " << it->value << " " << file->error_string(); return; } diff --git a/DevTools/HackStudio/Editor.h b/DevTools/HackStudio/Editor.h index df3e8e900d..f57b8adcab 100644 --- a/DevTools/HackStudio/Editor.h +++ b/DevTools/HackStudio/Editor.h @@ -44,8 +44,8 @@ public: void notify_did_rehighlight(); private: - virtual void focusin_event(CEvent&) override; - virtual void focusout_event(CEvent&) override; + virtual void focusin_event(Core::Event&) override; + virtual void focusout_event(Core::Event&) override; virtual void paint_event(GPaintEvent&) override; virtual void mousemove_event(GMouseEvent&) override; virtual void cursor_did_change() override; diff --git a/DevTools/HackStudio/EditorWrapper.h b/DevTools/HackStudio/EditorWrapper.h index c2425a242a..89763f578f 100644 --- a/DevTools/HackStudio/EditorWrapper.h +++ b/DevTools/HackStudio/EditorWrapper.h @@ -52,7 +52,7 @@ private: }; template<> -inline bool is(const CObject& object) +inline bool Core::is(const Core::Object& object) { return !strcmp(object.class_name(), "EditorWrapper"); } diff --git a/DevTools/HackStudio/ProcessStateWidget.cpp b/DevTools/HackStudio/ProcessStateWidget.cpp index 00dd7172e7..7f8f64fa46 100644 --- a/DevTools/HackStudio/ProcessStateWidget.cpp +++ b/DevTools/HackStudio/ProcessStateWidget.cpp @@ -57,7 +57,7 @@ ProcessStateWidget::ProcessStateWidget(GWidget* parent) memory_label_label->set_font(Font::default_bold_font()); m_memory_label = GLabel::construct("", this); - m_timer = CTimer::construct(500, [this] { + m_timer = Core::Timer::construct(500, [this] { refresh(); }); } @@ -70,7 +70,7 @@ void ProcessStateWidget::refresh() { pid_t pid = tcgetpgrp(m_tty_fd); - auto processes = CProcessStatisticsReader::get_all(); + auto processes = Core::ProcessStatisticsReader::get_all(); auto child_process_data = processes.get(pid); if (!child_process_data.has_value()) diff --git a/DevTools/HackStudio/ProcessStateWidget.h b/DevTools/HackStudio/ProcessStateWidget.h index 98125a5b4c..423a2a650a 100644 --- a/DevTools/HackStudio/ProcessStateWidget.h +++ b/DevTools/HackStudio/ProcessStateWidget.h @@ -28,7 +28,10 @@ #include -class CTimer; +namespace Core { +class Timer; +} + class GLabel; class ProcessStateWidget final : public GWidget { @@ -48,7 +51,7 @@ private: RefPtr m_cpu_label; RefPtr m_memory_label; - RefPtr m_timer; + RefPtr m_timer; int m_tty_fd { -1 }; }; diff --git a/DevTools/HackStudio/Project.cpp b/DevTools/HackStudio/Project.cpp index 04f407c8c0..0c6cd386e7 100644 --- a/DevTools/HackStudio/Project.cpp +++ b/DevTools/HackStudio/Project.cpp @@ -190,8 +190,8 @@ Project::~Project() OwnPtr Project::load_from_file(const String& path) { - auto file = CFile::construct(path); - if (!file->open(CFile::ReadOnly)) + auto file = Core::File::construct(path); + if (!file->open(Core::File::ReadOnly)) return nullptr; Vector files; @@ -225,12 +225,12 @@ bool Project::remove_file(const String& filename) bool Project::save() { - auto project_file = CFile::construct(m_path); - if (!project_file->open(CFile::WriteOnly)) + auto project_file = Core::File::construct(m_path); + if (!project_file->open(Core::File::WriteOnly)) return false; for (auto& file : m_files) { - // FIXME: Check for error here. CIODevice::printf() needs some work on error reporting. + // FIXME: Check for error here. IODevice::printf() needs some work on error reporting. project_file->printf("%s\n", file.name().characters()); } diff --git a/DevTools/HackStudio/ProjectFile.cpp b/DevTools/HackStudio/ProjectFile.cpp index 619062bda7..ecc327af1a 100644 --- a/DevTools/HackStudio/ProjectFile.cpp +++ b/DevTools/HackStudio/ProjectFile.cpp @@ -32,8 +32,8 @@ const GTextDocument& ProjectFile::document() const { if (!m_document) { m_document = GTextDocument::create(nullptr); - auto file = CFile::construct(m_name); - if (!file->open(CFile::ReadOnly)) { + auto file = Core::File::construct(m_name); + if (!file->open(Core::File::ReadOnly)) { ASSERT_NOT_REACHED(); } m_document->set_text(file->read_all()); diff --git a/DevTools/HackStudio/TerminalWrapper.cpp b/DevTools/HackStudio/TerminalWrapper.cpp index 1b43870aa9..af2a0f87d4 100644 --- a/DevTools/HackStudio/TerminalWrapper.cpp +++ b/DevTools/HackStudio/TerminalWrapper.cpp @@ -163,7 +163,7 @@ TerminalWrapper::TerminalWrapper(GWidget* parent) { set_layout(make()); - RefPtr config = CConfigFile::get_for_app("Terminal"); + RefPtr config = Core::ConfigFile::get_for_app("Terminal"); m_terminal_widget = TerminalWidget::construct(-1, false, config); add_child(*m_terminal_widget); diff --git a/DevTools/HackStudio/main.cpp b/DevTools/HackStudio/main.cpp index 55b0ddfc44..d4c2059fd1 100644 --- a/DevTools/HackStudio/main.cpp +++ b/DevTools/HackStudio/main.cpp @@ -180,8 +180,8 @@ int main(int argc, char** argv) if (input_box->exec() == GInputBox::ExecCancel) return; auto filename = input_box->text_value(); - auto file = CFile::construct(filename); - if (!file->open((CIODevice::OpenMode)(CIODevice::WriteOnly | CIODevice::MustBeNew))) { + auto file = Core::File::construct(filename); + if (!file->open((Core::IODevice::OpenMode)(Core::IODevice::WriteOnly | Core::IODevice::MustBeNew))) { GMessageBox::show(String::format("Failed to create '%s'", filename.characters()), "Error", GMessageBox::Type::Error, GMessageBox::InputType::OK, g_window); return; } -- cgit v1.2.3