1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 04:47:35 +00:00

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.
This commit is contained in:
Andreas Kling 2020-02-02 12:34:39 +01:00
parent b7e3810b5c
commit 2d39da5405
265 changed files with 1380 additions and 1167 deletions

View file

@ -121,8 +121,8 @@ GVariant DevicesModel::data(const GModelIndex& index, Role) const
void DevicesModel::update()
{
auto proc_devices = CFile::construct("/proc/devices");
if (!proc_devices->open(CIODevice::OpenMode::ReadOnly))
auto proc_devices = Core::File::construct("/proc/devices");
if (!proc_devices->open(Core::IODevice::OpenMode::ReadOnly))
ASSERT_NOT_REACHED();
auto json = JsonValue::from_string(proc_devices->read_all()).as_array();
@ -148,7 +148,7 @@ void DevicesModel::update()
});
auto fill_in_paths_from_dir = [this](const String& dir) {
CDirIterator dir_iter { dir, CDirIterator::Flags::SkipDots };
Core::DirIterator dir_iter { dir, Core::DirIterator::Flags::SkipDots };
while (dir_iter.has_next()) {
auto name = dir_iter.next_path();
auto path = String::format("%s/%s", dir.characters(), name.characters());

View file

@ -93,8 +93,8 @@ static inline size_t bytes_to_kb(size_t bytes)
void MemoryStatsWidget::refresh()
{
auto proc_memstat = CFile::construct("/proc/memstat");
if (!proc_memstat->open(CIODevice::OpenMode::ReadOnly))
auto proc_memstat = Core::File::construct("/proc/memstat");
if (!proc_memstat->open(Core::IODevice::OpenMode::ReadOnly))
ASSERT_NOT_REACHED();
auto file_contents = proc_memstat->read_all();

View file

@ -81,7 +81,7 @@ NetworkStatisticsWidget::NetworkStatisticsWidget(GWidget* parent)
net_tcp_fields.empend("bytes_out", "Bytes Out", TextAlignment::CenterRight);
m_socket_table_view->set_model(GJsonArrayModel::create("/proc/net/tcp", move(net_tcp_fields)));
m_update_timer = CTimer::construct(
m_update_timer = Core::Timer::construct(
1000, [this] {
update_models();
},

View file

@ -42,5 +42,5 @@ private:
RefPtr<GTableView> m_adapter_table_view;
RefPtr<GTableView> m_socket_table_view;
RefPtr<CTimer> m_update_timer;
RefPtr<Core::Timer> m_update_timer;
};

View file

@ -73,7 +73,7 @@ ProcessMemoryMapWidget::ProcessMemoryMapWidget(GWidget* parent)
m_json_model = GJsonArrayModel::create({}, move(pid_vm_fields));
m_table_view->set_model(GSortingProxyModel::create(*m_json_model));
m_table_view->model()->set_key_column_and_sort_order(0, GSortOrder::Ascending);
m_timer = CTimer::construct(1000, [this] { refresh(); }, this);
m_timer = Core::Timer::construct(1000, [this] { refresh(); }, this);
}
ProcessMemoryMapWidget::~ProcessMemoryMapWidget()

View file

@ -28,7 +28,10 @@
#include <LibGUI/GWidget.h>
class CTimer;
namespace Core {
class Timer;
}
class GJsonArrayModel;
class GTableView;
@ -45,5 +48,5 @@ private:
RefPtr<GTableView> m_table_view;
RefPtr<GJsonArrayModel> m_json_model;
pid_t m_pid { -1 };
RefPtr<CTimer> m_timer;
RefPtr<Core::Timer> m_timer;
};

View file

@ -335,7 +335,7 @@ GVariant ProcessModel::data(const GModelIndex& index, Role role) const
void ProcessModel::update()
{
auto all_processes = CProcessStatisticsReader::get_all();
auto all_processes = Core::ProcessStatisticsReader::get_all();
unsigned last_sum_times_scheduled = 0;
for (auto& it : m_threads)

View file

@ -37,7 +37,7 @@ ProcessStacksWidget::ProcessStacksWidget(GWidget* parent)
m_stacks_editor = GTextEditor::construct(GTextEditor::Type::MultiLine, this);
m_stacks_editor->set_readonly(true);
m_timer = CTimer::construct(1000, [this] { refresh(); }, this);
m_timer = Core::Timer::construct(1000, [this] { refresh(); }, this);
}
ProcessStacksWidget::~ProcessStacksWidget()
@ -54,8 +54,8 @@ void ProcessStacksWidget::set_pid(pid_t pid)
void ProcessStacksWidget::refresh()
{
auto file = CFile::construct(String::format("/proc/%d/stack", m_pid));
if (!file->open(CIODevice::ReadOnly)) {
auto file = Core::File::construct(String::format("/proc/%d/stack", m_pid));
if (!file->open(Core::IODevice::ReadOnly)) {
m_stacks_editor->set_text(String::format("Unable to open %s", file->filename().characters()));
return;
}

View file

@ -29,7 +29,9 @@
#include <LibGUI/GTextEditor.h>
#include <LibGUI/GWidget.h>
class CTimer;
namespace Core {
class Timer;
}
class ProcessStacksWidget final : public GWidget {
C_OBJECT(ProcessStacksWidget)
@ -43,5 +45,5 @@ public:
private:
pid_t m_pid { -1 };
RefPtr<GTextEditor> m_stacks_editor;
RefPtr<CTimer> m_timer;
RefPtr<Core::Timer> m_timer;
};

View file

@ -146,7 +146,7 @@ int main(int argc, char** argv)
toolbar->set_has_frame(false);
auto process_table_view = ProcessTableView::construct(process_table_container);
auto refresh_timer = CTimer::construct(1000, [&] {
auto refresh_timer = Core::Timer::construct(1000, [&] {
process_table_view->refresh();
if (auto* memory_stats_widget = MemoryStatsWidget::the())
memory_stats_widget->refresh();