summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Applications/ChanViewer/BoardListModel.cpp2
-rw-r--r--Applications/ChanViewer/BoardListModel.h2
-rw-r--r--Applications/ChanViewer/ThreadCatalogModel.cpp2
-rw-r--r--Applications/ChanViewer/ThreadCatalogModel.h2
-rw-r--r--Applications/DisplayProperties/DisplayProperties.cpp4
-rw-r--r--Applications/DisplayProperties/DisplayProperties.h2
-rw-r--r--Applications/FileManager/FileUtils.cpp4
-rw-r--r--Applications/FileManager/PropertiesDialog.cpp2
-rw-r--r--Applications/FileManager/PropertiesDialog.h2
-rw-r--r--Applications/FileManager/main.cpp2
-rw-r--r--Applications/Help/ManualSectionNode.cpp2
-rw-r--r--Applications/Help/main.cpp4
-rw-r--r--Applications/HexEditor/HexEditor.cpp2
-rw-r--r--Applications/HexEditor/HexEditor.h2
-rw-r--r--Applications/HexEditor/HexEditorWidget.cpp4
-rw-r--r--Applications/IRCClient/IRCClient.cpp6
-rw-r--r--Applications/IRCClient/IRCClient.h9
-rw-r--r--Applications/PaintBrush/SprayTool.cpp2
-rw-r--r--Applications/PaintBrush/SprayTool.h2
-rw-r--r--Applications/Piano/MainWidget.cpp2
-rw-r--r--Applications/Piano/MainWidget.h4
-rw-r--r--Applications/Piano/main.cpp8
-rw-r--r--Applications/SoundPlayer/PlaybackManager.cpp2
-rw-r--r--Applications/SoundPlayer/PlaybackManager.h2
-rw-r--r--Applications/SystemMonitor/DevicesModel.cpp6
-rw-r--r--Applications/SystemMonitor/MemoryStatsWidget.cpp4
-rw-r--r--Applications/SystemMonitor/NetworkStatisticsWidget.cpp2
-rw-r--r--Applications/SystemMonitor/NetworkStatisticsWidget.h2
-rw-r--r--Applications/SystemMonitor/ProcessMemoryMapWidget.cpp2
-rw-r--r--Applications/SystemMonitor/ProcessMemoryMapWidget.h7
-rw-r--r--Applications/SystemMonitor/ProcessModel.cpp2
-rw-r--r--Applications/SystemMonitor/ProcessStacksWidget.cpp6
-rw-r--r--Applications/SystemMonitor/ProcessStacksWidget.h6
-rw-r--r--Applications/SystemMonitor/main.cpp2
-rw-r--r--Applications/Taskbar/TaskbarWindow.cpp6
-rw-r--r--Applications/Terminal/main.cpp4
-rw-r--r--Applications/TextEditor/TextEditorWidget.cpp4
-rw-r--r--Demos/Fire/Fire.cpp6
-rw-r--r--Demos/WidgetGallery/main.cpp2
-rw-r--r--DevTools/FormCompiler/main.cpp4
-rw-r--r--DevTools/HackStudio/Editor.cpp10
-rw-r--r--DevTools/HackStudio/Editor.h4
-rw-r--r--DevTools/HackStudio/EditorWrapper.h2
-rw-r--r--DevTools/HackStudio/ProcessStateWidget.cpp4
-rw-r--r--DevTools/HackStudio/ProcessStateWidget.h7
-rw-r--r--DevTools/HackStudio/Project.cpp10
-rw-r--r--DevTools/HackStudio/ProjectFile.cpp4
-rw-r--r--DevTools/HackStudio/TerminalWrapper.cpp2
-rw-r--r--DevTools/HackStudio/main.cpp4
-rw-r--r--DevTools/IPCCompiler/main.cpp4
-rw-r--r--DevTools/Inspector/RemoteProcess.cpp4
-rw-r--r--DevTools/Inspector/RemoteProcess.h2
-rw-r--r--DevTools/ProfileViewer/Profile.cpp4
-rw-r--r--DevTools/VisualBuilder/VBForm.cpp8
-rw-r--r--DevTools/VisualBuilder/VBWidget.cpp2
-rw-r--r--Games/Minesweeper/Field.cpp8
-rw-r--r--Games/Minesweeper/Field.h2
-rw-r--r--Games/Snake/SnakeGame.cpp2
-rw-r--r--Games/Snake/SnakeGame.h2
-rw-r--r--Libraries/LibAudio/AWavLoader.cpp6
-rw-r--r--Libraries/LibAudio/AWavLoader.h4
-rw-r--r--Libraries/LibCore/CArgsParser.cpp26
-rw-r--r--Libraries/LibCore/CArgsParser.h8
-rw-r--r--Libraries/LibCore/CConfigFile.cpp60
-rw-r--r--Libraries/LibCore/CConfigFile.h20
-rw-r--r--Libraries/LibCore/CDirIterator.cpp16
-rw-r--r--Libraries/LibCore/CDirIterator.h10
-rw-r--r--Libraries/LibCore/CElapsedTimer.cpp8
-rw-r--r--Libraries/LibCore/CElapsedTimer.h8
-rw-r--r--Libraries/LibCore/CEvent.cpp10
-rw-r--r--Libraries/LibCore/CEvent.h76
-rw-r--r--Libraries/LibCore/CEventLoop.cpp122
-rw-r--r--Libraries/LibCore/CEventLoop.h38
-rw-r--r--Libraries/LibCore/CFile.cpp28
-rw-r--r--Libraries/LibCore/CFile.h20
-rw-r--r--Libraries/LibCore/CHttpJob.cpp37
-rw-r--r--Libraries/LibCore/CHttpJob.h22
-rw-r--r--Libraries/LibCore/CHttpRequest.cpp16
-rw-r--r--Libraries/LibCore/CHttpRequest.h14
-rw-r--r--Libraries/LibCore/CHttpResponse.cpp10
-rw-r--r--Libraries/LibCore/CHttpResponse.h16
-rw-r--r--Libraries/LibCore/CIODevice.cpp45
-rw-r--r--Libraries/LibCore/CIODevice.h15
-rw-r--r--Libraries/LibCore/CIODeviceStreamReader.h12
-rw-r--r--Libraries/LibCore/CLocalServer.cpp24
-rw-r--r--Libraries/LibCore/CLocalServer.h18
-rw-r--r--Libraries/LibCore/CLocalSocket.cpp24
-rw-r--r--Libraries/LibCore/CLocalSocket.h16
-rw-r--r--Libraries/LibCore/CNetworkJob.cpp26
-rw-r--r--Libraries/LibCore/CNetworkJob.h24
-rw-r--r--Libraries/LibCore/CNetworkResponse.cpp8
-rw-r--r--Libraries/LibCore/CNetworkResponse.h10
-rw-r--r--Libraries/LibCore/CNotifier.cpp24
-rw-r--r--Libraries/LibCore/CNotifier.h14
-rw-r--r--Libraries/LibCore/CObject.cpp74
-rw-r--r--Libraries/LibCore/CObject.h74
-rw-r--r--Libraries/LibCore/CProcessStatisticsReader.cpp19
-rw-r--r--Libraries/LibCore/CProcessStatisticsReader.h14
-rw-r--r--Libraries/LibCore/CSocket.cpp44
-rw-r--r--Libraries/LibCore/CSocket.h32
-rw-r--r--Libraries/LibCore/CSocketAddress.h18
-rw-r--r--Libraries/LibCore/CTCPServer.cpp24
-rw-r--r--Libraries/LibCore/CTCPServer.h18
-rw-r--r--Libraries/LibCore/CTCPSocket.cpp20
-rw-r--r--Libraries/LibCore/CTCPSocket.h16
-rw-r--r--Libraries/LibCore/CTimer.cpp24
-rw-r--r--Libraries/LibCore/CTimer.h16
-rw-r--r--Libraries/LibCore/CUdpServer.cpp24
-rw-r--r--Libraries/LibCore/CUdpServer.h18
-rw-r--r--Libraries/LibCore/CUdpSocket.cpp20
-rw-r--r--Libraries/LibCore/CUdpSocket.h14
-rw-r--r--Libraries/LibDraw/SystemTheme.cpp2
-rw-r--r--Libraries/LibGUI/GAboutDialog.cpp2
-rw-r--r--Libraries/LibGUI/GAboutDialog.h4
-rw-r--r--Libraries/LibGUI/GAbstractButton.cpp6
-rw-r--r--Libraries/LibGUI/GAbstractButton.h10
-rw-r--r--Libraries/LibGUI/GAbstractTableView.cpp2
-rw-r--r--Libraries/LibGUI/GAbstractTableView.h2
-rw-r--r--Libraries/LibGUI/GAction.cpp48
-rw-r--r--Libraries/LibGUI/GAction.h56
-rw-r--r--Libraries/LibGUI/GApplication.cpp2
-rw-r--r--Libraries/LibGUI/GApplication.h6
-rw-r--r--Libraries/LibGUI/GColorPicker.cpp2
-rw-r--r--Libraries/LibGUI/GColorPicker.h2
-rw-r--r--Libraries/LibGUI/GDialog.cpp6
-rw-r--r--Libraries/LibGUI/GDialog.h6
-rw-r--r--Libraries/LibGUI/GDragOperation.cpp6
-rw-r--r--Libraries/LibGUI/GDragOperation.h6
-rw-r--r--Libraries/LibGUI/GEvent.h6
-rw-r--r--Libraries/LibGUI/GFilePicker.cpp2
-rw-r--r--Libraries/LibGUI/GFilePicker.h2
-rw-r--r--Libraries/LibGUI/GFileSystemModel.cpp4
-rw-r--r--Libraries/LibGUI/GFileSystemModel.h2
-rw-r--r--Libraries/LibGUI/GFontDatabase.cpp2
-rw-r--r--Libraries/LibGUI/GInputBox.cpp2
-rw-r--r--Libraries/LibGUI/GInputBox.h2
-rw-r--r--Libraries/LibGUI/GJsonArrayModel.cpp4
-rw-r--r--Libraries/LibGUI/GMenu.h2
-rw-r--r--Libraries/LibGUI/GMessageBox.cpp4
-rw-r--r--Libraries/LibGUI/GMessageBox.h4
-rw-r--r--Libraries/LibGUI/GRadioButton.h2
-rw-r--r--Libraries/LibGUI/GResizeCorner.cpp4
-rw-r--r--Libraries/LibGUI/GResizeCorner.h4
-rw-r--r--Libraries/LibGUI/GScrollBar.cpp4
-rw-r--r--Libraries/LibGUI/GScrollBar.h4
-rw-r--r--Libraries/LibGUI/GSlider.cpp2
-rw-r--r--Libraries/LibGUI/GSlider.h2
-rw-r--r--Libraries/LibGUI/GSplitter.cpp4
-rw-r--r--Libraries/LibGUI/GSplitter.h4
-rw-r--r--Libraries/LibGUI/GStackWidget.cpp6
-rw-r--r--Libraries/LibGUI/GStackWidget.h2
-rw-r--r--Libraries/LibGUI/GTabWidget.cpp8
-rw-r--r--Libraries/LibGUI/GTabWidget.h4
-rw-r--r--Libraries/LibGUI/GTextDocument.cpp2
-rw-r--r--Libraries/LibGUI/GTextDocument.h2
-rw-r--r--Libraries/LibGUI/GTextEditor.cpp12
-rw-r--r--Libraries/LibGUI/GTextEditor.h12
-rw-r--r--Libraries/LibGUI/GWidget.cpp38
-rw-r--r--Libraries/LibGUI/GWidget.h32
-rw-r--r--Libraries/LibGUI/GWindow.cpp18
-rw-r--r--Libraries/LibGUI/GWindow.h8
-rw-r--r--Libraries/LibGUI/GWindowServerConnection.cpp38
-rw-r--r--Libraries/LibHTML/CSS/StyleProperties.cpp2
-rw-r--r--Libraries/LibHTML/CodeGenerators/Generate_CSS_PropertyID_cpp/Generate_CSS_PropertyID_cpp.cpp4
-rw-r--r--Libraries/LibHTML/CodeGenerators/Generate_CSS_PropertyID_h/Generate_CSS_PropertyID_h.cpp4
-rw-r--r--Libraries/LibHTML/DOM/Document.cpp2
-rw-r--r--Libraries/LibHTML/DOM/Document.h7
-rw-r--r--Libraries/LibHTML/DOM/HTMLBlinkElement.cpp2
-rw-r--r--Libraries/LibHTML/DOM/HTMLBlinkElement.h6
-rw-r--r--Libraries/LibHTML/ResourceLoader.cpp4
-rw-r--r--Libraries/LibHTML/ResourceLoader.h2
-rw-r--r--Libraries/LibIPC/IClientConnection.h16
-rw-r--r--Libraries/LibIPC/IServerConnection.h12
-rw-r--r--Libraries/LibThread/BackgroundAction.h13
-rw-r--r--Libraries/LibThread/Thread.cpp2
-rw-r--r--Libraries/LibThread/Thread.h2
-rw-r--r--Libraries/LibVT/TerminalWidget.cpp14
-rw-r--r--Libraries/LibVT/TerminalWidget.h20
-rw-r--r--MenuApplets/CPUGraph/main.cpp6
-rw-r--r--MenuApplets/Clock/main.cpp4
-rw-r--r--Meta/Lagom/SimpleIPCClient.cpp2
-rw-r--r--Meta/Lagom/SimpleIPCServer.cpp6
-rw-r--r--Meta/Lagom/TestApp.cpp4
-rw-r--r--Servers/AudioServer/ASClientConnection.cpp2
-rw-r--r--Servers/AudioServer/ASClientConnection.h2
-rw-r--r--Servers/AudioServer/ASEventLoop.cpp2
-rw-r--r--Servers/AudioServer/ASEventLoop.h4
-rw-r--r--Servers/AudioServer/ASMixer.cpp4
-rw-r--r--Servers/AudioServer/ASMixer.h4
-rw-r--r--Servers/LookupServer/LookupServer.cpp16
-rw-r--r--Servers/LookupServer/LookupServer.h13
-rw-r--r--Servers/LookupServer/main.cpp2
-rw-r--r--Servers/ProtocolServer/HttpDownload.cpp4
-rw-r--r--Servers/ProtocolServer/HttpDownload.h11
-rw-r--r--Servers/ProtocolServer/HttpProtocol.cpp6
-rw-r--r--Servers/ProtocolServer/PSClientConnection.cpp2
-rw-r--r--Servers/ProtocolServer/PSClientConnection.h2
-rw-r--r--Servers/ProtocolServer/main.cpp4
-rw-r--r--Servers/SystemServer/Service.cpp10
-rw-r--r--Servers/SystemServer/Service.h11
-rw-r--r--Servers/SystemServer/main.cpp12
-rw-r--r--Servers/TelnetServer/Client.cpp4
-rw-r--r--Servers/TelnetServer/Client.h8
-rw-r--r--Servers/TelnetServer/main.cpp4
-rw-r--r--Servers/WindowServer/WSClientConnection.cpp2
-rw-r--r--Servers/WindowServer/WSClientConnection.h2
-rw-r--r--Servers/WindowServer/WSCompositor.cpp4
-rw-r--r--Servers/WindowServer/WSCompositor.h6
-rw-r--r--Servers/WindowServer/WSEvent.h4
-rw-r--r--Servers/WindowServer/WSEventLoop.cpp6
-rw-r--r--Servers/WindowServer/WSEventLoop.h8
-rw-r--r--Servers/WindowServer/WSMenu.cpp6
-rw-r--r--Servers/WindowServer/WSMenu.h4
-rw-r--r--Servers/WindowServer/WSMenuManager.cpp12
-rw-r--r--Servers/WindowServer/WSMenuManager.h4
-rw-r--r--Servers/WindowServer/WSScreen.cpp8
-rw-r--r--Servers/WindowServer/WSWindow.cpp14
-rw-r--r--Servers/WindowServer/WSWindow.h6
-rw-r--r--Servers/WindowServer/WSWindowManager.cpp22
-rw-r--r--Servers/WindowServer/WSWindowManager.h10
-rw-r--r--Servers/WindowServer/WSWindowSwitcher.h2
-rw-r--r--Servers/WindowServer/main.cpp2
-rw-r--r--Shell/LineEditor.cpp6
-rw-r--r--Shell/main.cpp18
-rw-r--r--Userland/allocate.cpp4
-rw-r--r--Userland/aplay.cpp2
-rw-r--r--Userland/avol.cpp2
-rw-r--r--Userland/cal.cpp8
-rw-r--r--Userland/chroot.cpp6
-rw-r--r--Userland/copy.cpp10
-rw-r--r--Userland/cp.cpp4
-rw-r--r--Userland/df.cpp4
-rw-r--r--Userland/disk_benchmark.cpp4
-rw-r--r--Userland/dmesg.cpp4
-rw-r--r--Userland/gron.cpp4
-rw-r--r--Userland/head.cpp4
-rw-r--r--Userland/html.cpp6
-rw-r--r--Userland/id.cpp2
-rw-r--r--Userland/ifconfig.cpp4
-rw-r--r--Userland/jp.cpp4
-rw-r--r--Userland/keymap.cpp10
-rw-r--r--Userland/killall.cpp2
-rw-r--r--Userland/ln.cpp2
-rw-r--r--Userland/ls.cpp8
-rw-r--r--Userland/lspci.cpp4
-rw-r--r--Userland/man.cpp4
-rw-r--r--Userland/md.cpp6
-rw-r--r--Userland/mount.cpp14
-rw-r--r--Userland/nl.cpp6
-rw-r--r--Userland/pape.cpp6
-rw-r--r--Userland/paste.cpp2
-rw-r--r--Userland/pidof.cpp4
-rw-r--r--Userland/pro.cpp2
-rw-r--r--Userland/ps.cpp2
-rw-r--r--Userland/rm.cpp3
-rw-r--r--Userland/rpcdump.cpp6
-rw-r--r--Userland/shutdown.cpp2
-rw-r--r--Userland/sysctl.cpp12
-rw-r--r--Userland/tail.cpp12
-rw-r--r--Userland/tee.cpp4
-rw-r--r--Userland/top.cpp2
-rw-r--r--Userland/truncate.cpp2
-rw-r--r--Userland/umount.cpp2
-rw-r--r--Userland/useradd.cpp2
-rw-r--r--Userland/wc.cpp4
265 files changed, 1380 insertions, 1167 deletions
diff --git a/Applications/ChanViewer/BoardListModel.cpp b/Applications/ChanViewer/BoardListModel.cpp
index 2104a4d745..a7bee36f4a 100644
--- a/Applications/ChanViewer/BoardListModel.cpp
+++ b/Applications/ChanViewer/BoardListModel.cpp
@@ -44,7 +44,7 @@ BoardListModel::~BoardListModel()
void BoardListModel::update()
{
- CHttpRequest request;
+ Core::HttpRequest request;
request.set_url("http://a.4cdn.org/boards.json");
if (m_pending_job)
diff --git a/Applications/ChanViewer/BoardListModel.h b/Applications/ChanViewer/BoardListModel.h
index c2bb5b2d68..b67c142560 100644
--- a/Applications/ChanViewer/BoardListModel.h
+++ b/Applications/ChanViewer/BoardListModel.h
@@ -51,5 +51,5 @@ private:
BoardListModel();
JsonArray m_boards;
- RefPtr<CHttpJob> m_pending_job;
+ RefPtr<Core::HttpJob> m_pending_job;
};
diff --git a/Applications/ChanViewer/ThreadCatalogModel.cpp b/Applications/ChanViewer/ThreadCatalogModel.cpp
index fcc6bde972..ea6d5f6b00 100644
--- a/Applications/ChanViewer/ThreadCatalogModel.cpp
+++ b/Applications/ChanViewer/ThreadCatalogModel.cpp
@@ -52,7 +52,7 @@ void ThreadCatalogModel::set_board(const String& board)
void ThreadCatalogModel::update()
{
- CHttpRequest request;
+ Core::HttpRequest request;
request.set_url(String::format("http://a.4cdn.org/%s/catalog.json", m_board.characters()));
if (m_pending_job)
diff --git a/Applications/ChanViewer/ThreadCatalogModel.h b/Applications/ChanViewer/ThreadCatalogModel.h
index b61b17fad9..a40d9ea9c5 100644
--- a/Applications/ChanViewer/ThreadCatalogModel.h
+++ b/Applications/ChanViewer/ThreadCatalogModel.h
@@ -63,5 +63,5 @@ private:
String m_board { "g" };
JsonArray m_catalog;
- RefPtr<CHttpJob> m_pending_job;
+ RefPtr<Core::HttpJob> m_pending_job;
};
diff --git a/Applications/DisplayProperties/DisplayProperties.cpp b/Applications/DisplayProperties/DisplayProperties.cpp
index b3544fa3be..4acd14b826 100644
--- a/Applications/DisplayProperties/DisplayProperties.cpp
+++ b/Applications/DisplayProperties/DisplayProperties.cpp
@@ -48,7 +48,7 @@
#include <Servers/WindowServer/WSWindowManager.h>
DisplayPropertiesWidget::DisplayPropertiesWidget()
- : m_wm_config(CConfigFile::get_for_app("WindowManager"))
+ : m_wm_config(Core::ConfigFile::get_for_app("WindowManager"))
{
create_resolution_list();
create_wallpaper_list();
@@ -114,7 +114,7 @@ void DisplayPropertiesWidget::create_wallpaper_list()
m_selected_wallpaper = name_parts[2];
}
- CDirIterator iterator("/res/wallpapers/", CDirIterator::Flags::SkipDots);
+ Core::DirIterator iterator("/res/wallpapers/", Core::DirIterator::Flags::SkipDots);
while (iterator.has_next()) {
m_wallpapers.append(iterator.next_path());
diff --git a/Applications/DisplayProperties/DisplayProperties.h b/Applications/DisplayProperties/DisplayProperties.h
index 03398a6345..1273189d90 100644
--- a/Applications/DisplayProperties/DisplayProperties.h
+++ b/Applications/DisplayProperties/DisplayProperties.h
@@ -65,7 +65,7 @@ private:
private:
String m_wallpaper_path;
- RefPtr<CConfigFile> m_wm_config;
+ RefPtr<Core::ConfigFile> m_wm_config;
RefPtr<GWidget> m_root_widget;
Vector<Size> m_resolutions;
Vector<String> m_wallpapers;
diff --git a/Applications/FileManager/FileUtils.cpp b/Applications/FileManager/FileUtils.cpp
index af0499f655..cf7294717e 100644
--- a/Applications/FileManager/FileUtils.cpp
+++ b/Applications/FileManager/FileUtils.cpp
@@ -37,7 +37,7 @@ namespace FileUtils {
int delete_directory(String directory, String& file_that_caused_error)
{
- CDirIterator iterator(directory, CDirIterator::SkipDots);
+ Core::DirIterator iterator(directory, Core::DirIterator::SkipDots);
if (iterator.has_error()) {
file_that_caused_error = directory;
return -1;
@@ -104,7 +104,7 @@ bool copy_directory(const String& src_path, const String& dst_path)
if (rc < 0) {
return false;
}
- CDirIterator di(src_path, CDirIterator::SkipDots);
+ Core::DirIterator di(src_path, Core::DirIterator::SkipDots);
if (di.has_error()) {
return false;
}
diff --git a/Applications/FileManager/PropertiesDialog.cpp b/Applications/FileManager/PropertiesDialog.cpp
index 1ce9cc0060..89f1a44cca 100644
--- a/Applications/FileManager/PropertiesDialog.cpp
+++ b/Applications/FileManager/PropertiesDialog.cpp
@@ -35,7 +35,7 @@
#include <stdio.h>
#include <unistd.h>
-PropertiesDialog::PropertiesDialog(GFileSystemModel& model, String path, bool disable_rename, CObject* parent)
+PropertiesDialog::PropertiesDialog(GFileSystemModel& model, String path, bool disable_rename, Core::Object* parent)
: GDialog(parent)
, m_model(model)
{
diff --git a/Applications/FileManager/PropertiesDialog.h b/Applications/FileManager/PropertiesDialog.h
index 7b63efb65c..f39a514cf0 100644
--- a/Applications/FileManager/PropertiesDialog.h
+++ b/Applications/FileManager/PropertiesDialog.h
@@ -40,7 +40,7 @@ public:
virtual ~PropertiesDialog() override;
private:
- PropertiesDialog(GFileSystemModel&, String, bool disable_rename, CObject* parent = nullptr);
+ PropertiesDialog(GFileSystemModel&, String, bool disable_rename, Core::Object* parent = nullptr);
struct PropertyValuePair {
String property;
diff --git a/Applications/FileManager/main.cpp b/Applications/FileManager/main.cpp
index 27bbecd2c2..7d5df0b35b 100644
--- a/Applications/FileManager/main.cpp
+++ b/Applications/FileManager/main.cpp
@@ -72,7 +72,7 @@ int main(int argc, char** argv)
return 1;
}
- RefPtr<CConfigFile> config = CConfigFile::get_for_app("FileManager");
+ RefPtr<Core::ConfigFile> config = Core::ConfigFile::get_for_app("FileManager");
GApplication app(argc, argv);
diff --git a/Applications/Help/ManualSectionNode.cpp b/Applications/Help/ManualSectionNode.cpp
index 14f6d257a1..c97dc74f37 100644
--- a/Applications/Help/ManualSectionNode.cpp
+++ b/Applications/Help/ManualSectionNode.cpp
@@ -41,7 +41,7 @@ void ManualSectionNode::reify_if_needed() const
return;
m_reified = true;
- CDirIterator dir_iter { path(), CDirIterator::Flags::SkipDots };
+ Core::DirIterator dir_iter { path(), Core::DirIterator::Flags::SkipDots };
while (dir_iter.has_next()) {
FileSystemPath file_path(dir_iter.next_path());
diff --git a/Applications/Help/main.cpp b/Applications/Help/main.cpp
index a6d615fa8e..8a174af4ae 100644
--- a/Applications/Help/main.cpp
+++ b/Applications/Help/main.cpp
@@ -113,10 +113,10 @@ int main(int argc, char* argv[])
dbg() << "Opening page at " << path;
- auto file = CFile::construct();
+ auto file = Core::File::construct();
file->set_filename(path);
- if (!file->open(CIODevice::OpenMode::ReadOnly)) {
+ if (!file->open(Core::IODevice::OpenMode::ReadOnly)) {
int saved_errno = errno;
GMessageBox::show(strerror(saved_errno), "Failed to open man page", GMessageBox::Type::Error, GMessageBox::InputType::OK, window);
return;
diff --git a/Applications/HexEditor/HexEditor.cpp b/Applications/HexEditor/HexEditor.cpp
index 159edbe4bf..d5f3514ce2 100644
--- a/Applications/HexEditor/HexEditor.cpp
+++ b/Applications/HexEditor/HexEditor.cpp
@@ -564,7 +564,7 @@ void HexEditor::paint_event(GPaintEvent& event)
}
}
-void HexEditor::leave_event(CEvent&)
+void HexEditor::leave_event(Core::Event&)
{
ASSERT(window());
window()->set_override_cursor(GStandardCursor::None);
diff --git a/Applications/HexEditor/HexEditor.h b/Applications/HexEditor/HexEditor.h
index 5fcd128dcf..f570e0406e 100644
--- a/Applications/HexEditor/HexEditor.h
+++ b/Applications/HexEditor/HexEditor.h
@@ -73,7 +73,7 @@ protected:
virtual void mousemove_event(GMouseEvent&) override;
virtual void keydown_event(GKeyEvent&) override;
virtual bool accepts_focus() const override { return true; }
- virtual void leave_event(CEvent&) override;
+ virtual void leave_event(Core::Event&) override;
private:
bool m_readonly { false };
diff --git a/Applications/HexEditor/HexEditorWidget.cpp b/Applications/HexEditor/HexEditorWidget.cpp
index f8e620310f..240e0bfdd5 100644
--- a/Applications/HexEditor/HexEditorWidget.cpp
+++ b/Applications/HexEditor/HexEditorWidget.cpp
@@ -235,8 +235,8 @@ void HexEditorWidget::update_title()
void HexEditorWidget::open_file(const String& path)
{
- auto file = CFile::construct(path);
- if (!file->open(CIODevice::ReadOnly)) {
+ auto file = Core::File::construct(path);
+ if (!file->open(Core::IODevice::ReadOnly)) {
GMessageBox::show(String::format("Opening \"%s\" failed: %s", path.characters(), strerror(errno)), "Error", GMessageBox::Type::Error, GMessageBox::InputType::OK, window());
return;
}
diff --git a/Applications/IRCClient/IRCClient.cpp b/Applications/IRCClient/IRCClient.cpp
index f74b82fd10..75e70ef796 100644
--- a/Applications/IRCClient/IRCClient.cpp
+++ b/Applications/IRCClient/IRCClient.cpp
@@ -60,9 +60,9 @@ IRCClient::IRCClient()
: m_nickname("seren1ty")
, m_client_window_list_model(IRCWindowListModel::create(*this))
, m_log(IRCLogBuffer::create())
- , m_config(CConfigFile::get_for_app("IRCClient"))
+ , m_config(Core::ConfigFile::get_for_app("IRCClient"))
{
- m_socket = CTCPSocket::construct(this);
+ m_socket = Core::TCPSocket::construct(this);
m_nickname = m_config->read_entry("User", "Nickname", "seren1ty");
m_hostname = m_config->read_entry("Connection", "Server", "");
m_port = m_config->read_num_entry("Connection", "Port", 6667);
@@ -83,7 +83,7 @@ void IRCClient::set_server(const String& hostname, int port)
void IRCClient::on_socket_connected()
{
- m_notifier = CNotifier::construct(m_socket->fd(), CNotifier::Read);
+ m_notifier = Core::Notifier::construct(m_socket->fd(), Core::Notifier::Read);
m_notifier->on_ready_to_read = [this] { receive_from_server(); };
send_user();
diff --git a/Applications/IRCClient/IRCClient.h b/Applications/IRCClient/IRCClient.h
index c6772efeb0..d1b8fd7a2b 100644
--- a/Applications/IRCClient/IRCClient.h
+++ b/Applications/IRCClient/IRCClient.h
@@ -38,9 +38,8 @@
class IRCChannel;
class IRCQuery;
class IRCWindowListModel;
-class CNotifier;
-class IRCClient final : public CObject {
+class IRCClient final : public Core::Object {
C_OBJECT(IRCClient)
friend class IRCChannel;
friend class IRCQuery;
@@ -162,10 +161,10 @@ private:
String m_hostname;
int m_port { 6667 };
- RefPtr<CTCPSocket> m_socket;
+ RefPtr<Core::TCPSocket> m_socket;
String m_nickname;
- RefPtr<CNotifier> m_notifier;
+ RefPtr<Core::Notifier> m_notifier;
HashMap<String, RefPtr<IRCChannel>, CaseInsensitiveStringTraits> m_channels;
HashMap<String, RefPtr<IRCQuery>, CaseInsensitiveStringTraits> m_queries;
@@ -175,5 +174,5 @@ private:
NonnullRefPtr<IRCWindowListModel> m_client_window_list_model;
NonnullRefPtr<IRCLogBuffer> m_log;
- NonnullRefPtr<CConfigFile> m_config;
+ NonnullRefPtr<Core::ConfigFile> m_config;
};
diff --git a/Applications/PaintBrush/SprayTool.cpp b/Applications/PaintBrush/SprayTool.cpp
index 1a9c9895a5..a224de9b98 100644
--- a/Applications/PaintBrush/SprayTool.cpp
+++ b/Applications/PaintBrush/SprayTool.cpp
@@ -37,7 +37,7 @@
SprayTool::SprayTool()
{
- m_timer = CTimer::construct();
+ m_timer = Core::Timer::construct();
m_timer->on_timeout = [&]() {
paint_it();
};
diff --git a/Applications/PaintBrush/SprayTool.h b/Applications/PaintBrush/SprayTool.h
index 8eb13797c5..ce48eca501 100644
--- a/Applications/PaintBrush/SprayTool.h
+++ b/Applications/PaintBrush/SprayTool.h
@@ -46,7 +46,7 @@ public:
private:
virtual const char* class_name() const override { return "SprayTool"; }
void paint_it();
- RefPtr<CTimer> m_timer;
+ RefPtr<Core::Timer> m_timer;
Point m_last_pos;
Color m_color;
RefPtr<GMenu> m_context_menu;
diff --git a/Applications/Piano/MainWidget.cpp b/Applications/Piano/MainWidget.cpp
index 044992a43e..cf597f6584 100644
--- a/Applications/Piano/MainWidget.cpp
+++ b/Applications/Piano/MainWidget.cpp
@@ -70,7 +70,7 @@ MainWidget::~MainWidget()
// FIXME: There are some unnecessary calls to update() throughout this program,
// which are an easy target for optimization.
-void MainWidget::custom_event(CCustomEvent&)
+void MainWidget::custom_event(Core::CustomEvent&)
{
m_wave_widget->update();
diff --git a/Applications/Piano/MainWidget.h b/Applications/Piano/MainWidget.h
index 5f1fce8afd..2a85ff4ab7 100644
--- a/Applications/Piano/MainWidget.h
+++ b/Applications/Piano/MainWidget.h
@@ -27,8 +27,8 @@
#pragma once
+#include "Music.h"
#include <LibGUI/GWidget.h>
-#include <Music.h>
class AudioEngine;
class WaveWidget;
@@ -48,7 +48,7 @@ private:
virtual void keydown_event(GKeyEvent&) override;
virtual void keyup_event(GKeyEvent&) override;
- virtual void custom_event(CCustomEvent&) override;
+ virtual void custom_event(Core::CustomEvent&) override;
void note_key_action(int key_code, Switch);
void special_key_action(int key_code);
diff --git a/Applications/Piano/main.cpp b/Applications/Piano/main.cpp
index 3d8f0a36b4..d33c0f70b8 100644
--- a/Applications/Piano/main.cpp
+++ b/Applications/Piano/main.cpp
@@ -55,8 +55,8 @@ int main(int argc, char** argv)
window->show();
LibThread::Thread audio_thread([&] {
- auto audio = CFile::construct("/dev/audio");
- if (!audio->open(CIODevice::WriteOnly)) {
+ auto audio = Core::File::construct("/dev/audio");
+ if (!audio->open(Core::IODevice::WriteOnly)) {
dbgprintf("Can't open audio device: %s", audio->error_string());
return 1;
}
@@ -65,8 +65,8 @@ int main(int argc, char** argv)
for (;;) {
audio_engine.fill_buffer(buffer);
audio->write(reinterpret_cast<u8*>(buffer.data()), buffer_size);
- CEventLoop::current().post_event(*main_widget, make<CCustomEvent>(0));
- CEventLoop::wake();
+ Core::EventLoop::current().post_event(*main_widget, make<Core::CustomEvent>(0));
+ Core::EventLoop::wake();
}
});
audio_thread.start();
diff --git a/Applications/SoundPlayer/PlaybackManager.cpp b/Applications/SoundPlayer/PlaybackManager.cpp
index c86904d244..ab153ecc30 100644
--- a/Applications/SoundPlayer/PlaybackManager.cpp
+++ b/Applications/SoundPlayer/PlaybackManager.cpp
@@ -29,7 +29,7 @@
PlaybackManager::PlaybackManager(NonnullRefPtr<AClientConnection> connection)
: m_connection(connection)
{
- m_timer = CTimer::construct(100, [&]() {
+ m_timer = Core::Timer::construct(100, [&]() {
if (!m_loader)
return;
next_buffer();
diff --git a/Applications/SoundPlayer/PlaybackManager.h b/Applications/SoundPlayer/PlaybackManager.h
index 3459268188..d58deea1bf 100644
--- a/Applications/SoundPlayer/PlaybackManager.h
+++ b/Applications/SoundPlayer/PlaybackManager.h
@@ -70,5 +70,5 @@ private:
RefPtr<ABuffer> m_next_buffer;
RefPtr<ABuffer> m_current_buffer;
Vector<RefPtr<ABuffer>> m_buffers;
- RefPtr<CTimer> m_timer;
+ RefPtr<Core::Timer> m_timer;
};
diff --git a/Applications/SystemMonitor/DevicesModel.cpp b/Applications/SystemMonitor/DevicesModel.cpp
index 9a44fefd62..a70e10eacf 100644
--- a/Applications/SystemMonitor/DevicesModel.cpp
+++ b/Applications/SystemMonitor/DevicesModel.cpp
@@ -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());
diff --git a/Applications/SystemMonitor/MemoryStatsWidget.cpp b/Applications/SystemMonitor/MemoryStatsWidget.cpp
index 696c88ed59..21bee6a26a 100644
--- a/Applications/SystemMonitor/MemoryStatsWidget.cpp
+++ b/Applications/SystemMonitor/MemoryStatsWidget.cpp
@@ -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();
diff --git a/Applications/SystemMonitor/NetworkStatisticsWidget.cpp b/Applications/SystemMonitor/NetworkStatisticsWidget.cpp
index 8e269b3c44..0400cb6658 100644
--- a/Applications/SystemMonitor/NetworkStatisticsWidget.cpp
+++ b/Applications/SystemMonitor/NetworkStatisticsWidget.cpp
@@ -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();
},
diff --git a/Applications/SystemMonitor/NetworkStatisticsWidget.h b/Applications/SystemMonitor/NetworkStatisticsWidget.h
index b55751fa87..a354adfd5d 100644
--- a/Applications/SystemMonitor/NetworkStatisticsWidget.h
+++ b/Applications/SystemMonitor/NetworkStatisticsWidget.h
@@ -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;
};
diff --git a/Applications/SystemMonitor/ProcessMemoryMapWidget.cpp b/Applications/SystemMonitor/ProcessMemoryMapWidget.cpp
index fe431b66b3..11b29d0495 100644
--- a/Applications/SystemMonitor/ProcessMemoryMapWidget.cpp
+++ b/Applications/SystemMonitor/ProcessMemoryMapWidget.cpp
@@ -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()
diff --git a/Applications/SystemMonitor/ProcessMemoryMapWidget.h b/Applications/SystemMonitor/ProcessMemoryMapWidget.h
index 6f8c821bd7..58a82deb4d 100644
--- a/Applications/SystemMonitor/ProcessMemoryMapWidget.h
+++ b/Applications/SystemMonitor/ProcessMemoryMapWidget.h
@@ -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;
};
diff --git a/Applications/SystemMonitor/ProcessModel.cpp b/Applications/SystemMonitor/ProcessModel.cpp
index dcbe4b0493..1693e7b71a 100644
--- a/Applications/SystemMonitor/ProcessModel.cpp
+++ b/Applications/SystemMonitor/ProcessModel.cpp
@@ -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)
diff --git a/Applications/SystemMonitor/ProcessStacksWidget.cpp b/Applications/SystemMonitor/ProcessStacksWidget.cpp
index 637a252205..d4b93780fa 100644
--- a/Applications/SystemMonitor/ProcessStacksWidget.cpp
+++ b/Applications/SystemMonitor/ProcessStacksWidget.cpp
@@ -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;
}
diff --git a/Applications/SystemMonitor/ProcessStacksWidget.h b/Applications/SystemMonitor/ProcessStacksWidget.h
index a6ac1b46bd..42b27838e9 100644
--- a/Applications/SystemMonitor/ProcessStacksWidget.h
+++ b/Applications/SystemMonitor/ProcessStacksWidget.h
@@ -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;
};
diff --git a/Applications/SystemMonitor/main.cpp b/Applications/SystemMonitor/main.cpp
index c300083a14..501ea8a9fb 100644
--- a/Applications/SystemMonitor/main.cpp
+++ b/Applications/SystemMonitor/main.cpp
@@ -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();
diff --git a/Applications/Taskbar/TaskbarWindow.cpp b/Applications/Taskbar/TaskbarWindow.cpp
index 558770f732..3492a12fba 100644
--- a/Applications/Taskbar/TaskbarWindow.cpp
+++ b/Applications/Taskbar/TaskbarWindow.cpp
@@ -81,15 +81,15 @@ void TaskbarWindow::create_quick_launch_bar()
int total_width = 6;
bool first = true;
- auto config = CConfigFile::get_for_app("Taskbar");
+ auto config = Core::ConfigFile::get_for_app("Taskbar");
constexpr const char* quick_launch = "QuickLaunch";
- // FIXME: CConfigFile does not keep the order of the entries.
+ // FIXME: Core::ConfigFile does not keep the order of the entries.
for (auto& name : config->keys(quick_launch)) {
auto af_name = config->read_entry(quick_launch, name);
ASSERT(!af_name.is_null());
auto af_path = String::format("/res/apps/%s", af_name.characters());
- auto af = CConfigFile::open(af_path);
+ auto af = Core::ConfigFile::open(af_path);
auto app_executable = af->read_entry("App", "Executable");
auto app_icon_path = af->read_entry("Icons", "16x16");
diff --git a/Applications/Terminal/main.cpp b/Applications/Terminal/main.cpp
index 3aae9d3bc9..1eb659de67 100644
--- a/Applications/Terminal/main.cpp
+++ b/Applications/Terminal/main.cpp
@@ -195,7 +195,7 @@ int main(int argc, char** argv)
const char* command_to_execute = "/bin/Shell";
- CArgsParser args_parser;
+ Core::ArgsParser args_parser;
args_parser.add_option(command_to_execute, "Execute this command inside the terminal", nullptr, 'e', "command");
args_parser.parse(argc, argv);
@@ -215,7 +215,7 @@ int main(int argc, char** argv)
window->set_background_color(Color::Black);
window->set_double_buffering_enabled(false);
- RefPtr<CConfigFile> config = CConfigFile::get_for_app("Terminal");
+ RefPtr<Core::ConfigFile> config = Core::ConfigFile::get_for_app("Terminal");
auto terminal = TerminalWidget::construct(ptm_fd, true, config);
terminal->on_command_exit = [&] {
app.quit(0);
diff --git a/Applications/TextEditor/TextEditorWidget.cpp b/Applications/TextEditor/TextEditorWidget.cpp
index c1538f60de..f519684d1f 100644
--- a/Applications/TextEditor/TextEditorWidget.cpp
+++ b/Applications/TextEditor/TextEditorWidget.cpp
@@ -431,8 +431,8 @@ void TextEditorWidget::update_title()
void TextEditorWidget::open_sesame(const String& path)
{
- auto file = CFile::construct(path);
- if (!file->open(CIODevice::ReadOnly)) {
+ auto file = Core::File::construct(path);
+ if (!file->open(Core::IODevice::ReadOnly)) {
GMessageBox::show(String::format("Opening \"%s\" failed: %s", path.characters(), strerror(errno)), "Error", GMessageBox::Type::Error, GMessageBox::InputType::OK, window());
return;
}
diff --git a/Demos/Fire/Fire.cpp b/Demos/Fire/Fire.cpp
index 5bc34bf93b..bf2a066012 100644
--- a/Demos/Fire/Fire.cpp
+++ b/Demos/Fire/Fire.cpp
@@ -101,7 +101,7 @@ private:
GLabel* stats;
virtual void paint_event(GPaintEvent&) override;
- virtual void timer_event(CTimerEvent&) override;
+ virtual void timer_event(Core::TimerEvent&) override;
virtual void mousedown_event(GMouseEvent& event) override;
virtual void mousemove_event(GMouseEvent& event) override;
virtual void mouseup_event(GMouseEvent& event) override;
@@ -148,7 +148,7 @@ Fire::~Fire()
void Fire::paint_event(GPaintEvent& event)
{
- CElapsedTimer timer;
+ Core::ElapsedTimer timer;
timer.start();
GPainter painter(*this);
@@ -161,7 +161,7 @@ void Fire::paint_event(GPaintEvent& event)
cycles++;
}
-void Fire::timer_event(CTimerEvent&)
+void Fire::timer_event(Core::TimerEvent&)
{
/* Update only even or odd columns per frame... */
phase++;
diff --git a/Demos/WidgetGallery/main.cpp b/Demos/WidgetGallery/main.cpp
index a04a57daa9..3c260af394 100644
--- a/Demos/WidgetGallery/main.cpp
+++ b/Demos/WidgetGallery/main.cpp
@@ -70,7 +70,7 @@ int main(int argc, char** argv)
button2->set_enabled(false);
auto progress1 = GProgressBar::construct(main_widget);
- auto timer = CTimer::construct(100, [&] {
+ auto timer = Core::Timer::construct(100, [&] {
progress1->set_value(progress1->value() + 1);
if (progress1->value() == progress1->max())
progress1->set_value(progress1->min());
diff --git a/DevTools/FormCompiler/main.cpp b/DevTools/FormCompiler/main.cpp
index 12078c87b9..22c793bce6 100644
--- a/DevTools/FormCompiler/main.cpp
+++ b/DevTools/FormCompiler/main.cpp
@@ -39,8 +39,8 @@ int main(int argc, char** argv)
return 0;
}
- auto file = CFile::construct(argv[1]);
- if (!file->open(CIODevice::ReadOnly)) {
+ auto file = Core::File::construct(argv[1]);
+ if (!file->open(Core::IODevice::ReadOnly)) {
fprintf(stderr, "Error: Cannot open %s: %s\n", argv[1], file->error_string());
return 1;
}
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<const EditorWrapper&>(*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<String, String>& man_paths()
static HashMap<String, String> 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<EditorWrapper>(const CObject& object)
+inline bool Core::is<EditorWrapper>(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 <LibGUI/GWidget.h>
-class CTimer;
+namespace Core {
+class Timer;
+}
+
class GLabel;
class ProcessStateWidget final : public GWidget {
@@ -48,7 +51,7 @@ private:
RefPtr<GLabel> m_cpu_label;
RefPtr<GLabel> m_memory_label;
- RefPtr<CTimer> m_timer;
+ RefPtr<Core::Timer> 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> 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<String> 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<GVBoxLayout>());
- RefPtr<CConfigFile> config = CConfigFile::get_for_app("Terminal");
+ RefPtr<Core::ConfigFile> 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;
}
diff --git a/DevTools/IPCCompiler/main.cpp b/DevTools/IPCCompiler/main.cpp
index c960bc2a51..a58fe758a9 100644
--- a/DevTools/IPCCompiler/main.cpp
+++ b/DevTools/IPCCompiler/main.cpp
@@ -66,8 +66,8 @@ int main(int argc, char** argv)
return 0;
}
- auto file = CFile::construct(argv[1]);
- if (!file->open(CIODevice::ReadOnly)) {
+ auto file = Core::File::construct(argv[1]);
+ if (!file->open(Core::IODevice::ReadOnly)) {
fprintf(stderr, "Error: Cannot open %s: %s\n", argv[1], file->error_string());
return 1;
}
diff --git a/DevTools/Inspector/RemoteProcess.cpp b/DevTools/Inspector/RemoteProcess.cpp
index 94cf82a38e..49ec3312ee 100644
--- a/DevTools/Inspector/RemoteProcess.cpp
+++ b/DevTools/Inspector/RemoteProcess.cpp
@@ -34,7 +34,7 @@
RemoteProcess::RemoteProcess(pid_t pid)
: m_pid(pid)
, m_object_graph_model(RemoteObjectGraphModel::create(*this))
- , m_socket(CLocalSocket::construct())
+ , m_socket(Core::LocalSocket::construct())
{
}
@@ -152,7 +152,7 @@ void RemoteProcess::update()
}
};
- auto success = m_socket->connect(CSocketAddress::local(String::format("/tmp/rpc.%d", m_pid)));
+ auto success = m_socket->connect(Core::SocketAddress::local(String::format("/tmp/rpc.%d", m_pid)));
if (!success) {
fprintf(stderr, "Couldn't connect to PID %d\n", m_pid);
exit(1);
diff --git a/DevTools/Inspector/RemoteProcess.h b/DevTools/Inspector/RemoteProcess.h
index 4876666580..73e7aca37b 100644
--- a/DevTools/Inspector/RemoteProcess.h
+++ b/DevTools/Inspector/RemoteProcess.h
@@ -58,6 +58,6 @@ private:
pid_t m_pid { -1 };
String m_process_name;
NonnullRefPtr<RemoteObjectGraphModel> m_object_graph_model;
- RefPtr<CLocalSocket> m_socket;
+ RefPtr<Core::LocalSocket> m_socket;
NonnullOwnPtrVector<RemoteObject> m_roots;
};
diff --git a/DevTools/ProfileViewer/Profile.cpp b/DevTools/ProfileViewer/Profile.cpp
index fb1de12c46..ea0671dfad 100644
--- a/DevTools/ProfileViewer/Profile.cpp
+++ b/DevTools/ProfileViewer/Profile.cpp
@@ -157,8 +157,8 @@ void Profile::rebuild_tree()
OwnPtr<Profile> Profile::load_from_file(const StringView& path)
{
- auto file = CFile::construct(path);
- if (!file->open(CIODevice::ReadOnly)) {
+ auto file = Core::File::construct(path);
+ if (!file->open(Core::IODevice::ReadOnly)) {
fprintf(stderr, "Unable to open %s, error: %s\n", String(path).characters(), file->error_string());
return nullptr;
}
diff --git a/DevTools/VisualBuilder/VBForm.cpp b/DevTools/VisualBuilder/VBForm.cpp
index e829840f1d..d4b55c8036 100644
--- a/DevTools/VisualBuilder/VBForm.cpp
+++ b/DevTools/VisualBuilder/VBForm.cpp
@@ -381,8 +381,8 @@ void VBForm::mousemove_event(GMouseEvent& event)
void VBForm::load_from_file(const String& path)
{
- auto file = CFile::construct(path);
- if (!file->open(CIODevice::ReadOnly)) {
+ auto file = Core::File::construct(path);
+ if (!file->open(Core::IODevice::ReadOnly)) {
GMessageBox::show(String::format("Could not open '%s' for reading", path.characters()), "Error", GMessageBox::Type::Error, GMessageBox::InputType::OK, window());
return;
}
@@ -417,8 +417,8 @@ void VBForm::load_from_file(const String& path)
void VBForm::write_to_file(const String& path)
{
- auto file = CFile::construct(path);
- if (!file->open(CIODevice::WriteOnly)) {
+ auto file = Core::File::construct(path);
+ if (!file->open(Core::IODevice::WriteOnly)) {
GMessageBox::show(String::format("Could not open '%s' for writing", path.characters()), "Error", GMessageBox::Type::Error, GMessageBox::InputType::OK, window());
return;
}
diff --git a/DevTools/VisualBuilder/VBWidget.cpp b/DevTools/VisualBuilder/VBWidget.cpp
index 96862f5d85..52279c1740 100644
--- a/DevTools/VisualBuilder/VBWidget.cpp
+++ b/DevTools/VisualBuilder/VBWidget.cpp
@@ -138,7 +138,7 @@ void VBWidget::add_property(const String& name, Function<GVariant(const GWidget&
void VBWidget::setup_properties()
{
- VB_ADD_PROPERTY(CObject, "name", name, set_name, string);
+ VB_ADD_PROPERTY(Core::Object, "name", name, set_name, string);
VB_ADD_PROPERTY(GWidget, "width", width, set_width, i32);
VB_ADD_PROPERTY(GWidget, "height", height, set_height, i32);
diff --git a/Games/Minesweeper/Field.cpp b/Games/Minesweeper/Field.cpp
index e31a90899c..9e1c1e4147 100644
--- a/Games/Minesweeper/Field.cpp
+++ b/Games/Minesweeper/Field.cpp
@@ -127,7 +127,7 @@ Field::Field(GLabel& flag_label, GLabel& time_label, GButton& face_button, GWidg
, m_on_size_changed(move(on_size_changed))
{
srand(time(nullptr));
- m_timer = CTimer::construct();
+ m_timer = Core::Timer::construct();
m_timer->on_timeout = [this] {
++m_time_elapsed;
m_time_label.set_text(String::format("%u.%u", m_time_elapsed / 10, m_time_elapsed % 10));
@@ -153,7 +153,7 @@ Field::Field(GLabel& flag_label, GLabel& time_label, GButton& face_button, GWidg
set_face(Face::Default);
{
- auto config = CConfigFile::get_for_app("Minesweeper");
+ auto config = Core::ConfigFile::get_for_app("Minesweeper");
bool single_chording = config->read_num_entry("Minesweeper", "SingleChording", false);
int mine_count = config->read_num_entry("Game", "MineCount", 10);
int rows = config->read_num_entry("Game", "Rows", 9);
@@ -497,7 +497,7 @@ void Field::set_field_size(int rows, int columns, int mine_count)
if (m_rows == rows && m_columns == columns && m_mine_count == mine_count)
return;
{
- auto config = CConfigFile::get_for_app("Minesweeper");
+ auto config = Core::ConfigFile::get_for_app("Minesweeper");
config->write_num_entry("Game", "MineCount", mine_count);
config->write_num_entry("Game", "Rows", rows);
config->write_num_entry("Game", "Columns", columns);
@@ -511,7 +511,7 @@ void Field::set_field_size(int rows, int columns, int mine_count)
}
void Field::set_single_chording(bool enabled) {
- auto config = CConfigFile::get_for_app("Minesweeper");
+ auto config = Core::ConfigFile::get_for_app("Minesweeper");
m_single_chording = enabled;
config->write_bool_entry("Minesweeper", "SingleChording", m_single_chording);
}
diff --git a/Games/Minesweeper/Field.h b/Games/Minesweeper/Field.h
index 4bf5754da7..587bf27e22 100644
--- a/Games/Minesweeper/Field.h
+++ b/Games/Minesweeper/Field.h
@@ -121,7 +121,7 @@ private:
GButton& m_face_button;
GLabel& m_flag_label;
GLabel& m_time_label;
- RefPtr<CTimer> m_timer;
+ RefPtr<Core::Timer> m_timer;
int m_time_elapsed { 0 };
int m_flags_left { 0 };
Face m_face { Face::Default };
diff --git a/Games/Snake/SnakeGame.cpp b/Games/Snake/SnakeGame.cpp
index af494a94b6..6ffd0a3845 100644
--- a/Games/Snake/SnakeGame.cpp
+++ b/Games/Snake/SnakeGame.cpp
@@ -102,7 +102,7 @@ Rect SnakeGame::high_score_rect() const
return { 2, height() - font().glyph_height() - 2, high_score_width, font().glyph_height() };
}
-void SnakeGame::timer_event(CTimerEvent&)
+void SnakeGame::timer_event(Core::TimerEvent&)
{
Vector<Coordinate> dirty_cells;
diff --git a/Games/Snake/SnakeGame.h b/Games/Snake/SnakeGame.h
index 5df9ce40d0..8dbf8f1d84 100644
--- a/Games/Snake/SnakeGame.h
+++ b/Games/Snake/SnakeGame.h
@@ -41,7 +41,7 @@ private:
explicit SnakeGame(GWidget* parent = nullptr);
virtual void paint_event(GPaintEvent&) override;
virtual void keydown_event(GKeyEvent&) override;
- virtual void timer_event(CTimerEvent&) override;
+ virtual void timer_event(Core::TimerEvent&) override;
struct Coordinate {
int row { 0 };
diff --git a/Libraries/LibAudio/AWavLoader.cpp b/Libraries/LibAudio/AWavLoader.cpp
index 424a17b135..0bfc36d6c5 100644
--- a/Libraries/LibAudio/AWavLoader.cpp
+++ b/Libraries/LibAudio/AWavLoader.cpp
@@ -31,9 +31,9 @@
#include <limits>
AWavLoader::AWavLoader(const StringView& path)
- : m_file(CFile::construct(path))
+ : m_file(Core::File::construct(path))
{
- if (!m_file->open(CIODevice::ReadOnly)) {
+ if (!m_file->open(Core::IODevice::ReadOnly)) {
m_error_string = String::format("Can't open file: %s", m_file->error_string());
return;
}
@@ -75,7 +75,7 @@ void AWavLoader::reset()
bool AWavLoader::parse_header()
{
- CIODeviceStreamReader stream(*m_file);
+ Core::IODeviceStreamReader stream(*m_file);
#define CHECK_OK(msg) \
do { \
diff --git a/Libraries/LibAudio/AWavLoader.h b/Libraries/LibAudio/AWavLoader.h
index 980823d502..8b6b553879 100644
--- a/Libraries/LibAudio/AWavLoader.h
+++ b/Libraries/LibAudio/AWavLoader.h
@@ -56,11 +56,11 @@ public:
u32 sample_rate() const { return m_sample_rate; }
u16 num_channels() const { return m_num_channels; }
u16 bits_per_sample() const { return m_bits_per_sample; }
- RefPtr<CFile> file() const { return m_file; }
+ RefPtr<Core::File> file() const { return m_file; }
private:
bool parse_header();
- RefPtr<CFile> m_file;
+ RefPtr<Core::File> m_file;
String m_error_string;
OwnPtr<AResampleHelper> m_resampler;
diff --git a/Libraries/LibCore/CArgsParser.cpp b/Libraries/LibCore/CArgsParser.cpp
index 4db160ed9d..e73bfb4f63 100644
--- a/Libraries/LibCore/CArgsParser.cpp
+++ b/Libraries/LibCore/CArgsParser.cpp
@@ -30,12 +30,14 @@
#include <limits.h>
#include <stdio.h>
-CArgsParser::CArgsParser()
+namespace Core {
+
+ArgsParser::ArgsParser()
{
add_option(m_show_help, "Display this message", "help", 0);
}
-void CArgsParser::parse(int argc, char** argv)
+void ArgsParser::parse(int argc, char** argv)
{
auto print_usage_and_exit = [this, argv] {
print_usage(stderr, argv[0]);
@@ -148,7 +150,7 @@ void CArgsParser::parse(int argc, char** argv)
}
}
-void CArgsParser::print_usage(FILE* file, const char* argv0)
+void ArgsParser::print_usage(FILE* file, const char* argv0)
{
fprintf(file, "Usage:\n\t%s", argv0);
@@ -214,12 +216,12 @@ void CArgsParser::print_usage(FILE* file, const char* argv0)
}
}
-void CArgsParser::add_option(Option&& option)
+void ArgsParser::add_option(Option&& option)
{
m_options.append(move(option));
}
-void CArgsParser::add_option(bool& value, const char* help_string, const char* long_name, char short_name)
+void ArgsParser::add_option(bool& value, const char* help_string, const char* long_name, char short_name)
{
Option option {
false,
@@ -236,7 +238,7 @@ void CArgsParser::add_option(bool& value, const char* help_string, const char* l
add_option(move(option));
}
-void CArgsParser::add_option(const char*& value, const char* help_string, const char* long_name, char short_name, const char* value_name)
+void ArgsParser::add_option(const char*& value, const char* help_string, const char* long_name, char short_name, const char* value_name)
{
Option option {
true,
@@ -252,7 +254,7 @@ void CArgsParser::add_option(const char*& value, const char* help_string, const
add_option(move(option));
}
-void CArgsParser::add_option(int& value, const char* help_string, const char* long_name, char short_name, const char* value_name)
+void ArgsParser::add_option(int& value, const char* help_string, const char* long_name, char short_name, const char* value_name)
{
Option option {
true,
@@ -269,12 +271,12 @@ void CArgsParser::add_option(int& value, const char* help_string, const char* lo
add_option(move(option));
}
-void CArgsParser::add_positional_argument(Arg&& arg)
+void ArgsParser::add_positional_argument(Arg&& arg)
{
m_positional_args.append(move(arg));
}
-void CArgsParser::add_positional_argument(const char*& value, const char* help_string, const char* name, Required required)
+void ArgsParser::add_positional_argument(const char*& value, const char* help_string, const char* name, Required required)
{
Arg arg {
help_string,
@@ -289,7 +291,7 @@ void CArgsParser::add_positional_argument(const char*& value, const char* help_s
add_positional_argument(move(arg));
}
-void CArgsParser::add_positional_argument(int& value, const char* help_string, const char* name, Required required)
+void ArgsParser::add_positional_argument(int& value, const char* help_string, const char* name, Required required)
{
Arg arg {
help_string,
@@ -305,7 +307,7 @@ void CArgsParser::add_positional_argument(int& value, const char* help_string, c
add_positional_argument(move(arg));
}
-void CArgsParser::add_positional_argument(Vector<const char*>& values, const char* help_string, const char* name, Required required)
+void ArgsParser::add_positional_argument(Vector<const char*>& values, const char* help_string, const char* name, Required required)
{
Arg arg {
help_string,
@@ -319,3 +321,5 @@ void CArgsParser::add_positional_argument(Vector<const char*>& values, const cha
};
add_positional_argument(move(arg));
}
+
+}
diff --git a/Libraries/LibCore/CArgsParser.h b/Libraries/LibCore/CArgsParser.h
index 70adfacc16..69520e7002 100644
--- a/Libraries/LibCore/CArgsParser.h
+++ b/Libraries/LibCore/CArgsParser.h
@@ -31,9 +31,11 @@
#include <AK/Vector.h>
#include <stdio.h>
-class CArgsParser {
+namespace Core {
+
+class ArgsParser {
public:
- CArgsParser();
+ ArgsParser();
enum class Required {
Yes,
@@ -83,3 +85,5 @@ private:
bool m_show_help { false };
};
+
+}
diff --git a/Libraries/LibCore/CConfigFile.cpp b/Libraries/LibCore/CConfigFile.cpp
index 0bce975aac..c5a463efed 100644
--- a/Libraries/LibCore/CConfigFile.cpp
+++ b/Libraries/LibCore/CConfigFile.cpp
@@ -32,43 +32,45 @@
#include <stdio.h>
#include <unistd.h>
-NonnullRefPtr<CConfigFile> CConfigFile::get_for_app(const String& app_name)
+namespace Core {
+
+NonnullRefPtr<ConfigFile> ConfigFile::get_for_app(const String& app_name)
{
String home_path = get_current_user_home_path();
if (home_path == "/")
home_path = String::format("/tmp");
auto path = String::format("%s/%s.ini", home_path.characters(), app_name.characters());
- return adopt(*new CConfigFile(path));
+ return adopt(*new ConfigFile(path));
}
-NonnullRefPtr<CConfigFile> CConfigFile::get_for_system(const String& app_name)
+NonnullRefPtr<ConfigFile> ConfigFile::get_for_system(const String& app_name)
{
auto path = String::format("/etc/%s.ini", app_name.characters());
- return adopt(*new CConfigFile(path));
+ return adopt(*new ConfigFile(path));
}
-NonnullRefPtr<CConfigFile> CConfigFile::open(const String& path)
+NonnullRefPtr<ConfigFile> ConfigFile::open(const String& path)
{
- return adopt(*new CConfigFile(path));
+ return adopt(*new ConfigFile(path));
}
-CConfigFile::CConfigFile(const String& file_name)
+ConfigFile::ConfigFile(const String& file_name)
: m_file_name(file_name)
{
reparse();
}
-CConfigFile::~CConfigFile()
+ConfigFile::~ConfigFile()
{
sync();
}
-void CConfigFile::reparse()
+void ConfigFile::reparse()
{
m_groups.clear();
- auto file = CFile::construct(m_file_name);
- if (!file->open(CIODevice::OpenMode::ReadOnly))
+ auto file = File::construct(m_file_name);
+ if (!file->open(IODevice::OpenMode::ReadOnly))
return;
HashMap<String, String>* current_group = nullptr;
@@ -111,10 +113,10 @@ void CConfigFile::reparse()
}
}
-String CConfigFile::read_entry(const String& group, const String& key, const String& default_value) const
+String ConfigFile::read_entry(const String& group, const String& key, const String& default_value) const
{
if (!has_key(group, key)) {
- const_cast<CConfigFile&>(*this).write_entry(group, key, default_value);
+ const_cast<ConfigFile&>(*this).write_entry(group, key, default_value);
return default_value;
}
auto it = m_groups.find(group);
@@ -122,10 +124,10 @@ String CConfigFile::read_entry(const String& group, const String& key, const Str
return jt->value;
}
-int CConfigFile::read_num_entry(const String& group, const String& key, int default_value) const
+int ConfigFile::read_num_entry(const String& group, const String& key, int default_value) const
{
if (!has_key(group, key)) {
- const_cast<CConfigFile&>(*this).write_num_entry(group, key, default_value);
+ const_cast<ConfigFile&>(*this).write_num_entry(group, key, default_value);
return default_value;
}
@@ -136,31 +138,31 @@ int CConfigFile::read_num_entry(const String& group, const String& key, int defa
return value;
}
-bool CConfigFile::read_bool_entry(const String& group, const String& key, bool default_value) const
+bool ConfigFile::read_bool_entry(const String& group, const String& key, bool default_value) const
{
return read_entry(group, key, default_value ? "1" : "0") == "1";
}
-void CConfigFile::write_entry(const String& group, const String& key, const String& value)
+void ConfigFile::write_entry(const String& group, const String& key, const String& value)
{
m_groups.ensure(group).ensure(key) = value;
m_dirty = true;
}
-void CConfigFile::write_num_entry(const String& group, const String& key, int value)
+void ConfigFile::write_num_entry(const String& group, const String& key, int value)
{
write_entry(group, key, String::number(value));
}
-void CConfigFile::write_bool_entry(const String& group, const String& key, bool value)
+void ConfigFile::write_bool_entry(const String& group, const String& key, bool value)
{
write_entry(group, key, value ? "1" : "0");
}
-void CConfigFile::write_color_entry(const String& group, const String& key, Color value)
+void ConfigFile::write_color_entry(const String& group, const String& key, Color value)
{
write_entry(group, key, String::format("%d,%d,%d,%d", value.red(), value.green(), value.blue(), value.alpha()));
}
-bool CConfigFile::sync()
+bool ConfigFile::sync()
{
if (!m_dirty)
return true;
@@ -182,7 +184,7 @@ bool CConfigFile::sync()
return true;
}
-void CConfigFile::dump() const
+void ConfigFile::dump() const
{
for (auto& it : m_groups) {
printf("[%s]\n", it.key.characters());
@@ -192,12 +194,12 @@ void CConfigFile::dump() const
}
}
-Vector<String> CConfigFile::groups() const
+Vector<String> ConfigFile::groups() const
{
return m_groups.keys();
}
-Vector<String> CConfigFile::keys(const String& group) const
+Vector<String> ConfigFile::keys(const String& group) const
{
auto it = m_groups.find(group);
if (it == m_groups.end())
@@ -205,7 +207,7 @@ Vector<String> CConfigFile::keys(const String& group) const
return it->value.keys();
}
-bool CConfigFile::has_key(const String& group, const String& key) const
+bool ConfigFile::has_key(const String& group, const String& key) const
{
auto it = m_groups.find(group);
if (it == m_groups.end())
@@ -213,18 +215,18 @@ bool CConfigFile::has_key(const String& group, const String& key) const
return it->value.contains(key);
}
-bool CConfigFile::has_group(const String& group) const
+bool ConfigFile::has_group(const String& group) const
{
return m_groups.contains(group);
}
-void CConfigFile::remove_group(const String& group)
+void ConfigFile::remove_group(const String& group)
{
m_groups.remove(group);
m_dirty = true;
}
-void CConfigFile::remove_entry(const String& group, const String& key)
+void ConfigFile::remove_entry(const String& group, const String& key)
{
auto it = m_groups.find(group);
if (it == m_groups.end())
@@ -232,3 +234,5 @@ void CConfigFile::remove_entry(const String& group, const String& key)
it->value.remove(key);
m_dirty = true;
}
+
+}
diff --git a/Libraries/LibCore/CConfigFile.h b/Libraries/LibCore/CConfigFile.h
index 88650864d9..15ff959b6f 100644
--- a/Libraries/LibCore/CConfigFile.h
+++ b/Libraries/LibCore/CConfigFile.h
@@ -26,19 +26,21 @@
#pragma once
-#include <AK/String.h>
#include <AK/HashMap.h>
-#include <AK/RefPtr.h>
#include <AK/RefCounted.h>
+#include <AK/RefPtr.h>
+#include <AK/String.h>
#include <AK/Vector.h>
#include <LibDraw/Color.h>
-class CConfigFile : public RefCounted<CConfigFile> {
+namespace Core {
+
+class ConfigFile : public RefCounted<ConfigFile> {
public:
- static NonnullRefPtr<CConfigFile> get_for_app(const String& app_name);
- static NonnullRefPtr<CConfigFile> get_for_system(const String& app_name);
- static NonnullRefPtr<CConfigFile> open(const String& path);
- ~CConfigFile();
+ static NonnullRefPtr<ConfigFile> get_for_app(const String& app_name);
+ static NonnullRefPtr<ConfigFile> get_for_system(const String& app_name);
+ static NonnullRefPtr<ConfigFile> open(const String& path);
+ ~ConfigFile();
bool has_group(const String&) const;
bool has_key(const String& group, const String& key) const;
@@ -67,7 +69,7 @@ public:
String file_name() const { return m_file_name; }
private:
- explicit CConfigFile(const String& file_name);
+ explicit ConfigFile(const String& file_name);
void reparse();
@@ -75,3 +77,5 @@ private:
HashMap<String, HashMap<String, String>> m_groups;
bool m_dirty { false };
};
+
+}
diff --git a/Libraries/LibCore/CDirIterator.cpp b/Libraries/LibCore/CDirIterator.cpp
index 8e5f2cf111..7da1460e50 100644
--- a/Libraries/LibCore/CDirIterator.cpp
+++ b/Libraries/LibCore/CDirIterator.cpp
@@ -25,9 +25,11 @@
*/
#include "CDirIterator.h"
-#include <cerrno>
+#include <errno.h>
-CDirIterator::CDirIterator(const StringView& path, Flags flags)
+namespace Core {
+
+DirIterator::DirIterator(const StringView& path, Flags flags)
: m_flags(flags)
{
m_dir = opendir(String(path).characters());
@@ -36,7 +38,7 @@ CDirIterator::CDirIterator(const StringView& path, Flags flags)
}
}
-CDirIterator::~CDirIterator()
+DirIterator::~DirIterator()
{
if (m_dir != nullptr) {
closedir(m_dir);
@@ -44,7 +46,7 @@ CDirIterator::~CDirIterator()
}
}
-bool CDirIterator::advance_next()
+bool DirIterator::advance_next()
{
if (m_dir == nullptr)
return false;
@@ -74,7 +76,7 @@ bool CDirIterator::advance_next()
return m_next.length() > 0;
}
-bool CDirIterator::has_next()
+bool DirIterator::has_next()
{
if (!m_next.is_null())
return true;
@@ -82,7 +84,7 @@ bool CDirIterator::has_next()
return advance_next();
}
-String CDirIterator::next_path()
+String DirIterator::next_path()
{
if (m_next.is_null())
advance_next();
@@ -91,3 +93,5 @@ String CDirIterator::next_path()
m_next = String();
return tmp;
}
+
+}
diff --git a/Libraries/LibCore/CDirIterator.h b/Libraries/LibCore/CDirIterator.h
index ef19f46866..a7aa80f5c6 100644
--- a/Libraries/LibCore/CDirIterator.h
+++ b/Libraries/LibCore/CDirIterator.h
@@ -29,15 +29,17 @@
#include <AK/String.h>
#include <dirent.h>
-class CDirIterator {
+namespace Core {
+
+class DirIterator {
public:
enum Flags {
NoFlags = 0x0,
SkipDots = 0x1,
};
- CDirIterator(const StringView& path, Flags = Flags::NoFlags);
- ~CDirIterator();
+ DirIterator(const StringView& path, Flags = Flags::NoFlags);
+ ~DirIterator();
bool has_error() const { return m_error != 0; }
int error() const { return m_error; }
@@ -53,3 +55,5 @@ private:
bool advance_next();
};
+
+}
diff --git a/Libraries/LibCore/CElapsedTimer.cpp b/Libraries/LibCore/CElapsedTimer.cpp
index a271b709e2..8d16722297 100644
--- a/Libraries/LibCore/CElapsedTimer.cpp
+++ b/Libraries/LibCore/CElapsedTimer.cpp
@@ -29,13 +29,15 @@
#include <LibCore/CElapsedTimer.h>
#include <sys/time.h>
-void CElapsedTimer::start()
+namespace Core {
+
+void ElapsedTimer::start()
{
m_valid = true;
gettimeofday(&m_start_time, nullptr);
}
-int CElapsedTimer::elapsed() const
+int ElapsedTimer::elapsed() const
{
ASSERT(is_valid());
struct timeval now;
@@ -44,3 +46,5 @@ int CElapsedTimer::elapsed() const
timeval_sub(now, m_start_time, diff);
return diff.tv_sec * 1000 + diff.tv_usec / 1000;
}
+
+}
diff --git a/Libraries/LibCore/CElapsedTimer.h b/Libraries/LibCore/CElapsedTimer.h
index 2c9718fd5d..7db9ff0bb7 100644
--- a/Libraries/LibCore/CElapsedTimer.h
+++ b/Libraries/LibCore/CElapsedTimer.h
@@ -28,9 +28,11 @@
#include <sys/time.h>
-class CElapsedTimer {
+namespace Core {
+
+class ElapsedTimer {
public:
- CElapsedTimer() {}
+ ElapsedTimer() {}
bool is_valid() const { return m_valid; }
void start();
@@ -42,3 +44,5 @@ private:
0, 0
};
};
+
+}
diff --git a/Libraries/LibCore/CEvent.cpp b/Libraries/LibCore/CEvent.cpp
index cd36fd3e07..99d752d264 100644
--- a/Libraries/LibCore/CEvent.cpp
+++ b/Libraries/LibCore/CEvent.cpp
@@ -27,13 +27,17 @@
#include <LibCore/CEvent.h>
#include <LibCore/CObject.h>
-CChildEvent::CChildEvent(Type type, CObject& child, CObject* insertion_before_child)
- : CEvent(type)
+namespace Core {
+
+ChildEvent::ChildEvent(Type type, Object& child, Object* insertion_before_child)
+ : Core::Event(type)
, m_child(child.make_weak_ptr())
, m_insertion_before_child(insertion_before_child ? insertion_before_child->make_weak_ptr() : nullptr)
{
}
-CChildEvent::~CChildEvent()
+ChildEvent::~ChildEvent()
{
}
+
+}
diff --git a/Libraries/LibCore/CEvent.h b/Libraries/LibCore/CEvent.h
index 169b8cc7cc..d3c7cc1f22 100644
--- a/Libraries/LibCore/CEvent.h
+++ b/Libraries/LibCore/CEvent.h
@@ -26,14 +26,16 @@
#pragma once
-#include <AK/String.h>
#include <AK/Function.h>
+#include <AK/String.h>
#include <AK/Types.h>
#include <AK/WeakPtr.h>
-class CObject;
+namespace Core {
-class CEvent {
+class Object;
+
+class Event {
public:
enum Type {
Invalid = 0,
@@ -47,12 +49,12 @@ public:
Custom,
};
- CEvent() {}
- explicit CEvent(unsigned type)
+ Event() {}
+ explicit Event(unsigned type)
: m_type(type)
{
}
- virtual ~CEvent() {}
+ virtual ~Event() {}
unsigned type() const { return m_type; }
@@ -65,28 +67,28 @@ private:
bool m_accepted { true };
};
-class CDeferredInvocationEvent : public CEvent {
- friend class CEventLoop;
+class DeferredInvocationEvent : public Event {
+ friend class EventLoop;
public:
- CDeferredInvocationEvent(Function<void(CObject&)> invokee)
- : CEvent(CEvent::Type::DeferredInvoke)
+ DeferredInvocationEvent(Function<void(Object&)> invokee)
+ : Event(Event::Type::DeferredInvoke)
, m_invokee(move(invokee))
{
}
private:
- Function<void(CObject&)> m_invokee;
+ Function<void(Object&)> m_invokee;
};
-class CTimerEvent final : public CEvent {
+class TimerEvent final : public Event {
public:
- explicit CTimerEvent(int timer_id)
- : CEvent(CEvent::Timer)
+ explicit TimerEvent(int timer_id)
+ : Event(Event::Timer)
, m_timer_id(timer_id)
{
}
- ~CTimerEvent() {}
+ ~TimerEvent() {}
int timer_id() const { return m_timer_id; }
@@ -94,14 +96,14 @@ private:
int m_timer_id;
};
-class CNotifierReadEvent final : public CEvent {
+class NotifierReadEvent final : public Event {
public:
- explicit CNotifierReadEvent(int fd)
- : CEvent(CEvent::NotifierRead)
+ explicit NotifierReadEvent(int fd)
+ : Event(Event::NotifierRead)
, m_fd(fd)
{
}
- ~CNotifierReadEvent() {}
+ ~NotifierReadEvent() {}
int fd() const { return m_fd; }
@@ -109,14 +111,14 @@ private:
int m_fd;
};
-class CNotifierWriteEvent final : public CEvent {
+class NotifierWriteEvent final : public Event {
public:
- explicit CNotifierWriteEvent(int fd)
- : CEvent(CEvent::NotifierWrite)
+ explicit NotifierWriteEvent(int fd)
+ : Event(Event::NotifierWrite)
, m_fd(fd)
{
}
- ~CNotifierWriteEvent() {}
+ ~NotifierWriteEvent() {}
int fd() const { return m_fd; }
@@ -124,31 +126,31 @@ private:
int m_fd;
};
-class CChildEvent final : public CEvent {
+class ChildEvent final : public Event {
public:
- CChildEvent(Type, CObject& child, CObject* insertion_before_child = nullptr);
- ~CChildEvent();
+ ChildEvent(Type, Object& child, Object* insertion_before_child = nullptr);
+ ~ChildEvent();
- CObject* child() { return m_child.ptr(); }
- const CObject* child() const { return m_child.ptr(); }
+ Object* child() { return m_child.ptr(); }
+ const Object* child() const { return m_child.ptr(); }
- CObject* insertion_before_child() { return m_insertion_before_child.ptr(); }
- const CObject* insertion_before_child() const { return m_insertion_before_child.ptr(); }
+ Object* insertion_before_child() { return m_insertion_before_child.ptr(); }
+ const Object* insertion_before_child() const { return m_insertion_before_child.ptr(); }
private:
- WeakPtr<CObject> m_child;
- WeakPtr<CObject> m_insertion_before_child;
+ WeakPtr<Object> m_child;
+ WeakPtr<Object> m_insertion_before_child;
};
-class CCustomEvent : public CEvent {
+class CustomEvent : public Event {
public:
- CCustomEvent(int custom_type, void* data = nullptr)
- : CEvent(CEvent::Type::Custom)
+ CustomEvent(int custom_type, void* data = nullptr)
+ : Event(Event::Type::Custom)
, m_custom_type(custom_type)
, m_data(data)
{
}
- ~CCustomEvent() {}
+ ~CustomEvent() {}
int custom_type() const { return m_custom_type; }
void* data() { return m_data; }
@@ -158,3 +160,5 @@ private:
int m_custom_type { 0 };
void* m_data { nullptr };
};
+
+}
diff --git a/Libraries/LibCore/CEventLoop.cpp b/Libraries/LibCore/CEventLoop.cpp
index 857f43ad20..60f87cfc3e 100644
--- a/Libraries/LibCore/CEventLoop.cpp
+++ b/Libraries/LibCore/CEventLoop.cpp
@@ -49,21 +49,23 @@
//#define CEVENTLOOP_DEBUG
//#define DEFERRED_INVOKE_DEBUG
+namespace Core {
+
class RPCClient;
-static CEventLoop* s_main_event_loop;
-static Vector<CEventLoop*>* s_event_loop_stack;
+static EventLoop* s_main_event_loop;
+static Vector<EventLoop*>* s_event_loop_stack;
static IDAllocator s_id_allocator;
-HashMap<int, NonnullOwnPtr<CEventLoop::EventLoopTimer>>* CEventLoop::s_timers;
-HashTable<CNotifier*>* CEventLoop::s_notifiers;
-int CEventLoop::s_wake_pipe_fds[2];
-RefPtr<CLocalServer> CEventLoop::s_rpc_server;
+HashMap<int, NonnullOwnPtr<EventLoop::EventLoopTimer>>* EventLoop::s_timers;
+HashTable<Notifier*>* EventLoop::s_notifiers;
+int EventLoop::s_wake_pipe_fds[2];
+RefPtr<LocalServer> EventLoop::s_rpc_server;
HashMap<int, RefPtr<RPCClient>> s_rpc_clients;
-class RPCClient : public CObject {
+class RPCClient : public Object {
C_OBJECT(RPCClient)
public:
- explicit RPCClient(RefPtr<CLocalSocket> socket)
+ explicit RPCClient(RefPtr<LocalSocket> socket)
: m_socket(move(socket))
, m_client_id(s_id_allocator.allocate())
{
@@ -131,7 +133,7 @@ public:
JsonObject response;
response.set("type", type);
JsonArray objects;
- for (auto& object : CObject::all_objects()) {
+ for (auto& object : Object::all_objects()) {
JsonObject json_object;
object.save_to(json_object);
objects.append(move(json_object));
@@ -154,16 +156,16 @@ public:
}
private:
- RefPtr<CLocalSocket> m_socket;
+ RefPtr<LocalSocket> m_socket;
int m_client_id { -1 };
};
-CEventLoop::CEventLoop()
+EventLoop::EventLoop()
{
if (!s_event_loop_stack) {
- s_event_loop_stack = new Vector<CEventLoop*>;
- s_timers = new HashMap<int, NonnullOwnPtr<CEventLoop::EventLoopTimer>>;
- s_notifiers = new HashTable<CNotifier*>;
+ s_event_loop_stack = new Vector<EventLoop*>;
+ s_timers = new HashMap<int, NonnullOwnPtr<EventLoop::EventLoopTimer>>;
+ s_notifiers = new HashTable<Notifier*>;
}
if (!s_main_event_loop) {
@@ -185,8 +187,8 @@ CEventLoop::CEventLoop()
perror("unlink");
ASSERT_NOT_REACHED();
}
- s_rpc_server = CLocalServer::construct();
- s_rpc_server->set_name("CEventLoop_RPC_server");
+ s_rpc_server = LocalServer::construct();
+ s_rpc_server->set_name("Core::EventLoop_RPC_server");
bool listening = s_rpc_server->listen(rpc_path);
ASSERT(listening);
@@ -196,66 +198,66 @@ CEventLoop::CEventLoop()
}
#ifdef CEVENTLOOP_DEBUG
- dbg() << getpid() << " CEventLoop constructed :)";
+ dbg() << getpid() << " Core::EventLoop constructed :)";
#endif
}
-CEventLoop::~CEventLoop()
+EventLoop::~EventLoop()
{
}
-CEventLoop& CEventLoop::main()
+EventLoop& EventLoop::main()
{
ASSERT(s_main_event_loop);
return *s_main_event_loop;
}
-CEventLoop& CEventLoop::current()
+EventLoop& EventLoop::current()
{
- CEventLoop* event_loop = s_event_loop_stack->last();
+ EventLoop* event_loop = s_event_loop_stack->last();
ASSERT(event_loop != nullptr);
return *event_loop;
}
-void CEventLoop::quit(int code)
+void EventLoop::quit(int code)
{
- dbg() << "CEventLoop::quit(" << code << ")";
+ dbg() << "Core::EventLoop::quit(" << code << ")";
m_exit_requested = true;
m_exit_code = code;
}
-void CEventLoop::unquit()
+void EventLoop::unquit()
{
- dbg() << "CEventLoop::unquit()";
+ dbg() << "Core::EventLoop::unquit()";
m_exit_requested = false;
m_exit_code = 0;
}
-struct CEventLoopPusher {
+struct EventLoopPusher {
public:
- CEventLoopPusher(CEventLoop& event_loop)
+ EventLoopPusher(EventLoop& event_loop)
: m_event_loop(event_loop)
{
if (&m_event_loop != s_main_event_loop) {
- m_event_loop.take_pending_events_from(CEventLoop::current());
+ m_event_loop.take_pending_events_from(EventLoop::current());
s_event_loop_stack->append(&event_loop);
}
}
- ~CEventLoopPusher()
+ ~EventLoopPusher()
{
if (&m_event_loop != s_main_event_loop) {
s_event_loop_stack->take_last();
- CEventLoop::current().take_pending_events_from(m_event_loop);
+ EventLoop::current().take_pending_events_from(m_event_loop);
}
}
private:
- CEventLoop& m_event_loop;
+ EventLoop& m_event_loop;
};
-int CEventLoop::exec()
+int EventLoop::exec()
{
- CEventLoopPusher pusher(*this);
+ EventLoopPusher pusher(*this);
for (;;) {
if (m_exit_requested)
return m_exit_code;
@@ -264,7 +266,7 @@ int CEventLoop::exec()
ASSERT_NOT_REACHED();
}
-void CEventLoop::pump(WaitMode mode)
+void EventLoop::pump(WaitMode mode)
{
if (m_queued_events.is_empty())
wait_for_event(mode);
@@ -284,30 +286,30 @@ void CEventLoop::pump(WaitMode mode)
auto& event = *queued_event.event;
#ifdef CEVENTLOOP_DEBUG
if (receiver)
- dbg() << "CEventLoop: " << *receiver << " event " << (int)event.type();
+ dbg() << "Core::EventLoop: " << *receiver << " event " << (int)event.type();
#endif
if (!receiver) {
switch (event.type()) {
- case CEvent::Quit:
+ case Event::Quit:
ASSERT_NOT_REACHED();
return;
default:
dbg() << "Event type " << event.type() << " with no receiver :(";
}
- } else if (event.type() == CEvent::Type::DeferredInvoke) {
+ } else if (event.type() == Event::Type::DeferredInvoke) {
#ifdef DEFERRED_INVOKE_DEBUG
printf("DeferredInvoke: receiver=%s{%p}\n", receiver->class_name(), receiver);
#endif
- static_cast<CDeferredInvocationEvent&>(event).m_invokee(*receiver);
+ static_cast<DeferredInvocationEvent&>(event).m_invokee(*receiver);
} else {
- NonnullRefPtr<CObject> protector(*receiver);
+ NonnullRefPtr<Object> protector(*receiver);
receiver->dispatch_event(event);
}
if (m_exit_requested) {
LOCKER(m_lock);
#ifdef CEVENTLOOP_DEBUG
- dbg() << "CEventLoop: Exit requested. Rejigging " << (events.size() - i) << " events.";
+ dbg() << "Core::EventLoop: Exit requested. Rejigging " << (events.size() - i) << " events.";
#endif
decltype(m_queued_events) new_event_queue;
new_event_queue.ensure_capacity(m_queued_events.size() + events.size());
@@ -320,16 +322,16 @@ void CEventLoop::pump(WaitMode mode)
}
}
-void CEventLoop::post_event(CObject& receiver, NonnullOwnPtr<CEvent>&& event)
+void EventLoop::post_event(Object& receiver, NonnullOwnPtr<Event>&& event)
{
LOCKER(m_lock);
#ifdef CEVENTLOOP_DEBUG
- dbg() << "CEventLoop::post_event: {" << m_queued_events.size() << "} << receiver=" << receiver << ", event=" << event;
+ dbg() << "Core::EventLoop::post_event: {" << m_queued_events.size() << "} << receiver=" << receiver << ", event=" << event;
#endif
m_queued_events.append({ receiver.make_weak_ptr(), move(event) });
}
-void CEventLoop::wait_for_event(WaitMode mode)
+void EventLoop::wait_for_event(WaitMode mode)
{
fd_set rfds;
fd_set wfds;
@@ -347,11 +349,11 @@ void CEventLoop::wait_for_event(WaitMode mode)
add_fd_to_set(s_wake_pipe_fds[0], rfds);
max_fd = max(max_fd, max_fd_added);
for (auto& notifier : *s_notifiers) {
- if (notifier->event_mask() & CNotifier::Read)
+ if (notifier->event_mask() & Notifier::Read)
add_fd_to_set(notifier->fd(), rfds);
- if (notifier->event_mask() & CNotifier::Write)
+ if (notifier->event_mask() & Notifier::Write)
add_fd_to_set(notifier->fd(), wfds);
- if (notifier->event_mask() & CNotifier::Exceptional)
+ if (notifier->event_mask() & Notifier::Exceptional)
ASSERT_NOT_REACHED();
}
@@ -401,9 +403,9 @@ void CEventLoop::wait_for_event(WaitMode mode)
continue;
}
#ifdef CEVENTLOOP_DEBUG
- dbg() << "CEventLoop: Timer " << timer.timer_id << " has expired, sending CTimerEvent to " << timer.owner;
+ dbg() << "Core::EventLoop: Timer " << timer.timer_id << " has expired, sending Core::TimerEvent to " << timer.owner;
#endif
- post_event(*timer.owner, make<CTimerEvent>(timer.timer_id));
+ post_event(*timer.owner, make<TimerEvent>(timer.timer_id));
if (timer.should_reload) {
timer.reload(now);
} else {
@@ -418,28 +420,28 @@ void CEventLoop::wait_for_event(WaitMode mode)
for (auto& notifier : *s_notifiers) {
if (FD_ISSET(notifier->fd(), &rfds)) {
if (notifier->on_ready_to_read)
- post_event(*notifier, make<CNotifierReadEvent>(notifier->fd()));
+ post_event(*notifier, make<NotifierReadEvent>(notifier->fd()));
}
if (FD_ISSET(notifier->fd(), &wfds)) {
if (notifier->on_ready_to_write)
- post_event(*notifier, make<CNotifierWriteEvent>(notifier->fd()));
+ post_event(*notifier, make<NotifierWriteEvent>(notifier->fd()));
}
}
}
-bool CEventLoop::EventLoopTimer::has_expired(const timeval& now) const
+bool EventLoop::EventLoopTimer::has_expired(const timeval& now) const
{
return now.tv_sec > fire_time.tv_sec || (now.tv_sec == fire_time.tv_sec && now.tv_usec >= fire_time.tv_usec);
}
-void CEventLoop::EventLoopTimer::reload(const timeval& now)
+void EventLoop::EventLoopTimer::reload(const timeval& now)
{
fire_time = now;
fire_time.tv_sec += interval / 1000;
fire_time.tv_usec += (interval % 1000) * 1000;
}
-void CEventLoop::get_next_timer_expiration(timeval& soonest)
+void EventLoop::get_next_timer_expiration(timeval& soonest)
{
ASSERT(!s_timers->is_empty());
bool has_checked_any = false;
@@ -456,7 +458,7 @@ void CEventLoop::get_next_timer_expiration(timeval& soonest)
}
}
-int CEventLoop::register_timer(CObject& object, int milliseconds, bool should_reload, TimerShouldFireWhenNotVisible fire_when_not_visible)
+int EventLoop::register_timer(Object& object, int milliseconds, bool should_reload, TimerShouldFireWhenNotVisible fire_when_not_visible)
{
ASSERT(milliseconds >= 0);
auto timer = make<EventLoopTimer>();
@@ -473,7 +475,7 @@ int CEventLoop::register_timer(CObject& object, int milliseconds, bool should_re
return timer_id;
}
-bool CEventLoop::unregister_timer(int timer_id)
+bool EventLoop::unregister_timer(int timer_id)
{
s_id_allocator.deallocate(timer_id);
auto it = s_timers->find(timer_id);
@@ -483,22 +485,24 @@ bool CEventLoop::unregister_timer(int timer_id)
return true;
}
-void CEventLoop::register_notifier(Badge<CNotifier>, CNotifier& notifier)
+void EventLoop::register_notifier(Badge<Notifier>, Notifier& notifier)
{
s_notifiers->set(&notifier);
}
-void CEventLoop::unregister_notifier(Badge<CNotifier>, CNotifier& notifier)
+void EventLoop::unregister_notifier(Badge<Notifier>, Notifier& notifier)
{
s_notifiers->remove(&notifier);
}
-void CEventLoop::wake()
+void EventLoop::wake()
{
char ch = '!';
int nwritten = write(s_wake_pipe_fds[1], &ch, 1);
if (nwritten < 0) {
- perror("CEventLoop::wake: write");
+ perror("EventLoop::wake: write");
ASSERT_NOT_REACHED();
}
}
+
+}
diff --git a/Libraries/LibCore/CEventLoop.h b/Libraries/LibCore/CEventLoop.h
index 9764563c8d..6c181b051d 100644
--- a/Libraries/LibCore/CEventLoop.h
+++ b/Libraries/LibCore/CEventLoop.h
@@ -38,13 +38,15 @@
#include <sys/time.h>
#include <time.h>
-class CObject;
-class CNotifier;
+namespace Core {
-class CEventLoop {
+class Object;
+class Notifier;
+
+class EventLoop {
public:
- CEventLoop();
- ~CEventLoop();
+ EventLoop();
+ ~EventLoop();
int exec();
@@ -57,23 +59,23 @@ public:
// this should really only be used for integrating with other event loops
void pump(WaitMode = WaitMode::WaitForEvents);
- void post_event(CObject& receiver, NonnullOwnPtr<CEvent>&&);
+ void post_event(Object& receiver, NonnullOwnPtr<Event>&&);
- static CEventLoop& main();
- static CEventLoop& current();
+ static EventLoop& main();
+ static EventLoop& current();
bool was_exit_requested() const { return m_exit_requested; }
- static int register_timer(CObject&, int milliseconds, bool should_reload, TimerShouldFireWhenNotVisible);
+ static int register_timer(Object&, int milliseconds, bool should_reload, TimerShouldFireWhenNotVisible);
static bool unregister_timer(int timer_id);
- static void register_notifier(Badge<CNotifier>, CNotifier&);
- static void unregister_notifier(Badge<CNotifier>, CNotifier&);
+ static void register_notifier(Badge<Notifier>, Notifier&);
+ static void unregister_notifier(Badge<Notifier>, Notifier&);
void quit(int);
void unquit();
- void take_pending_events_from(CEventLoop& other)
+ void take_pending_events_from(EventLoop& other)
{
m_queued_events.append(move(other.m_queued_events));
}
@@ -85,8 +87,8 @@ private:
void get_next_timer_expiration(timeval&);
struct QueuedEvent {
- WeakPtr<CObject> receiver;
- NonnullOwnPtr<CEvent> event;
+ WeakPtr<Object> receiver;
+ NonnullOwnPtr<Event> event;
};
Vector<QueuedEvent, 64> m_queued_events;
@@ -104,7 +106,7 @@ private:
timeval fire_time { 0, 0 };
bool should_reload { false };
TimerShouldFireWhenNotVisible fire_when_not_visible { TimerShouldFireWhenNotVisible::No };
- WeakPtr<CObject> owner;
+ WeakPtr<Object> owner;
void reload(const timeval& now);
bool has_expired(const timeval& now) const;
@@ -112,7 +114,9 @@ private:
static HashMap<int, NonnullOwnPtr<EventLoopTimer>>* s_timers;
- static HashTable<CNotifier*>* s_notifiers;
+ static HashTable<Notifier*>* s_notifiers;
- static RefPtr<CLocalServer> s_rpc_server;
+ static RefPtr<LocalServer> s_rpc_server;
};
+
+}
diff --git a/Libraries/LibCore/CFile.cpp b/Libraries/LibCore/CFile.cpp
index 781f1e4222..89a43bbe43 100644
--- a/Libraries/LibCore/CFile.cpp
+++ b/Libraries/LibCore/CFile.cpp
@@ -30,19 +30,21 @@
#include <stdio.h>
#include <unistd.h>
-CFile::CFile(const StringView& filename, CObject* parent)
- : CIODevice(parent)
+namespace Core {
+
+File::File(const StringView& filename, Object* parent)
+ : IODevice(parent)
, m_filename(filename)
{
}
-CFile::~CFile()
+File::~File()
{
if (m_should_close_file_descriptor == ShouldCloseFileDescription::Yes && mode() != NotOpen)
close();
}
-bool CFile::open(int fd, CIODevice::OpenMode mode, ShouldCloseFileDescription should_close)
+bool File::open(int fd, IODevice::OpenMode mode, ShouldCloseFileDescription should_close)
{
set_fd(fd);
set_mode(mode);
@@ -50,25 +52,25 @@ bool CFile::open(int fd, CIODevice::OpenMode mode, ShouldCloseFileDescription sh
return true;
}
-bool CFile::open(CIODevice::OpenMode mode)
+bool File::open(IODevice::OpenMode mode)
{
ASSERT(!m_filename.is_null());
int flags = 0;
- if ((mode & CIODevice::ReadWrite) == CIODevice::ReadWrite) {
+ if ((mode & IODevice::ReadWrite) == IODevice::ReadWrite) {
flags |= O_RDWR | O_CREAT;
- } else if (mode & CIODevice::ReadOnly) {
+ } else if (mode & IODevice::ReadOnly) {
flags |= O_RDONLY;
- } else if (mode & CIODevice::WriteOnly) {
+ } else if (mode & IODevice::WriteOnly) {
flags |= O_WRONLY | O_CREAT;
- bool should_truncate = !((mode & CIODevice::Append) || (mode & CIODevice::MustBeNew));
+ bool should_truncate = !((mode & IODevice::Append) || (mode & IODevice::MustBeNew));
if (should_truncate)
flags |= O_TRUNC;
}
- if (mode & CIODevice::Append)
+ if (mode & IODevice::Append)
flags |= O_APPEND;
- if (mode & CIODevice::Truncate)
+ if (mode & IODevice::Truncate)
flags |= O_TRUNC;
- if (mode & CIODevice::MustBeNew)
+ if (mode & IODevice::MustBeNew)
flags |= O_EXCL;
int fd = ::open(m_filename.characters(), flags, 0666);
if (fd < 0) {
@@ -80,3 +82,5 @@ bool CFile::open(CIODevice::OpenMode mode)
set_mode(mode);
return true;
}
+
+}
diff --git a/Libraries/LibCore/CFile.h b/Libraries/LibCore/CFile.h
index 5e2391ba36..9c5da06f29 100644
--- a/Libraries/LibCore/CFile.h
+++ b/Libraries/LibCore/CFile.h
@@ -29,29 +29,33 @@
#include <AK/String.h>
#include <LibCore/CIODevice.h>
-class CFile final : public CIODevice {
- C_OBJECT(CFile)
+namespace Core {
+
+class File final : public IODevice {
+ C_OBJECT(File)
public:
- virtual ~CFile() override;
+ virtual ~File() override;
String filename() const { return m_filename; }
void set_filename(const StringView& filename) { m_filename = filename; }
- virtual bool open(CIODevice::OpenMode) override;
+ virtual bool open(IODevice::OpenMode) override;
enum class ShouldCloseFileDescription {
No = 0,
Yes
};
- bool open(int fd, CIODevice::OpenMode, ShouldCloseFileDescription);
+ bool open(int fd, IODevice::OpenMode, ShouldCloseFileDescription);
private:
- CFile(CObject* parent = nullptr)
- : CIODevice(parent)
+ File(Object* parent = nullptr)
+ : IODevice(parent)
{
}
- explicit CFile(const StringView&, CObject* parent = nullptr);
+ explicit File(const StringView&, Object* parent = nullptr);
String m_filename;
ShouldCloseFileDescription m_should_close_file_descriptor { ShouldCloseFileDescription::Yes };
};
+
+}
diff --git a/Libraries/LibCore/CHttpJob.cpp b/Libraries/LibCore/CHttpJob.cpp
index 02780f3d3c..624ed73254 100644
--- a/Libraries/LibCore/CHttpJob.cpp
+++ b/Libraries/LibCore/CHttpJob.cpp
@@ -33,6 +33,8 @@
//#define CHTTPJOB_DEBUG
+namespace Core {
+
static ByteBuffer handle_content_encoding(const ByteBuffer& buf, const String& content_encoding)
{
#ifdef CHTTPJOB_DEBUG
@@ -66,16 +68,16 @@ static ByteBuffer handle_content_encoding(const ByteBuffer& buf, const String& c
return buf;
}
-CHttpJob::CHttpJob(const CHttpRequest& request)
+HttpJob::HttpJob(const HttpRequest& request)
: m_request(request)
{
}
-CHttpJob::~CHttpJob()
+HttpJob::~HttpJob()
{
}
-void CHttpJob::on_socket_connected()
+void HttpJob::on_socket_connected()
{
auto raw_request = m_request.to_raw_request();
#if 0
@@ -85,7 +87,7 @@ void CHttpJob::on_socket_connected()
bool success = m_socket->send(raw_request);
if (!success)
- return deferred_invoke([this](auto&) { did_fail(CNetworkJob::Error::TransmissionFailed); });
+ return deferred_invoke([this](auto&) { did_fail(NetworkJob::Error::TransmissionFailed); });
m_socket->on_ready_to_read = [&] {
if (is_cancelled())
@@ -96,18 +98,18 @@ void CHttpJob::on_socket_connected()
auto line = m_socket->read_line(PAGE_SIZE);
if (line.is_null()) {
fprintf(stderr, "CHttpJob: Expected HTTP status\n");
- return deferred_invoke([this](auto&) { did_fail(CNetworkJob::Error::TransmissionFailed); });
+ return deferred_invoke([this](auto&) { did_fail(NetworkJob::Error::TransmissionFailed); });
}
auto parts = String::copy(line, Chomp).split(' ');
if (parts.size() < 3) {
fprintf(stderr, "CHttpJob: Expected 3-part HTTP status, got '%s'\n", line.data());
- return deferred_invoke([this](auto&) { did_fail(CNetworkJob::Error::ProtocolFailed); });
+ return deferred_invoke([this](auto&) { did_fail(NetworkJob::Error::ProtocolFailed); });
}
bool ok;
m_code = parts[1].to_uint(ok);
if (!ok) {
fprintf(stderr, "CHttpJob: Expected numeric HTTP status\n");
- return deferred_invoke([this](auto&) { did_fail(CNetworkJob::Error::ProtocolFailed); });
+ return deferred_invoke([this](auto&) { did_fail(NetworkJob::Error::ProtocolFailed); });
}
m_state = State::InHeaders;
return;
@@ -118,7 +120,7 @@ void CHttpJob::on_socket_connected()
auto line = m_socket->read_line(PAGE_SIZE);
if (line.is_null()) {
fprintf(stderr, "CHttpJob: Expected HTTP header\n");
- return did_fail(CNetworkJob::Error::ProtocolFailed);
+ return did_fail(NetworkJob::Error::ProtocolFailed);
}
auto chomped_line = String::copy(line, Chomp);
if (chomped_line.is_empty()) {
@@ -128,12 +130,12 @@ void CHttpJob::on_socket_connected()
auto parts = chomped_line.split(':');
if (parts.is_empty()) {
fprintf(stderr, "CHttpJob: Expected HTTP header with key/value\n");
- return deferred_invoke([this](auto&) { did_fail(CNetworkJob::Error::ProtocolFailed); });
+ return deferred_invoke([this](auto&) { did_fail(NetworkJob::Error::ProtocolFailed); });
}
auto name = parts[0];
if (chomped_line.length() < name.length() + 2) {
fprintf(stderr, "CHttpJob: Malformed HTTP header: '%s' (%zu)\n", chomped_line.characters(), chomped_line.length());
- return deferred_invoke([this](auto&) { did_fail(CNetworkJob::Error::ProtocolFailed); });
+ return deferred_invoke([this](auto&) { did_fail(NetworkJob::Error::ProtocolFailed); });
}
auto value = chomped_line.substring(name.length() + 2, chomped_line.length() - name.length() - 2);
m_headers.set(name, value);
@@ -148,7 +150,7 @@ void CHttpJob::on_socket_connected()
if (!payload) {
if (m_socket->eof())
return finish_up();
- return deferred_invoke([this](auto&) { did_fail(CNetworkJob::Error::ProtocolFailed); });
+ return deferred_invoke([this](auto&) { did_fail(NetworkJob::Error::ProtocolFailed); });
}
m_received_buffers.append(payload);
m_received_size += payload.size();
@@ -162,7 +164,7 @@ void CHttpJob::on_socket_connected()
};
}
-void CHttpJob::finish_up()
+void HttpJob::finish_up()
{
m_state = State::Finished;
auto flattened_buffer = ByteBuffer::create_uninitialized(m_received_size);
@@ -178,16 +180,16 @@ void CHttpJob::finish_up()
flattened_buffer = handle_content_encoding(flattened_buffer, content_encoding.value());
}
- auto response = CHttpResponse::create(m_code, move(m_headers), move(flattened_buffer));
+ auto response = HttpResponse::create(m_code, move(m_headers), move(flattened_buffer));
deferred_invoke([this, response](auto&) {
did_finish(move(response));
});
}
-void CHttpJob::start()
+void HttpJob::start()
{
ASSERT(!m_socket);
- m_socket = CTCPSocket::construct(this);
+ m_socket = TCPSocket::construct(this);
m_socket->on_connected = [this] {
#ifdef CHTTPJOB_DEBUG
dbg() << "CHttpJob: on_connected callback";
@@ -197,12 +199,12 @@ void CHttpJob::start()
bool success = m_socket->connect(m_request.url().host(), m_request.url().port());
if (!success) {
deferred_invoke([this](auto&) {
- return did_fail(CNetworkJob::Error::ConnectionFailed);
+ return did_fail(NetworkJob::Error::ConnectionFailed);
});
}
}
-void CHttpJob::shutdown()
+void HttpJob::shutdown()
{
if (!m_socket)
return;
@@ -211,3 +213,4 @@ void CHttpJob::shutdown()
remove_child(*m_socket);
m_socket = nullptr;
}
+}
diff --git a/Libraries/LibCore/CHttpJob.h b/Libraries/LibCore/CHttpJob.h
index 2fb2c34ea9..549892c060 100644
--- a/Libraries/LibCore/CHttpJob.h
+++ b/Libraries/LibCore/CHttpJob.h
@@ -31,19 +31,21 @@
#include <LibCore/CHttpResponse.h>
#include <LibCore/CNetworkJob.h>
-class CTCPSocket;
+namespace Core {
-class CHttpJob final : public CNetworkJob {
- C_OBJECT(CHttpJob)
+class TCPSocket;
+
+class HttpJob final : public NetworkJob {
+ C_OBJECT(HttpJob)
public:
- explicit CHttpJob(const CHttpRequest&);
- virtual ~CHttpJob() override;
+ explicit HttpJob(const HttpRequest&);
+ virtual ~HttpJob() override;
virtual void start() override;
virtual void shutdown() override;
- CHttpResponse* response() { return static_cast<CHttpResponse*>(CNetworkJob::response()); }
- const CHttpResponse* response() const { return static_cast<const CHttpResponse*>(CNetworkJob::response()); }
+ HttpResponse* response() { return static_cast<HttpResponse*>(NetworkJob::response()); }
+ const HttpResponse* response() const { return static_cast<const HttpResponse*>(NetworkJob::response()); }
private:
void on_socket_connected();
@@ -56,11 +58,13 @@ private:
Finished,
};
- CHttpRequest m_request;
- RefPtr<CTCPSocket> m_socket;
+ HttpRequest m_request;
+ RefPtr<TCPSocket> m_socket;
State m_state { State::InStatus };
int m_code { -1 };
HashMap<String, String> m_headers;
Vector<ByteBuffer> m_received_buffers;
size_t m_received_size { 0 };
};
+
+}
diff --git a/Libraries/LibCore/CHttpRequest.cpp b/Libraries/LibCore/CHttpRequest.cpp
index b2c0fbb1c9..99899427ac 100644
--- a/Libraries/LibCore/CHttpRequest.cpp
+++ b/Libraries/LibCore/CHttpRequest.cpp
@@ -28,22 +28,24 @@
#include <LibCore/CHttpJob.h>
#include <LibCore/CHttpRequest.h>
-CHttpRequest::CHttpRequest()
+namespace Core {
+
+HttpRequest::HttpRequest()
{
}
-CHttpRequest::~CHttpRequest()
+HttpRequest::~HttpRequest()
{
}
-RefPtr<CNetworkJob> CHttpRequest::schedule()
+RefPtr<NetworkJob> HttpRequest::schedule()
{
- auto job = CHttpJob::construct(*this);
+ auto job = HttpJob::construct(*this);
job->start();
return job;
}
-String CHttpRequest::method_name() const
+String HttpRequest::method_name() const
{
switch (m_method) {
case Method::GET:
@@ -57,7 +59,7 @@ String CHttpRequest::method_name() const
}
}
-ByteBuffer CHttpRequest::to_raw_request() const
+ByteBuffer HttpRequest::to_raw_request() const
{
StringBuilder builder;
builder.append(method_name());
@@ -68,3 +70,5 @@ ByteBuffer CHttpRequest::to_raw_request() const
builder.append("\r\n\r\n");
return builder.to_byte_buffer();
}
+
+}
diff --git a/Libraries/LibCore/CHttpRequest.h b/Libraries/LibCore/CHttpRequest.h
index 293605833d..fe4feafd14 100644
--- a/Libraries/LibCore/CHttpRequest.h
+++ b/Libraries/LibCore/CHttpRequest.h
@@ -29,9 +29,11 @@
#include <AK/String.h>
#include <AK/URL.h>
-class CNetworkJob;
+namespace Core {
-class CHttpRequest {
+class NetworkJob;
+
+class HttpRequest {
public:
enum Method {
Invalid,
@@ -40,8 +42,8 @@ public:
POST
};
- CHttpRequest();
- ~CHttpRequest();
+ HttpRequest();
+ ~HttpRequest();
const URL& url() const { return m_url; }
void set_url(const URL& url) { m_url = url; }
@@ -52,9 +54,11 @@ public:
String method_name() const;
ByteBuffer to_raw_request() const;
- RefPtr<CNetworkJob> schedule();
+ RefPtr<NetworkJob> schedule();
private:
URL m_url;
Method m_method { GET };
};
+
+}
diff --git a/Libraries/LibCore/CHttpResponse.cpp b/Libraries/LibCore/CHttpResponse.cpp
index fdd0b9c3af..064da3d2ba 100644
--- a/Libraries/LibCore/CHttpResponse.cpp
+++ b/Libraries/LibCore/CHttpResponse.cpp
@@ -26,13 +26,17 @@
#include <LibCore/CHttpResponse.h>
-CHttpResponse::CHttpResponse(int code, HashMap<String, String>&& headers, ByteBuffer&& payload)
- : CNetworkResponse(move(payload))
+namespace Core {
+
+HttpResponse::HttpResponse(int code, HashMap<String, String>&& headers, ByteBuffer&& payload)
+ : NetworkResponse(move(payload))
, m_code(code)
, m_headers(move(headers))
{
}
-CHttpResponse::~CHttpResponse()
+HttpResponse::~HttpResponse()
{
}
+
+}
diff --git a/Libraries/LibCore/CHttpResponse.h b/Libraries/LibCore/CHttpResponse.h
index 1bdf30b0bb..65d72f11ab 100644
--- a/Libraries/LibCore/CHttpResponse.h
+++ b/Libraries/LibCore/CHttpResponse.h
@@ -26,24 +26,28 @@
#pragma once
-#include <AK/String.h>
#include <AK/HashMap.h>
+#include <AK/String.h>
#include <LibCore/CNetworkResponse.h>
-class CHttpResponse : public CNetworkResponse {
+namespace Core {
+
+class HttpResponse : public NetworkResponse {
public:
- virtual ~CHttpResponse() override;
- static NonnullRefPtr<CHttpResponse> create(int code, HashMap<String, String>&& headers, ByteBuffer&& payload)
+ virtual ~HttpResponse() override;
+ static NonnullRefPtr<HttpResponse> create(int code, HashMap<String, String>&& headers, ByteBuffer&& payload)
{
- return adopt(*new CHttpResponse(code, move(headers), move(payload)));
+ return adopt(*new HttpResponse(code, move(headers), move(payload)));
}
int code() const { return m_code; }
const HashMap<String, String>& headers() const { return m_headers; }
private:
- CHttpResponse(int code, HashMap<String, String>&&, ByteBuffer&&);
+ HttpResponse(int code, HashMap<String, String>&&, ByteBuffer&&);
int m_code { 0 };
HashMap<String, String> m_headers;
};
+
+}
diff --git a/Libraries/LibCore/CIODevice.cpp b/Libraries/LibCore/CIODevice.cpp
index 20ea105b8c..03666b0bfa 100644
--- a/Libraries/LibCore/CIODevice.cpp
+++ b/Libraries/LibCore/CIODevice.cpp
@@ -34,21 +34,23 @@
#include <sys/time.h>
#include <unistd.h>
-CIODevice::CIODevice(CObject* parent)
- : CObject(parent)
+namespace Core {
+
+IODevice::IODevice(Object* parent)
+ : Object(parent)
{
}
-CIODevice::~CIODevice()
+IODevice::~IODevice()
{
}
-const char* CIODevice::error_string() const
+const char* IODevice::error_string() const
{
return strerror(m_error);
}
-int CIODevice::read(u8* buffer, int length)
+int IODevice::read(u8* buffer, int length)
{
auto read_buffer = read(length);
if (read_buffer.is_null())
@@ -57,7 +59,7 @@ int CIODevice::read(u8* buffer, int length)
return read_buffer.size();
}
-ByteBuffer CIODevice::read(int max_size)
+ByteBuffer IODevice::read(int max_size)
{
if (m_fd < 0)
return {};
@@ -99,7 +101,7 @@ ByteBuffer CIODevice::read(int max_size)
return buffer;
}
-bool CIODevice::can_read_from_fd() const
+bool IODevice::can_read_from_fd() const
{
// FIXME: Can we somehow remove this once CSocket is implemented using non-blocking sockets?
fd_set rfds;
@@ -111,13 +113,13 @@ bool CIODevice::can_read_from_fd() const
int rc = CSyscallUtils::safe_syscall(select, m_fd + 1, &rfds, nullptr, nullptr, &timeout);
if (rc < 0) {
// NOTE: We don't set m_error here.
- perror("CIODevice::can_read: select");
+ perror("IODevice::can_read: select");
return false;
}
return FD_ISSET(m_fd, &rfds);
}
-bool CIODevice::can_read_line()
+bool IODevice::can_read_line()
{
if (m_eof && !m_buffered_data.is_empty())
return true;
@@ -129,12 +131,12 @@ bool CIODevice::can_read_line()
return m_buffered_data.contains_slow('\n');
}
-bool CIODevice::can_read() const
+bool IODevice::can_read() const
{
return !m_buffered_data.is_empty() || can_read_from_fd();
}
-ByteBuffer CIODevice::read_all()
+ByteBuffer IODevice::read_all()
{
off_t file_size = 0;
struct stat st;
@@ -168,7 +170,7 @@ ByteBuffer CIODevice::read_all()
return ByteBuffer::copy(data.data(), data.size());
}
-ByteBuffer CIODevice::read_line(int max_size)
+ByteBuffer IODevice::read_line(int max_size)
{
if (m_fd < 0)
return {};
@@ -178,7 +180,7 @@ ByteBuffer CIODevice::read_line(int max_size)
return {};
if (m_eof) {
if (m_buffered_data.size() > max_size) {
- dbgprintf("CIODevice::read_line: At EOF but there's more than max_size(%d) buffered\n", max_size);
+ dbgprintf("IODevice::read_line: At EOF but there's more than max_size(%d) buffered\n", max_size);
return {};
}
auto buffer = ByteBuffer::copy(m_buffered_data.data(), m_buffered_data.size());
@@ -202,7 +204,7 @@ ByteBuffer CIODevice::read_line(int max_size)
return {};
}
-bool CIODevice::populate_read_buffer()
+bool IODevice::populate_read_buffer()
{
if (m_fd < 0)
return false;
@@ -220,7 +222,7 @@ bool CIODevice::populate_read_buffer()
return true;
}
-bool CIODevice::close()
+bool IODevice::close()
{
if (fd() < 0 || mode() == NotOpen)
return false;
@@ -230,11 +232,11 @@ bool CIODevice::close()
return false;
}
set_fd(-1);
- set_mode(CIODevice::NotOpen);
+ set_mode(IODevice::NotOpen);
return true;
}
-bool CIODevice::seek(i64 offset, SeekMode mode, off_t* pos)
+bool IODevice::seek(i64 offset, SeekMode mode, off_t* pos)
{
int m = SEEK_SET;
switch (mode) {
@@ -262,18 +264,18 @@ bool CIODevice::seek(i64 offset, SeekMode mode, off_t* pos)
return true;
}
-bool CIODevice::write(const u8* data, int size)
+bool IODevice::write(const u8* data, int size)
{
int rc = ::write(m_fd, data, size);
if (rc < 0) {
- perror("CIODevice::write: write");
+ perror("IODevice::write: write");
set_error(errno);
return false;
}
return rc == size;
}
-int CIODevice::printf(const char* format, ...)
+int IODevice::printf(const char* format, ...)
{
va_list ap;
va_start(ap, format);
@@ -286,7 +288,7 @@ int CIODevice::printf(const char* format, ...)
return ret;
}
-void CIODevice::set_fd(int fd)
+void IODevice::set_fd(int fd)
{
if (m_fd == fd)
return;
@@ -294,3 +296,4 @@ void CIODevice::set_fd(int fd)
m_fd = fd;
did_update_fd(fd);
}
+}
diff --git a/Libraries/LibCore/CIODevice.h b/Libraries/LibCore/CIODevice.h
index 68b0c1b9c5..ac4d753e2b 100644
--- a/Libraries/LibCore/CIODevice.h
+++ b/Libraries/LibCore/CIODevice.h
@@ -30,8 +30,10 @@
#include <AK/StringView.h>
#include <LibCore/CObject.h>
-class CIODevice : public CObject {
- C_OBJECT_ABSTRACT(CIODevice)
+namespace Core {
+
+class IODevice : public Object {
+ C_OBJECT_ABSTRACT(IODevice)
public:
enum OpenMode {
NotOpen = 0,
@@ -43,7 +45,7 @@ public:
MustBeNew = 16,
};
- virtual ~CIODevice() override;
+ virtual ~IODevice() override;
int fd() const { return m_fd; }
unsigned mode() const { return m_mode; }
@@ -55,7 +57,6 @@ public:
bool has_error() const { return m_error != 0; }
-
int read(u8* buffer, int length);
ByteBuffer read(int max_size);
@@ -78,13 +79,13 @@ public:
bool seek(i64, SeekMode = SeekMode::SetPosition, off_t* = nullptr);
- virtual bool open(CIODevice::OpenMode) = 0;
+ virtual bool open(IODevice::OpenMode) = 0;
virtual bool close();
int printf(const char*, ...);
protected:
- explicit CIODevice(CObject* parent = nullptr);
+ explicit IODevice(Object* parent = nullptr);
void set_fd(int);
void set_mode(OpenMode mode) { m_mode = mode; }
@@ -103,3 +104,5 @@ private:
OpenMode m_mode { NotOpen };
Vector<u8> m_buffered_data;
};
+
+}
diff --git a/Libraries/LibCore/CIODeviceStreamReader.h b/Libraries/LibCore/CIODeviceStreamReader.h
index 24606d96dd..a7318ce8b7 100644
--- a/Libraries/LibCore/CIODeviceStreamReader.h
+++ b/Libraries/LibCore/CIODeviceStreamReader.h
@@ -29,9 +29,11 @@
#include <AK/StdLibExtras.h>
#include <LibCore/CIODevice.h>
-class CIODeviceStreamReader {
+namespace Core {
+
+class IODeviceStreamReader {
public:
- CIODeviceStreamReader(CIODevice& device)
+ IODeviceStreamReader(IODevice& device)
: m_device(device)
{
}
@@ -42,7 +44,7 @@ public:
}
template<typename T>
- CIODeviceStreamReader& operator>>(T& value)
+ IODeviceStreamReader& operator>>(T& value)
{
int nread = m_device.read((u8*)&value, sizeof(T));
ASSERT(nread == sizeof(T));
@@ -52,6 +54,8 @@ public:
}
private:
- CIODevice& m_device;
+ IODevice& m_device;
bool m_had_failure { false };
};
+
+}
diff --git a/Libraries/LibCore/CLocalServer.cpp b/Libraries/LibCore/CLocalServer.cpp
index 316a49aded..0f03ee0ab8 100644
--- a/Libraries/LibCore/CLocalServer.cpp
+++ b/Libraries/LibCore/CLocalServer.cpp
@@ -35,16 +35,18 @@
#include <sys/ioctl.h>
#endif
-CLocalServer::CLocalServer(CObject* parent)
- : CObject(parent)
+namespace Core {
+
+LocalServer::LocalServer(Object* parent)
+ : Object(parent)
{
}
-CLocalServer::~CLocalServer()
+LocalServer::~LocalServer()
{
}
-bool CLocalServer::take_over_from_system_server()
+bool LocalServer::take_over_from_system_server()
{
if (m_listening)
return false;
@@ -84,16 +86,16 @@ bool CLocalServer::take_over_from_system_server()
return false;
}
-void CLocalServer::setup_notifier()
+void LocalServer::setup_notifier()
{
- m_notifier = CNotifier::construct(m_fd, CNotifier::Event::Read, this);
+ m_notifier = Notifier::construct(m_fd, Notifier::Event::Read, this);
m_notifier->on_ready_to_read = [this] {
if (on_ready_to_accept)
on_ready_to_accept();
};
}
-bool CLocalServer::listen(const String& address)
+bool LocalServer::listen(const String& address)
{
if (m_listening)
return false;
@@ -116,7 +118,7 @@ bool CLocalServer::listen(const String& address)
ASSERT_NOT_REACHED();
}
- auto socket_address = CSocketAddress::local(address);
+ auto socket_address = SocketAddress::local(address);
auto un = socket_address.to_sockaddr_un();
rc = ::bind(m_fd, (const sockaddr*)&un, sizeof(un));
if (rc < 0) {
@@ -135,7 +137,7 @@ bool CLocalServer::listen(const String& address)
return true;
}
-RefPtr<CLocalSocket> CLocalServer::accept()
+RefPtr<LocalSocket> LocalServer::accept()
{
ASSERT(m_listening);
sockaddr_un un;
@@ -146,5 +148,7 @@ RefPtr<CLocalSocket> CLocalServer::accept()
return nullptr;
}
- return CLocalSocket::construct(accepted_fd);
+ return LocalSocket::construct(accepted_fd);
+}
+
}
diff --git a/Libraries/LibCore/CLocalServer.h b/Libraries/LibCore/CLocalServer.h
index 1c00adb824..05ee7942ca 100644
--- a/Libraries/LibCore/CLocalServer.h
+++ b/Libraries/LibCore/CLocalServer.h
@@ -29,27 +29,31 @@
#include <LibCore/CNotifier.h>
#include <LibCore/CObject.h>
-class CLocalSocket;
+namespace Core {
-class CLocalServer : public CObject {
- C_OBJECT(CLocalServer)
+class LocalSocket;
+
+class LocalServer : public Object {
+ C_OBJECT(LocalServer)
public:
- virtual ~CLocalServer() override;
+ virtual ~LocalServer() override;
bool take_over_from_system_server();
bool is_listening() const { return m_listening; }
bool listen(const String& address);
- RefPtr<CLocalSocket> accept();
+ RefPtr<LocalSocket> accept();
Function<void()> on_ready_to_accept;
private:
- explicit CLocalServer(CObject* parent = nullptr);
+ explicit LocalServer(Object* parent = nullptr);
void setup_notifier();
int m_fd { -1 };
bool m_listening { false };
- RefPtr<CNotifier> m_notifier;
+ RefPtr<Notifier> m_notifier;
};
+
+}
diff --git a/Libraries/LibCore/CLocalSocket.cpp b/Libraries/LibCore/CLocalSocket.cpp
index d957c24d3f..c9e92eceb8 100644
--- a/Libraries/LibCore/CLocalSocket.cpp
+++ b/Libraries/LibCore/CLocalSocket.cpp
@@ -25,27 +25,29 @@
*/
#include <LibCore/CLocalSocket.h>
-#include <sys/socket.h>
#include <errno.h>
+#include <sys/socket.h>
#ifndef SOCK_NONBLOCK
-#include <sys/ioctl.h>
+# include <sys/ioctl.h>
#endif
-CLocalSocket::CLocalSocket(int fd, CObject* parent)
- : CSocket(CSocket::Type::Local, parent)
+namespace Core {
+
+LocalSocket::LocalSocket(int fd, Object* parent)
+ : Socket(Socket::Type::Local, parent)
{
// NOTE: This constructor is used by CLocalServer::accept(), so the socket is already connected.
m_connected = true;
set_fd(fd);
- set_mode(CIODevice::ReadWrite);
+ set_mode(IODevice::ReadWrite);
set_error(0);
}
-CLocalSocket::CLocalSocket(CObject* parent)
- : CSocket(CSocket::Type::Local, parent)
+LocalSocket::LocalSocket(Object* parent)
+ : Socket(Socket::Type::Local, parent)
{
-
+
#ifdef SOCK_NONBLOCK
int fd = socket(AF_LOCAL, SOCK_STREAM | SOCK_NONBLOCK | SOCK_CLOEXEC, 0);
#else
@@ -59,11 +61,13 @@ CLocalSocket::CLocalSocket(CObject* parent)
set_error(errno);
} else {
set_fd(fd);
- set_mode(CIODevice::ReadWrite);
+ set_mode(IODevice::ReadWrite);
set_error(0);
}
}
-CLocalSocket::~CLocalSocket()
+LocalSocket::~LocalSocket()
{
}
+
+}
diff --git a/Libraries/LibCore/CLocalSocket.h b/Libraries/LibCore/CLocalSocket.h
index 428c37ca2b..6d32bc3395 100644
--- a/Libraries/LibCore/CLocalSocket.h
+++ b/Libraries/LibCore/CLocalSocket.h
@@ -29,14 +29,18 @@
#include <AK/Badge.h>
#include <LibCore/CSocket.h>
-class CLocalServer;
+namespace Core {
-class CLocalSocket final : public CSocket {
- C_OBJECT(CLocalSocket)
+class LocalServer;
+
+class LocalSocket final : public Socket {
+ C_OBJECT(LocalSocket)
public:
- virtual ~CLocalSocket() override;
+ virtual ~LocalSocket() override;
private:
- explicit CLocalSocket(CObject* parent = nullptr);
- CLocalSocket(int fd, CObject* parent = nullptr);
+ explicit LocalSocket(Object* parent = nullptr);
+ LocalSocket(int fd, Object* parent = nullptr);
};
+
+}
diff --git a/Libraries/LibCore/CNetworkJob.cpp b/Libraries/LibCore/CNetworkJob.cpp
index 6e39b15a7d..e8be9a421c 100644
--- a/Libraries/LibCore/CNetworkJob.cpp
+++ b/Libraries/LibCore/CNetworkJob.cpp
@@ -30,19 +30,21 @@
//#define CNETWORKJOB_DEBUG
-CNetworkJob::CNetworkJob()
+namespace Core {
+
+NetworkJob::NetworkJob()
{
}
-CNetworkJob::~CNetworkJob()
+NetworkJob::~NetworkJob()
{
}
-void CNetworkJob::did_finish(NonnullRefPtr<CNetworkResponse>&& response)
+void NetworkJob::did_finish(NonnullRefPtr<NetworkResponse>&& response)
{
// NOTE: We protect ourselves here, since the on_finish callback may otherwise
// trigger destruction of this job somehow.
- NonnullRefPtr<CNetworkJob> protector(*this);
+ NonnullRefPtr<NetworkJob> protector(*this);
m_response = move(response);
#ifdef CNETWORKJOB_DEBUG
@@ -53,11 +55,11 @@ void CNetworkJob::did_finish(NonnullRefPtr<CNetworkResponse>&& response)
shutdown();
}
-void CNetworkJob::did_fail(Error error)
+void NetworkJob::did_fail(Error error)
{
// NOTE: We protect ourselves here, since the on_finish callback may otherwise
// trigger destruction of this job somehow.
- NonnullRefPtr<CNetworkJob> protector(*this);
+ NonnullRefPtr<NetworkJob> protector(*this);
m_error = error;
#ifdef CNETWORKJOB_DEBUG
@@ -68,18 +70,20 @@ void CNetworkJob::did_fail(Error error)
shutdown();
}
-const char* to_string(CNetworkJob::Error error)
+const char* to_string(NetworkJob::Error error)
{
switch (error) {
- case CNetworkJob::Error::ProtocolFailed:
+ case NetworkJob::Error::ProtocolFailed:
return "ProtocolFailed";
- case CNetworkJob::Error::ConnectionFailed:
+ case NetworkJob::Error::ConnectionFailed:
return "ConnectionFailed";
- case CNetworkJob::Error::TransmissionFailed:
+ case NetworkJob::Error::TransmissionFailed:
return "TransmissionFailed";
- case CNetworkJob::Error::Cancelled:
+ case NetworkJob::Error::Cancelled:
return "Cancelled";
default:
return "(Unknown error)";
}
}
+
+}
diff --git a/Libraries/LibCore/CNetworkJob.h b/Libraries/LibCore/CNetworkJob.h
index be1862a0f5..9c2dcad14c 100644
--- a/Libraries/LibCore/CNetworkJob.h
+++ b/Libraries/LibCore/CNetworkJob.h
@@ -29,10 +29,12 @@
#include <AK/Function.h>
#include <LibCore/CObject.h>
-class CNetworkResponse;
+namespace Core {
-class CNetworkJob : public CObject {
- C_OBJECT(CNetworkJob)
+class NetworkResponse;
+
+class NetworkJob : public Object {
+ C_OBJECT_ABSTRACT(NetworkJob)
public:
enum class Error {
None,
@@ -41,15 +43,15 @@ public:
ProtocolFailed,
Cancelled,
};
- virtual ~CNetworkJob() override;
+ virtual ~NetworkJob() override;
Function<void(bool success)> on_finish;
bool is_cancelled() const { return m_error == Error::Cancelled; }
bool has_error() const { return m_error != Error::None; }
Error error() const { return m_error; }
- CNetworkResponse* response() { return m_response.ptr(); }
- const CNetworkResponse* response() const { return m_response.ptr(); }
+ NetworkResponse* response() { return m_response.ptr(); }
+ const NetworkResponse* response() const { return m_response.ptr(); }
virtual void start() = 0;
virtual void shutdown() = 0;
@@ -61,13 +63,15 @@ public:
}
protected:
- CNetworkJob();
- void did_finish(NonnullRefPtr<CNetworkResponse>&&);
+ NetworkJob();
+ void did_finish(NonnullRefPtr<NetworkResponse>&&);
void did_fail(Error);
private:
- RefPtr<CNetworkResponse> m_response;
+ RefPtr<NetworkResponse> m_response;
Error m_error { Error::None };
};
-const char* to_string(CNetworkJob::Error);
+const char* to_string(NetworkJob::Error);
+
+}
diff --git a/Libraries/LibCore/CNetworkResponse.cpp b/Libraries/LibCore/CNetworkResponse.cpp
index 1fc52507f4..f61b559129 100644
--- a/Libraries/LibCore/CNetworkResponse.cpp
+++ b/Libraries/LibCore/CNetworkResponse.cpp
@@ -26,11 +26,15 @@
#include <LibCore/CNetworkResponse.h>
-CNetworkResponse::CNetworkResponse(ByteBuffer&& payload)
+namespace Core {
+
+NetworkResponse::NetworkResponse(ByteBuffer&& payload)
: m_payload(payload)
{
}
-CNetworkResponse::~CNetworkResponse()
+NetworkResponse::~NetworkResponse()
{
}
+
+}
diff --git a/Libraries/LibCore/CNetworkResponse.h b/Libraries/LibCore/CNetworkResponse.h
index 0431c567de..d39e2832eb 100644
--- a/Libraries/LibCore/CNetworkResponse.h
+++ b/Libraries/LibCore/CNetworkResponse.h
@@ -29,16 +29,20 @@
#include <AK/ByteBuffer.h>
#include <AK/RefCounted.h>
-class CNetworkResponse : public RefCounted<CNetworkResponse> {
+namespace Core {
+
+class NetworkResponse : public RefCounted<NetworkResponse> {
public:
- virtual ~CNetworkResponse();
+ virtual ~NetworkResponse();
bool is_error() const { return m_error; }
const ByteBuffer& payload() const { return m_payload; }
protected:
- explicit CNetworkResponse(ByteBuffer&&);
+ explicit NetworkResponse(ByteBuffer&&);
bool m_error { false };
ByteBuffer m_payload;
};
+
+}
diff --git a/Libraries/LibCore/CNotifier.cpp b/Libraries/LibCore/CNotifier.cpp
index fd68858909..a02f317d19 100644
--- a/Libraries/LibCore/CNotifier.cpp
+++ b/Libraries/LibCore/CNotifier.cpp
@@ -28,34 +28,38 @@
#include <LibCore/CEventLoop.h>
#include <LibCore/CNotifier.h>
-CNotifier::CNotifier(int fd, unsigned event_mask, CObject* parent)
- : CObject(parent)
+namespace Core {
+
+Notifier::Notifier(int fd, unsigned event_mask, Object* parent)
+ : Object(parent)
, m_fd(fd)
, m_event_mask(event_mask)
{
set_enabled(true);
}
-CNotifier::~CNotifier()
+Notifier::~Notifier()
{
set_enabled(false);
}
-void CNotifier::set_enabled(bool enabled)
+void Notifier::set_enabled(bool enabled)
{
if (enabled)
- CEventLoop::register_notifier({}, *this);
+ Core::EventLoop::register_notifier({}, *this);
else
- CEventLoop::unregister_notifier({}, *this);
+ Core::EventLoop::unregister_notifier({}, *this);
}
-void CNotifier::event(CEvent& event)
+void Notifier::event(Core::Event& event)
{
- if (event.type() == CEvent::NotifierRead && on_ready_to_read) {
+ if (event.type() == Core::Event::NotifierRead && on_ready_to_read) {
on_ready_to_read();
- } else if (event.type() == CEvent::NotifierWrite && on_ready_to_write) {
+ } else if (event.type() == Core::Event::NotifierWrite && on_ready_to_write) {
on_ready_to_write();
} else {
- CObject::event(event);
+ Object::event(event);
}
}
+
+}
diff --git a/Libraries/LibCore/CNotifier.h b/Libraries/LibCore/CNotifier.h
index 820ac0bf77..9c21c3357a 100644
--- a/Libraries/LibCore/CNotifier.h
+++ b/Libraries/LibCore/CNotifier.h
@@ -29,8 +29,10 @@
#include <AK/Function.h>
#include <LibCore/CObject.h>
-class CNotifier : public CObject {
- C_OBJECT(CNotifier)
+namespace Core {
+
+class Notifier : public Object {
+ C_OBJECT(Notifier)
public:
enum Event {
None = 0,
@@ -39,7 +41,7 @@ public:
Exceptional = 4,
};
- virtual ~CNotifier() override;
+ virtual ~Notifier() override;
void set_enabled(bool);
@@ -50,11 +52,13 @@ public:
unsigned event_mask() const { return m_event_mask; }
void set_event_mask(unsigned event_mask) { m_event_mask = event_mask; }
- void event(CEvent&) override;
+ void event(Core::Event&) override;
private:
- CNotifier(int fd, unsigned event_mask, CObject* parent = nullptr);
+ Notifier(int fd, unsigned event_mask, Object* parent = nullptr);
int m_fd { -1 };
unsigned m_event_mask { 0 };
};
+
+}
diff --git a/Libraries/LibCore/CObject.cpp b/Libraries/LibCore/CObject.cpp
index 4f8b7facc8..9bb1245628 100644
--- a/Libraries/LibCore/CObject.cpp
+++ b/Libraries/LibCore/CObject.cpp
@@ -32,13 +32,15 @@
#include <LibCore/CObject.h>
#include <stdio.h>
-IntrusiveList<CObject, &CObject::m_all_objects_list_node>& CObject::all_objects()
+namespace Core {
+
+IntrusiveList<Object, &Object::m_all_objects_list_node>& Object::all_objects()
{
- static IntrusiveList<CObject, &CObject::m_all_objects_list_node> objects;
+ static IntrusiveList<Object, &Object::m_all_objects_list_node> objects;
return objects;
}
-CObject::CObject(CObject* parent, bool is_widget)
+Object::Object(Object* parent, bool is_widget)
: m_parent(parent)
, m_widget(is_widget)
{
@@ -47,7 +49,7 @@ CObject::CObject(CObject* parent, bool is_widget)
m_parent->add_child(*this);
}
-CObject::~CObject()
+Object::~Object()
{
// NOTE: We move our children out to a stack vector to prevent other
// code from trying to iterate over them.
@@ -63,89 +65,89 @@ CObject::~CObject()
m_parent->remove_child(*this);
}
-void CObject::event(CEvent& event)
+void Object::event(Core::Event& event)
{
switch (event.type()) {
- case CEvent::Timer:
- return timer_event(static_cast<CTimerEvent&>(event));
- case CEvent::ChildAdded:
- case CEvent::ChildRemoved:
- return child_event(static_cast<CChildEvent&>(event));
- case CEvent::Invalid:
+ case Core::Event::Timer:
+ return timer_event(static_cast<TimerEvent&>(event));
+ case Core::Event::ChildAdded:
+ case Core::Event::ChildRemoved:
+ return child_event(static_cast<ChildEvent&>(event));
+ case Core::Event::Invalid:
ASSERT_NOT_REACHED();
break;
- case CEvent::Custom:
- return custom_event(static_cast<CCustomEvent&>(event));
+ case Core::Event::Custom:
+ return custom_event(static_cast<CustomEvent&>(event));
default:
break;
}
}
-void CObject::add_child(CObject& object)
+void Object::add_child(Object& object)
{
// FIXME: Should we support reparenting objects?
ASSERT(!object.parent() || object.parent() == this);
object.m_parent = this;
m_children.append(object);
- event(*make<CChildEvent>(CEvent::ChildAdded, object));
+ event(*make<Core::ChildEvent>(Core::Event::ChildAdded, object));
}
-void CObject::insert_child_before(CObject& new_child, CObject& before_child)
+void Object::insert_child_before(Object& new_child, Object& before_child)
{
// FIXME: Should we support reparenting objects?
ASSERT(!new_child.parent() || new_child.parent() == this);
new_child.m_parent = this;
m_children.insert_before_matching(new_child, [&](auto& existing_child) { return existing_child.ptr() == &before_child; });
- event(*make<CChildEvent>(CEvent::ChildAdded, new_child, &before_child));
+ event(*make<Core::ChildEvent>(Core::Event::ChildAdded, new_child, &before_child));
}
-void CObject::remove_child(CObject& object)
+void Object::remove_child(Object& object)
{
for (int i = 0; i < m_children.size(); ++i) {
if (m_children.ptr_at(i).ptr() == &object) {
// NOTE: We protect the child so it survives the handling of ChildRemoved.
- NonnullRefPtr<CObject> protector = object;
+ NonnullRefPtr<Object> protector = object;
object.m_parent = nullptr;
m_children.remove(i);
- event(*make<CChildEvent>(CEvent::ChildRemoved, object));
+ event(*make<Core::ChildEvent>(Core::Event::ChildRemoved, object));
return;
}
}
ASSERT_NOT_REACHED();
}
-void CObject::timer_event(CTimerEvent&)
+void Object::timer_event(Core::TimerEvent&)
{
}
-void CObject::child_event(CChildEvent&)
+void Object::child_event(Core::ChildEvent&)
{
}
-void CObject::custom_event(CCustomEvent&)
+void Object::custom_event(CustomEvent&)
{
}
-void CObject::start_timer(int ms, TimerShouldFireWhenNotVisible fire_when_not_visible)
+void Object::start_timer(int ms, TimerShouldFireWhenNotVisible fire_when_not_visible)
{
if (m_timer_id) {
- dbgprintf("CObject{%p} already has a timer!\n", this);
+ dbgprintf("Object{%p} already has a timer!\n", this);
ASSERT_NOT_REACHED();
}
- m_timer_id = CEventLoop::register_timer(*this, ms, true, fire_when_not_visible);
+ m_timer_id = Core::EventLoop::register_timer(*this, ms, true, fire_when_not_visible);
}
-void CObject::stop_timer()
+void Object::stop_timer()
{
if (!m_timer_id)
return;
- bool success = CEventLoop::unregister_timer(m_timer_id);
+ bool success = Core::EventLoop::unregister_timer(m_timer_id);
ASSERT(success);
m_timer_id = 0;
}
-void CObject::dump_tree(int indent)
+void Object::dump_tree(int indent)
{
for (int i = 0; i < indent; ++i) {
printf(" ");
@@ -158,12 +160,12 @@ void CObject::dump_tree(int indent)
});
}
-void CObject::deferred_invoke(Function<void(CObject&)> invokee)
+void Object::deferred_invoke(Function<void(Object&)> invokee)
{
- CEventLoop::current().post_event(*this, make<CDeferredInvocationEvent>(move(invokee)));
+ Core::EventLoop::current().post_event(*this, make<Core::DeferredInvocationEvent>(move(invokee)));
}
-void CObject::save_to(JsonObject& json)
+void Object::save_to(JsonObject& json)
{
json.set("class_name", class_name());
json.set("address", String::format("%p", this));
@@ -171,7 +173,7 @@ void CObject::save_to(JsonObject& json)
json.set("parent", String::format("%p", parent()));
}
-bool CObject::is_ancestor_of(const CObject& other) const
+bool Object::is_ancestor_of(const Object& other) const
{
if (&other == this)
return false;
@@ -182,7 +184,7 @@ bool CObject::is_ancestor_of(const CObject& other) const
return false;
}
-void CObject::dispatch_event(CEvent& e, CObject* stay_within)
+void Object::dispatch_event(Core::Event& e, Object* stay_within)
{
ASSERT(!stay_within || stay_within == this || stay_within->is_ancestor_of(*this));
auto* target = this;
@@ -197,9 +199,11 @@ void CObject::dispatch_event(CEvent& e, CObject* stay_within)
} while (target && !e.is_accepted());
}
-bool CObject::is_visible_for_timer_purposes() const
+bool Object::is_visible_for_timer_purposes() const
{
if (parent())
return parent()->is_visible_for_timer_purposes();
return true;
}
+
+}
diff --git a/Libraries/LibCore/CObject.h b/Libraries/LibCore/CObject.h
index df4ad4b815..bc86be1350 100644
--- a/Libraries/LibCore/CObject.h
+++ b/Libraries/LibCore/CObject.h
@@ -40,16 +40,18 @@ namespace AK {
class JsonObject;
}
+namespace Core {
+
enum class TimerShouldFireWhenNotVisible {
No = 0,
Yes
};
-class CEvent;
-class CEventLoop;
-class CChildEvent;
-class CCustomEvent;
-class CTimerEvent;
+class ChildEvent;
+class CustomEvent;
+class Event;
+class EventLoop;
+class TimerEvent;
#define C_OBJECT(klass) \
public: \
@@ -64,26 +66,26 @@ public: \
public: \
virtual const char* class_name() const override { return #klass; }
-class CObject
- : public RefCounted<CObject>
- , public Weakable<CObject> {
- // NOTE: No C_OBJECT macro for CObject itself.
+class Object
+ : public RefCounted<Object>
+ , public Weakable<Object> {
+ // NOTE: No C_OBJECT macro for Core::Object itself.
- AK_MAKE_NONCOPYABLE(CObject)
- AK_MAKE_NONMOVABLE(CObject)
+ AK_MAKE_NONCOPYABLE(Object)
+ AK_MAKE_NONMOVABLE(Object)
public:
IntrusiveListNode m_all_objects_list_node;
- virtual ~CObject();
+ virtual ~Object();
virtual const char* class_name() const = 0;
- virtual void event(CEvent&);
+ virtual void event(Core::Event&);
const String& name() const { return m_name; }
void set_name(const StringView& name) { m_name = name; }
- NonnullRefPtrVector<CObject>& children() { return m_children; }
- const NonnullRefPtrVector<CObject>& children() const { return m_children; }
+ NonnullRefPtrVector<Object>& children() { return m_children; }
+ const NonnullRefPtrVector<Object>& children() const { return m_children; }
template<typename Callback>
void for_each_child(Callback callback)
@@ -97,22 +99,22 @@ public:
template<typename T, typename Callback>
void for_each_child_of_type(Callback callback);
- bool is_ancestor_of(const CObject&) const;
+ bool is_ancestor_of(const Object&) const;
- CObject* parent() { return m_parent; }
- const CObject* parent() const { return m_parent; }
+ Object* parent() { return m_parent; }
+ const Object* parent() const { return m_parent; }
void start_timer(int ms, TimerShouldFireWhenNotVisible = TimerShouldFireWhenNotVisible::No);
void stop_timer();
bool has_timer() const { return m_timer_id; }
- void add_child(CObject&);
- void insert_child_before(CObject& new_child, CObject& before_child);
- void remove_child(CObject&);
+ void add_child(Object&);
+ void insert_child_before(Object& new_child, Object& before_child);
+ void remove_child(Object&);
void dump_tree(int indent = 0);
- void deferred_invoke(Function<void(CObject&)>);
+ void deferred_invoke(Function<void(Object&)>);
bool is_widget() const { return m_widget; }
virtual bool is_action() const { return false; }
@@ -120,9 +122,9 @@ public:
virtual void save_to(AK::JsonObject&);
- static IntrusiveList<CObject, &CObject::m_all_objects_list_node>& all_objects();
+ static IntrusiveList<Object, &Object::m_all_objects_list_node>& all_objects();
- void dispatch_event(CEvent&, CObject* stay_within = nullptr);
+ void dispatch_event(Core::Event&, Object* stay_within = nullptr);
void remove_from_parent()
{
@@ -133,41 +135,41 @@ public:
virtual bool is_visible_for_timer_purposes() const;
protected:
- explicit CObject(CObject* parent = nullptr, bool is_widget = false);
+ explicit Object(Object* parent = nullptr, bool is_widget = false);
- virtual void timer_event(CTimerEvent&);
- virtual void custom_event(CCustomEvent&);
+ virtual void timer_event(TimerEvent&);
+ virtual void custom_event(CustomEvent&);
// NOTE: You may get child events for children that are not yet fully constructed!
- virtual void child_event(CChildEvent&);
+ virtual void child_event(ChildEvent&);
private:
- CObject* m_parent { nullptr };
+ Object* m_parent { nullptr };
String m_name;
int m_timer_id { 0 };
bool m_widget { false };
- NonnullRefPtrVector<CObject> m_children;
+ NonnullRefPtrVector<Object> m_children;
};
template<typename T>
-inline bool is(const CObject&) { return false; }
+inline bool is(const Object&) { return false; }
template<typename T>
-inline T& to(CObject& object)
+inline T& to(Object& object)
{
ASSERT(is<typename RemoveConst<T>::Type>(object));
return static_cast<T&>(object);
}
template<typename T>
-inline const T& to(const CObject& object)
+inline const T& to(const Object& object)
{
ASSERT(is<typename RemoveConst<T>::Type>(object));
return static_cast<const T&>(object);
}
template<typename T, typename Callback>
-inline void CObject::for_each_child_of_type(Callback callback)
+inline void Object::for_each_child_of_type(Callback callback)
{
for_each_child([&](auto& child) {
if (is<T>(child))
@@ -176,7 +178,9 @@ inline void CObject::for_each_child_of_type(Callback callback)
});
}
-inline const LogStream& operator<<(const LogStream& stream, const CObject& object)
+inline const LogStream& operator<<(const LogStream& stream, const Object& object)
{
return stream << object.class_name() << '{' << &object << '}';
}
+
+}
diff --git a/Libraries/LibCore/CProcessStatisticsReader.cpp b/Libraries/LibCore/CProcessStatisticsReader.cpp
index 51c237513a..815dc52f14 100644
--- a/Libraries/LibCore/CProcessStatisticsReader.cpp
+++ b/Libraries/LibCore/CProcessStatisticsReader.cpp
@@ -32,23 +32,25 @@
#include <pwd.h>
#include <stdio.h>
-HashMap<uid_t, String> CProcessStatisticsReader::s_usernames;
+namespace Core {
-HashMap<pid_t, CProcessStatistics> CProcessStatisticsReader::get_all()
+HashMap<uid_t, String> ProcessStatisticsReader::s_usernames;
+
+HashMap<pid_t, Core::ProcessStatistics> ProcessStatisticsReader::get_all()
{
- auto file = CFile::construct("/proc/all");
- if (!file->open(CIODevice::ReadOnly)) {
+ auto file = Core::File::construct("/proc/all");
+ if (!file->open(Core::IODevice::ReadOnly)) {
fprintf(stderr, "CProcessStatisticsReader: Failed to open /proc/all: %s\n", file->error_string());
return {};
}
- HashMap<pid_t, CProcessStatistics> map;
+ HashMap<pid_t, Core::ProcessStatistics> map;
auto file_contents = file->read_all();
auto json = JsonValue::from_string({ file_contents.data(), (size_t)file_contents.size() });
json.as_array().for_each([&](auto& value) {
const JsonObject& process_object = value.as_object();
- CProcessStatistics process;
+ Core::ProcessStatistics process;
// kernel data first
process.pid = process_object.get("pid").to_u32();
@@ -76,7 +78,7 @@ HashMap<pid_t, CProcessStatistics> CProcessStatisticsReader::get_all()
process.threads.ensure_capacity(thread_array.size());
thread_array.for_each([&](auto& value) {
auto& thread_object = value.as_object();
- CThreadStatistics thread;
+ Core::ThreadStatistics thread;
thread.tid = thread_object.get("tid").to_u32();
thread.times_scheduled = thread_object.get("times_scheduled").to_u32();
thread.name = thread_object.get("name").to_string();
@@ -105,7 +107,7 @@ HashMap<pid_t, CProcessStatistics> CProcessStatisticsReader::get_all()
return map;
}
-String CProcessStatisticsReader::username_from_uid(uid_t uid)
+String ProcessStatisticsReader::username_from_uid(uid_t uid)
{
if (s_usernames.is_empty()) {
setpwent();
@@ -119,3 +121,4 @@ String CProcessStatisticsReader::username_from_uid(uid_t uid)
return (*it).value;
return String::number(uid);
}
+}
diff --git a/Libraries/LibCore/CProcessStatisticsReader.h b/Libraries/LibCore/CProcessStatisticsReader.h
index c5b7aaeb91..d0850f2d48 100644
--- a/Libraries/LibCore/CProcessStatisticsReader.h
+++ b/Libraries/LibCore/CProcessStatisticsReader.h
@@ -30,7 +30,9 @@
#include <AK/String.h>
#include <unistd.h>
-struct CThreadStatistics {
+namespace Core {
+
+struct ThreadStatistics {
int tid;
unsigned times_scheduled;
unsigned ticks;
@@ -50,7 +52,7 @@ struct CThreadStatistics {
String name;
};
-struct CProcessStatistics {
+struct ProcessStatistics {
// Keep this in sync with /proc/all.
// From the kernel side:
pid_t pid;
@@ -74,17 +76,19 @@ struct CProcessStatistics {
size_t amount_purgeable_nonvolatile;
int icon_id;
- Vector<CThreadStatistics> threads;
+ Vector<Core::ThreadStatistics> threads;
// synthetic
String username;
};
-class CProcessStatisticsReader {
+class ProcessStatisticsReader {
public:
- static HashMap<pid_t, CProcessStatistics> get_all();
+ static HashMap<pid_t, Core::ProcessStatistics> get_all();
private:
static String username_from_uid(uid_t);
static HashMap<uid_t, String> s_usernames;
};
+
+}
diff --git a/Libraries/LibCore/CSocket.cpp b/Libraries/LibCore/CSocket.cpp
index 135911b01c..e16ef730ea 100644
--- a/Libraries/LibCore/CSocket.cpp
+++ b/Libraries/LibCore/CSocket.cpp
@@ -38,33 +38,35 @@
//#define CSOCKET_DEBUG
-CSocket::CSocket(Type type, CObject* parent)
- : CIODevice(parent)
+namespace Core {
+
+Socket::Socket(Type type, Object* parent)
+ : IODevice(parent)
, m_type(type)
{
}
-CSocket::~CSocket()
+Socket::~Socket()
{
close();
}
-bool CSocket::connect(const String& hostname, int port)
+bool Socket::connect(const String& hostname, int port)
{
auto* hostent = gethostbyname(hostname.characters());
if (!hostent) {
- dbg() << "CSocket::connect: Unable to resolve '" << hostname << "'";
+ dbg() << "Socket::connect: Unable to resolve '" << hostname << "'";
return false;
}
IPv4Address host_address((const u8*)hostent->h_addr_list[0]);
#ifdef CSOCKET_DEBUG
- dbg() << "CSocket::connect: Resolved '" << hostname << "' to " << host_address;
+ dbg() << "Socket::connect: Resolved '" << hostname << "' to " << host_address;
#endif
return connect(host_address, port);
}
-void CSocket::set_blocking(bool blocking)
+void Socket::set_blocking(bool blocking)
{
int flags = fcntl(fd(), F_GETFL, 0);
ASSERT(flags >= 0);
@@ -75,10 +77,10 @@ void CSocket::set_blocking(bool blocking)
ASSERT(flags == 0);
}
-bool CSocket::connect(const CSocketAddress& address, int port)
+bool Socket::connect(const SocketAddress& address, int port)
{
ASSERT(!is_connected());
- ASSERT(address.type() == CSocketAddress::Type::IPv4);
+ ASSERT(address.type() == SocketAddress::Type::IPv4);
#ifdef CSOCKET_DEBUG
dbg() << *this << " connecting to " << address << "...";
#endif
@@ -98,10 +100,10 @@ bool CSocket::connect(const CSocketAddress& address, int port)
return common_connect((struct sockaddr*)&addr, sizeof(addr));
}
-bool CSocket::connect(const CSocketAddress& address)
+bool Socket::connect(const SocketAddress& address)
{
ASSERT(!is_connected());
- ASSERT(address.type() == CSocketAddress::Type::Local);
+ ASSERT(address.type() == SocketAddress::Type::Local);
#ifdef CSOCKET_DEBUG
dbg() << *this << " connecting to " << address << "...";
#endif
@@ -113,7 +115,7 @@ bool CSocket::connect(const CSocketAddress& address)
return common_connect((const sockaddr*)&saddr, sizeof(saddr));
}
-bool CSocket::common_connect(const struct sockaddr* addr, socklen_t addrlen)
+bool Socket::common_connect(const struct sockaddr* addr, socklen_t addrlen)
{
int rc = ::connect(fd(), addr, addrlen);
if (rc < 0) {
@@ -121,20 +123,20 @@ bool CSocket::common_connect(const struct sockaddr* addr, socklen_t addrlen)
#ifdef CSOCKET_DEBUG
dbg() << *this << " connection in progress (EINPROGRESS)";
#endif
- m_notifier = CNotifier::construct(fd(), CNotifier::Event::Write, this);
+ m_notifier = Notifier::construct(fd(), Notifier::Event::Write, this);
m_notifier->on_ready_to_write = [this] {
#ifdef CSOCKET_DEBUG
dbg() << *this << " connected!";
#endif
m_connected = true;
ensure_read_notifier();
- m_notifier->set_event_mask(CNotifier::Event::None);
+ m_notifier->set_event_mask(Notifier::Event::None);
if (on_connected)
on_connected();
};
return true;
}
- perror("CSocket::common_connect: connect");
+ perror("Socket::common_connect: connect");
return false;
}
#ifdef CSOCKET_DEBUG
@@ -147,7 +149,7 @@ bool CSocket::common_connect(const struct sockaddr* addr, socklen_t addrlen)
return true;
}
-ByteBuffer CSocket::receive(int max_size)
+ByteBuffer Socket::receive(int max_size)
{
auto buffer = read(max_size);
if (eof()) {
@@ -157,7 +159,7 @@ ByteBuffer CSocket::receive(int max_size)
return buffer;
}
-bool CSocket::send(const ByteBuffer& data)
+bool Socket::send(const ByteBuffer& data)
{
int nsent = ::send(fd(), data.data(), data.size(), 0);
if (nsent < 0) {
@@ -168,7 +170,7 @@ bool CSocket::send(const ByteBuffer& data)
return true;
}
-void CSocket::did_update_fd(int fd)
+void Socket::did_update_fd(int fd)
{
if (fd < 0) {
m_read_notifier = nullptr;
@@ -182,12 +184,14 @@ void CSocket::did_update_fd(int fd)
}
}
-void CSocket::ensure_read_notifier()
+void Socket::ensure_read_notifier()
{
ASSERT(m_connected);
- m_read_notifier = CNotifier::construct(fd(), CNotifier::Event::Read, this);
+ m_read_notifier = Notifier::construct(fd(), Notifier::Event::Read, this);
m_read_notifier->on_ready_to_read = [this] {
if (on_ready_to_read)
on_ready_to_read();
};
}
+
+}
diff --git a/Libraries/LibCore/CSocket.h b/Libraries/LibCore/CSocket.h
index afd78164b5..5538bbd2b8 100644
--- a/Libraries/LibCore/CSocket.h
+++ b/Libraries/LibCore/CSocket.h
@@ -29,10 +29,12 @@
#include <LibCore/CIODevice.h>
#include <LibCore/CSocketAddress.h>
-class CNotifier;
+namespace Core {
-class CSocket : public CIODevice {
- C_OBJECT(CSocket)
+class Notifier;
+
+class Socket : public IODevice {
+ C_OBJECT(Socket)
public:
enum class Type {
Invalid,
@@ -40,13 +42,13 @@ public:
UDP,
Local,
};
- virtual ~CSocket() override;
+ virtual ~Socket() override;
Type type() const { return m_type; }
bool connect(const String& hostname, int port);
- bool connect(const CSocketAddress&, int port);
- bool connect(const CSocketAddress&);
+ bool connect(const SocketAddress&, int port);
+ bool connect(const SocketAddress&);
ByteBuffer receive(int max_size);
bool send(const ByteBuffer&);
@@ -54,20 +56,20 @@ public:
bool is_connected() const { return m_connected; }
void set_blocking(bool blocking);
- CSocketAddress source_address() const { return m_source_address; }
+ SocketAddress source_address() const { return m_source_address; }
int source_port() const { return m_source_port; }
- CSocketAddress destination_address() const { return m_source_address; }
+ SocketAddress destination_address() const { return m_source_address; }
int destination_port() const { return m_destination_port; }
Function<void()> on_connected;
Function<void()> on_ready_to_read;
protected:
- CSocket(Type, CObject* parent);
+ Socket(Type, Object* parent);
- CSocketAddress m_source_address;
- CSocketAddress m_destination_address;
+ SocketAddress m_source_address;
+ SocketAddress m_destination_address;
int m_source_port { -1 };
int m_destination_port { -1 };
bool m_connected { false };
@@ -75,11 +77,13 @@ protected:
virtual void did_update_fd(int) override;
private:
- virtual bool open(CIODevice::OpenMode) override { ASSERT_NOT_REACHED(); }
+ virtual bool open(IODevice::OpenMode) override { ASSERT_NOT_REACHED(); }
bool common_connect(const struct sockaddr*, socklen_t);
void ensure_read_notifier();
Type m_type { Type::Invalid };
- RefPtr<CNotifier> m_notifier;
- RefPtr<CNotifier> m_read_notifier;
+ RefPtr<Notifier> m_notifier;
+ RefPtr<Notifier> m_read_notifier;
};
+
+}
diff --git a/Libraries/LibCore/CSocketAddress.h b/Libraries/LibCore/CSocketAddress.h
index b6486f11a1..3c0bfcf482 100644
--- a/Libraries/LibCore/CSocketAddress.h
+++ b/Libraries/LibCore/CSocketAddress.h
@@ -32,7 +32,9 @@
#include <sys/socket.h>
#include <sys/un.h>
-class CSocketAddress {
+namespace Core {
+
+class SocketAddress {
public:
enum class Type {
Invalid,
@@ -40,23 +42,23 @@ public:
Local
};
- CSocketAddress() {}
- CSocketAddress(const IPv4Address& address)
+ SocketAddress() {}
+ SocketAddress(const IPv4Address& address)
: m_type(Type::IPv4)
, m_ipv4_address(address)
{
}
- CSocketAddress(const IPv4Address& address, u16 port)
+ SocketAddress(const IPv4Address& address, u16 port)
: m_type(Type::IPv4)
, m_ipv4_address(address)
, m_port(port)
{
}
- static CSocketAddress local(const String& address)
+ static SocketAddress local(const String& address)
{
- CSocketAddress addr;
+ SocketAddress addr;
addr.m_type = Type::Local;
addr.m_local_address = address;
return addr;
@@ -106,7 +108,9 @@ private:
String m_local_address;
};
-inline const LogStream& operator<<(const LogStream& stream, const CSocketAddress& value)
+inline const LogStream& operator<<(const LogStream& stream, const SocketAddress& value)
{
return stream << value.to_string();
}
+
+}
diff --git a/Libraries/LibCore/CTCPServer.cpp b/Libraries/LibCore/CTCPServer.cpp
index d79eeb1909..4813d17d74 100644
--- a/Libraries/LibCore/CTCPServer.cpp
+++ b/Libraries/LibCore/CTCPServer.cpp
@@ -32,24 +32,26 @@
#include <stdio.h>
#include <sys/socket.h>
-CTCPServer::CTCPServer(CObject* parent)
- : CObject(parent)
+namespace Core {
+
+TCPServer::TCPServer(Object* parent)
+ : Object(parent)
{
m_fd = socket(AF_INET, SOCK_STREAM | SOCK_NONBLOCK | SOCK_CLOEXEC, 0);
ASSERT(m_fd >= 0);
}
-CTCPServer::~CTCPServer()
+TCPServer::~TCPServer()
{
}
-bool CTCPServer::listen(const IPv4Address& address, u16 port)
+bool TCPServer::listen(const IPv4Address& address, u16 port)
{
if (m_listening)
return false;
int rc;
- auto socket_address = CSocketAddress(address, port);
+ auto socket_address = SocketAddress(address, port);
auto in = socket_address.to_sockaddr_in();
rc = ::bind(m_fd, (const sockaddr*)&in, sizeof(in));
ASSERT(rc == 0);
@@ -58,7 +60,7 @@ bool CTCPServer::listen(const IPv4Address& address, u16 port)
ASSERT(rc == 0);
m_listening = true;
- m_notifier = CNotifier::construct(m_fd, CNotifier::Event::Read);
+ m_notifier = Notifier::construct(m_fd, Notifier::Event::Read);
m_notifier->on_ready_to_read = [this] {
if (on_ready_to_accept)
on_ready_to_accept();
@@ -66,7 +68,7 @@ bool CTCPServer::listen(const IPv4Address& address, u16 port)
return true;
}
-RefPtr<CTCPSocket> CTCPServer::accept()
+RefPtr<TCPSocket> TCPServer::accept()
{
ASSERT(m_listening);
sockaddr_in in;
@@ -77,10 +79,10 @@ RefPtr<CTCPSocket> CTCPServer::accept()
return nullptr;
}
- return CTCPSocket::construct(accepted_fd);
+ return TCPSocket::construct(accepted_fd);
}
-Optional<IPv4Address> CTCPServer::local_address() const
+Optional<IPv4Address> TCPServer::local_address() const
{
if (m_fd == -1)
return {};
@@ -93,7 +95,7 @@ Optional<IPv4Address> CTCPServer::local_address() const
return IPv4Address(address.sin_addr.s_addr);
}
-Optional<u16> CTCPServer::local_port() const
+Optional<u16> TCPServer::local_port() const
{
if (m_fd == -1)
return {};
@@ -105,3 +107,5 @@ Optional<u16> CTCPServer::local_port() const
return ntohs(address.sin_port);
}
+
+}
diff --git a/Libraries/LibCore/CTCPServer.h b/Libraries/LibCore/CTCPServer.h
index b5222e0daa..de76f8c374 100644
--- a/Libraries/LibCore/CTCPServer.h
+++ b/Libraries/LibCore/CTCPServer.h
@@ -30,17 +30,19 @@
#include <LibCore/CNotifier.h>
#include <LibCore/CObject.h>
-class CTCPSocket;
+namespace Core {
-class CTCPServer : public CObject {
- C_OBJECT(CTCPServer)
+class TCPSocket;
+
+class TCPServer : public Object {
+ C_OBJECT(TCPServer)
public:
- virtual ~CTCPServer() override;
+ virtual ~TCPServer() override;
bool is_listening() const { return m_listening; }
bool listen(const IPv4Address& address, u16 port);
- RefPtr<CTCPSocket> accept();
+ RefPtr<TCPSocket> accept();
Optional<IPv4Address> local_address() const;
Optional<u16> local_port() const;
@@ -48,9 +50,11 @@ public:
Function<void()> on_ready_to_accept;
private:
- explicit CTCPServer(CObject* parent = nullptr);
+ explicit TCPServer(Object* parent = nullptr);
int m_fd { -1 };
bool m_listening { false };
- RefPtr<CNotifier> m_notifier;
+ RefPtr<Notifier> m_notifier;
};
+
+}
diff --git a/Libraries/LibCore/CTCPSocket.cpp b/Libraries/LibCore/CTCPSocket.cpp
index 799ff495ca..cc47708438 100644
--- a/Libraries/LibCore/CTCPSocket.cpp
+++ b/Libraries/LibCore/CTCPSocket.cpp
@@ -25,32 +25,36 @@
*/
#include <LibCore/CTCPSocket.h>
-#include <sys/socket.h>
#include <errno.h>
+#include <sys/socket.h>
+
+namespace Core {
-CTCPSocket::CTCPSocket(int fd, CObject* parent)
- : CSocket(CSocket::Type::TCP, parent)
+TCPSocket::TCPSocket(int fd, Object* parent)
+ : Socket(Socket::Type::TCP, parent)
{
// NOTE: This constructor is used by CTCPServer::accept(), so the socket is already connected.
m_connected = true;
set_fd(fd);
- set_mode(CIODevice::ReadWrite);
+ set_mode(IODevice::ReadWrite);
set_error(0);
}
-CTCPSocket::CTCPSocket(CObject* parent)
- : CSocket(CSocket::Type::TCP, parent)
+TCPSocket::TCPSocket(Object* parent)
+ : Socket(Socket::Type::TCP, parent)
{
int fd = socket(AF_INET, SOCK_STREAM | SOCK_NONBLOCK, 0);
if (fd < 0) {
set_error(errno);
} else {
set_fd(fd);
- set_mode(CIODevice::ReadWrite);
+ set_mode(IODevice::ReadWrite);
set_error(0);
}
}
-CTCPSocket::~CTCPSocket()
+TCPSocket::~TCPSocket()
{
}
+
+}
diff --git a/Libraries/LibCore/CTCPSocket.h b/Libraries/LibCore/CTCPSocket.h
index 29b174f366..e3168b3d8d 100644
--- a/Libraries/LibCore/CTCPSocket.h
+++ b/Libraries/LibCore/CTCPSocket.h
@@ -29,14 +29,18 @@
#include <AK/Badge.h>
#include <LibCore/CSocket.h>
-class CTCPServer;
+namespace Core {
-class CTCPSocket final : public CSocket {
- C_OBJECT(CTCPSocket)
+class TCPServer;
+
+class TCPSocket final : public Socket {
+ C_OBJECT(TCPSocket)
public:
- virtual ~CTCPSocket() override;
+ virtual ~TCPSocket() override;
private:
- CTCPSocket(int fd, CObject* parent = nullptr);
- explicit CTCPSocket(CObject* parent = nullptr);
+ TCPSocket(int fd, Object* parent = nullptr);
+ explicit TCPSocket(Object* parent = nullptr);
};
+
+}
diff --git a/Libraries/LibCore/CTimer.cpp b/Libraries/LibCore/CTimer.cpp
index 113758e60d..40fdd38983 100644
--- a/Libraries/LibCore/CTimer.cpp
+++ b/Libraries/LibCore/CTimer.cpp
@@ -26,28 +26,30 @@
#include <LibCore/CTimer.h>
-CTimer::CTimer(CObject* parent)
- : CObject(parent)
+namespace Core {
+
+Timer::Timer(Object* parent)
+ : Object(parent)
{
}
-CTimer::CTimer(int interval, Function<void()>&& timeout_handler, CObject* parent)
- : CObject(parent)
+Timer::Timer(int interval, Function<void()>&& timeout_handler, Object* parent)
+ : Object(parent)
, on_timeout(move(timeout_handler))
{
start(interval);
}
-CTimer::~CTimer()
+Timer::~Timer()
{
}
-void CTimer::start()
+void Timer::start()
{
start(m_interval);
}
-void CTimer::start(int interval)
+void Timer::start(int interval)
{
if (m_active)
return;
@@ -56,14 +58,14 @@ void CTimer::start(int interval)
m_active = true;
}
-void CTimer::restart(int interval)
+void Timer::restart(int interval)
{
if (m_active)
stop();
start(interval);
}
-void CTimer::stop()
+void Timer::stop()
{
if (!m_active)
return;
@@ -71,7 +73,7 @@ void CTimer::stop()
m_active = false;
}
-void CTimer::timer_event(CTimerEvent&)
+void Timer::timer_event(TimerEvent&)
{
if (m_single_shot)
stop();
@@ -85,3 +87,5 @@ void CTimer::timer_event(CTimerEvent&)
if (on_timeout)
on_timeout();
}
+
+}
diff --git a/Libraries/LibCore/CTimer.h b/Libraries/LibCore/CTimer.h
index 9b3c4056af..76b44773ff 100644
--- a/Libraries/LibCore/CTimer.h
+++ b/Libraries/LibCore/CTimer.h
@@ -29,10 +29,12 @@
#include <AK/Function.h>
#include <LibCore/CObject.h>
-class CTimer final : public CObject {
- C_OBJECT(CTimer)
+namespace Core {
+
+class Timer final : public Object {
+ C_OBJECT(Timer)
public:
- virtual ~CTimer() override;
+ virtual ~Timer() override;
void start();
void start(int interval);
@@ -55,13 +57,15 @@ public:
Function<void()> on_timeout;
private:
- explicit CTimer(CObject* parent = nullptr);
- CTimer(int interval, Function<void()>&& timeout_handler, CObject* parent = nullptr);
+ explicit Timer(Object* parent = nullptr);
+ Timer(int interval, Function<void()>&& timeout_handler, Object* parent = nullptr);
- virtual void timer_event(CTimerEvent&) override;
+ virtual void timer_event(TimerEvent&) override;
bool m_active { false };
bool m_single_shot { false };
bool m_interval_dirty { false };
int m_interval { 0 };
};
+
+}
diff --git a/Libraries/LibCore/CUdpServer.cpp b/Libraries/LibCore/CUdpServer.cpp
index f843b71fc9..82c0c2b574 100644
--- a/Libraries/LibCore/CUdpServer.cpp
+++ b/Libraries/LibCore/CUdpServer.cpp
@@ -32,24 +32,26 @@
#include <stdio.h>
#include <sys/socket.h>
-CUdpServer::CUdpServer(CObject* parent)
- : CObject(parent)
+namespace Core {
+
+UdpServer::UdpServer(Object* parent)
+ : Object(parent)
{
m_fd = socket(AF_INET, SOCK_DGRAM | SOCK_NONBLOCK | SOCK_CLOEXEC, 0);
ASSERT(m_fd >= 0);
}
-CUdpServer::~CUdpServer()
+UdpServer::~UdpServer()
{
}
-bool CUdpServer::listen(const IPv4Address& address, u16 port)
+bool UdpServer::listen(const IPv4Address& address, u16 port)
{
if (m_listening)
return false;
int rc;
- auto socket_address = CSocketAddress(address, port);
+ auto socket_address = SocketAddress(address, port);
auto in = socket_address.to_sockaddr_in();
rc = ::bind(m_fd, (const sockaddr*)&in, sizeof(in));
ASSERT(rc == 0);
@@ -58,7 +60,7 @@ bool CUdpServer::listen(const IPv4Address& address, u16 port)
ASSERT(rc == 0);
m_listening = true;
- m_notifier = CNotifier::construct(m_fd, CNotifier::Event::Read);
+ m_notifier = Notifier::construct(m_fd, Notifier::Event::Read);
m_notifier->on_ready_to_read = [this] {
if (on_ready_to_accept)
on_ready_to_accept();
@@ -66,7 +68,7 @@ bool CUdpServer::listen(const IPv4Address& address, u16 port)
return true;
}
-RefPtr<CUdpSocket> CUdpServer::accept()
+RefPtr<UdpSocket> UdpServer::accept()
{
ASSERT(m_listening);
sockaddr_in in;
@@ -77,10 +79,10 @@ RefPtr<CUdpSocket> CUdpServer::accept()
return nullptr;
}
- return CUdpSocket::construct(accepted_fd);
+ return UdpSocket::construct(accepted_fd);
}
-Optional<IPv4Address> CUdpServer::local_address() const
+Optional<IPv4Address> UdpServer::local_address() const
{
if (m_fd == -1)
return {};
@@ -93,7 +95,7 @@ Optional<IPv4Address> CUdpServer::local_address() const
return IPv4Address(address.sin_addr.s_addr);
}
-Optional<u16> CUdpServer::local_port() const
+Optional<u16> UdpServer::local_port() const
{
if (m_fd == -1)
return {};
@@ -105,3 +107,5 @@ Optional<u16> CUdpServer::local_port() const
return ntohs(address.sin_port);
}
+
+}
diff --git a/Libraries/LibCore/CUdpServer.h b/Libraries/LibCore/CUdpServer.h
index 80b2f539be..99836304a8 100644
--- a/Libraries/LibCore/CUdpServer.h
+++ b/Libraries/LibCore/CUdpServer.h
@@ -30,17 +30,19 @@
#include <LibCore/CNotifier.h>
#include <LibCore/CObject.h>
-class CUdpSocket;
+namespace Core {
-class CUdpServer : public CObject {
- C_OBJECT(CUdpServer)
+class UdpSocket;
+
+class UdpServer : public Object {
+ C_OBJECT(UdpServer)
public:
- virtual ~CUdpServer() override;
+ virtual ~UdpServer() override;
bool is_listening() const { return m_listening; }
bool listen(const IPv4Address& address, u16 port);
- RefPtr<CUdpSocket> accept();
+ RefPtr<UdpSocket> accept();
Optional<IPv4Address> local_address() const;
Optional<u16> local_port() const;
@@ -48,9 +50,11 @@ public:
Function<void()> on_ready_to_accept;
private:
- explicit CUdpServer(CObject* parent = nullptr);
+ explicit UdpServer(Object* parent = nullptr);
int m_fd { -1 };
bool m_listening { false };
- RefPtr<CNotifier> m_notifier;
+ RefPtr<Notifier> m_notifier;
};
+
+}
diff --git a/Libraries/LibCore/CUdpSocket.cpp b/Libraries/LibCore/CUdpSocket.cpp
index a48a9f03bf..95490b51db 100644
--- a/Libraries/LibCore/CUdpSocket.cpp
+++ b/Libraries/LibCore/CUdpSocket.cpp
@@ -25,32 +25,36 @@
*/
#include <LibCore/CUdpSocket.h>
-#include <sys/socket.h>
#include <errno.h>
+#include <sys/socket.h>
+
+namespace Core {
-CUdpSocket::CUdpSocket(int fd, CObject* parent)
- : CSocket(CSocket::Type::UDP, parent)
+UdpSocket::UdpSocket(int fd, Object* parent)
+ : Socket(Socket::Type::UDP, parent)
{
// NOTE: This constructor is used by CUdpServer::accept(), so the socket is already connected.
m_connected = true;
set_fd(fd);
- set_mode(CIODevice::ReadWrite);
+ set_mode(IODevice::ReadWrite);
set_error(0);
}
-CUdpSocket::CUdpSocket(CObject* parent)
- : CSocket(CSocket::Type::UDP, parent)
+UdpSocket::UdpSocket(Object* parent)
+ : Socket(Socket::Type::UDP, parent)
{
int fd = socket(AF_INET, SOCK_DGRAM | SOCK_NONBLOCK, 0);
if (fd < 0) {
set_error(errno);
} else {
set_fd(fd);
- set_mode(CIODevice::ReadWrite);
+ set_mode(IODevice::ReadWrite);
set_error(0);
}
}
-CUdpSocket::~CUdpSocket()
+UdpSocket::~UdpSocket()
{
}
+
+}
diff --git a/Libraries/LibCore/CUdpSocket.h b/Libraries/LibCore/CUdpSocket.h
index e3324d0281..759e93fb18 100644
--- a/Libraries/LibCore/CUdpSocket.h
+++ b/Libraries/LibCore/CUdpSocket.h
@@ -29,12 +29,16 @@
#include <AK/Badge.h>
#include <LibCore/CSocket.h>
-class CUdpSocket final : public CSocket {
- C_OBJECT(CUdpSocket)
+namespace Core {
+
+class UdpSocket final : public Socket {
+ C_OBJECT(UdpSocket)
public:
- virtual ~CUdpSocket() override;
+ virtual ~UdpSocket() override;
private:
- CUdpSocket(int fd, CObject* parent = nullptr);
- explicit CUdpSocket(CObject* parent = nullptr);
+ UdpSocket(int fd, Object* parent = nullptr);
+ explicit UdpSocket(Object* parent = nullptr);
};
+
+}
diff --git a/Libraries/LibDraw/SystemTheme.cpp b/Libraries/LibDraw/SystemTheme.cpp
index 88437cea45..12538fb820 100644
--- a/Libraries/LibDraw/SystemTheme.cpp
+++ b/Libraries/LibDraw/SystemTheme.cpp
@@ -51,7 +51,7 @@ void set_system_theme(SharedBuffer& buffer)
RefPtr<SharedBuffer> load_system_theme(const String& path)
{
- auto file = CConfigFile::open(path);
+ auto file = Core::ConfigFile::open(path);
auto buffer = SharedBuffer::create_with_size(sizeof(SystemTheme));
auto* data = (SystemTheme*)buffer->data();
diff --git a/Libraries/LibGUI/GAboutDialog.cpp b/Libraries/LibGUI/GAboutDialog.cpp
index 37878d5e3c..8abdc56fb2 100644
--- a/Libraries/LibGUI/GAboutDialog.cpp
+++ b/Libraries/LibGUI/GAboutDialog.cpp
@@ -30,7 +30,7 @@
#include <LibGUI/GLabel.h>
#include <LibGUI/GWidget.h>
-GAboutDialog::GAboutDialog(const StringView& name, const GraphicsBitmap* icon, CObject* parent)
+GAboutDialog::GAboutDialog(const StringView& name, const GraphicsBitmap* icon, Core::Object* parent)
: GDialog(parent)
, m_name(name)
, m_icon(icon)
diff --git a/Libraries/LibGUI/GAboutDialog.h b/Libraries/LibGUI/GAboutDialog.h
index cef8074c5f..e355d0355e 100644
--- a/Libraries/LibGUI/GAboutDialog.h
+++ b/Libraries/LibGUI/GAboutDialog.h
@@ -33,14 +33,14 @@ class GAboutDialog final : public GDialog {
public:
virtual ~GAboutDialog() override;
- static void show(const StringView& name, const GraphicsBitmap* icon = nullptr, CObject* parent = nullptr)
+ static void show(const StringView& name, const GraphicsBitmap* icon = nullptr, Core::Object* parent = nullptr)
{
auto dialog = GAboutDialog::construct(name, icon, parent);
dialog->exec();
}
private:
- GAboutDialog(const StringView& name, const GraphicsBitmap* icon = nullptr, CObject* parent = nullptr);
+ GAboutDialog(const StringView& name, const GraphicsBitmap* icon = nullptr, Core::Object* parent = nullptr);
String m_name;
RefPtr<GraphicsBitmap> m_icon;
diff --git a/Libraries/LibGUI/GAbstractButton.cpp b/Libraries/LibGUI/GAbstractButton.cpp
index 23f42ec7b3..68bd12fb84 100644
--- a/Libraries/LibGUI/GAbstractButton.cpp
+++ b/Libraries/LibGUI/GAbstractButton.cpp
@@ -37,7 +37,7 @@ GAbstractButton::GAbstractButton(const StringView& text, GWidget* parent)
: GWidget(parent)
, m_text(text)
{
- m_auto_repeat_timer = CTimer::construct(this);
+ m_auto_repeat_timer = Core::Timer::construct(this);
m_auto_repeat_timer->on_timeout = [this] {
click();
};
@@ -147,13 +147,13 @@ void GAbstractButton::mouseup_event(GMouseEvent& event)
GWidget::mouseup_event(event);
}
-void GAbstractButton::enter_event(CEvent&)
+void GAbstractButton::enter_event(Core::Event&)
{
m_hovered = true;
update();
}
-void GAbstractButton::leave_event(CEvent&)
+void GAbstractButton::leave_event(Core::Event&)
{
m_hovered = false;
update();
diff --git a/Libraries/LibGUI/GAbstractButton.h b/Libraries/LibGUI/GAbstractButton.h
index 9cd09c33bf..2b868b0b9d 100644
--- a/Libraries/LibGUI/GAbstractButton.h
+++ b/Libraries/LibGUI/GAbstractButton.h
@@ -33,7 +33,7 @@
class GPainter;
class GAbstractButton : public GWidget {
- C_OBJECT(GAbstractButton)
+ C_OBJECT_ABSTRACT(GAbstractButton)
public:
virtual ~GAbstractButton() override;
@@ -69,8 +69,8 @@ protected:
virtual void mousemove_event(GMouseEvent&) override;
virtual void mouseup_event(GMouseEvent&) override;
virtual void keydown_event(GKeyEvent&) override;
- virtual void enter_event(CEvent&) override;
- virtual void leave_event(CEvent&) override;
+ virtual void enter_event(Core::Event&) override;
+ virtual void leave_event(Core::Event&) override;
virtual void change_event(GEvent&) override;
void paint_text(GPainter&, const Rect&, const Font&, TextAlignment);
@@ -86,11 +86,11 @@ private:
bool m_exclusive { false };
int m_auto_repeat_interval { 0 };
- RefPtr<CTimer> m_auto_repeat_timer;
+ RefPtr<Core::Timer> m_auto_repeat_timer;
};
template<>
-inline bool is<GAbstractButton>(const CObject& object)
+inline bool Core::is<GAbstractButton>(const Core::Object& object)
{
if (!is<GWidget>(object))
return false;
diff --git a/Libraries/LibGUI/GAbstractTableView.cpp b/Libraries/LibGUI/GAbstractTableView.cpp
index a018813773..8dba874668 100644
--- a/Libraries/LibGUI/GAbstractTableView.cpp
+++ b/Libraries/LibGUI/GAbstractTableView.cpp
@@ -517,7 +517,7 @@ void GAbstractTableView::context_menu_event(GContextMenuEvent& event)
on_context_menu_request(index, event);
}
-void GAbstractTableView::leave_event(CEvent&)
+void GAbstractTableView::leave_event(Core::Event&)
{
window()->set_override_cursor(GStandardCursor::None);
set_hovered_header_index(-1);
diff --git a/Libraries/LibGUI/GAbstractTableView.h b/Libraries/LibGUI/GAbstractTableView.h
index 719583a8e1..a40b155730 100644
--- a/Libraries/LibGUI/GAbstractTableView.h
+++ b/Libraries/LibGUI/GAbstractTableView.h
@@ -81,7 +81,7 @@ protected:
virtual void mousemove_event(GMouseEvent&) override;
virtual void doubleclick_event(GMouseEvent&) override;
virtual void keydown_event(GKeyEvent&) override;
- virtual void leave_event(CEvent&) override;
+ virtual void leave_event(Core::Event&) override;
virtual void context_menu_event(GContextMenuEvent&) override;
virtual void toggle_index(const GModelIndex&) {}
diff --git a/Libraries/LibGUI/GAction.cpp b/Libraries/LibGUI/GAction.cpp
index 86468761a6..b7f0833f66 100644
--- a/Libraries/LibGUI/GAction.cpp
+++ b/Libraries/LibGUI/GAction.cpp
@@ -32,52 +32,52 @@
namespace GCommonActions {
-NonnullRefPtr<GAction> make_open_action(Function<void(GAction&)> callback, CObject* parent)
+NonnullRefPtr<GAction> make_open_action(Function<void(GAction&)> callback, Core::Object* parent)
{
return GAction::create("Open...", { Mod_Ctrl, Key_O }, GraphicsBitmap::load_from_file("/res/icons/16x16/open.png"), move(callback), parent);
}
-NonnullRefPtr<GAction> make_move_to_front_action(Function<void(GAction&)> callback, CObject* parent)
+NonnullRefPtr<GAction> make_move_to_front_action(Function<void(GAction&)> callback, Core::Object* parent)
{
return GAction::create("Move to front", { Mod_Ctrl | Mod_Shift, Key_Up }, GraphicsBitmap::load_from_file("/res/icons/16x16/move-to-front.png"), move(callback), parent);
}
-NonnullRefPtr<GAction> make_move_to_back_action(Function<void(GAction&)> callback, CObject* parent)
+NonnullRefPtr<GAction> make_move_to_back_action(Function<void(GAction&)> callback, Core::Object* parent)
{
return GAction::create("Move to back", { Mod_Ctrl | Mod_Shift, Key_Down }, GraphicsBitmap::load_from_file("/res/icons/16x16/move-to-back.png"), move(callback), parent);
}
-NonnullRefPtr<GAction> make_undo_action(Function<void(GAction&)> callback, CObject* parent)
+NonnullRefPtr<GAction> make_undo_action(Function<void(GAction&)> callback, Core::Object* parent)
{
return GAction::create("Undo", { Mod_Ctrl, Key_Z }, GraphicsBitmap::load_from_file("/res/icons/16x16/undo.png"), move(callback), parent);
}
-NonnullRefPtr<GAction> make_redo_action(Function<void(GAction&)> callback, CObject* parent)
+NonnullRefPtr<GAction> make_redo_action(Function<void(GAction&)> callback, Core::Object* parent)
{
return GAction::create("Redo", { Mod_Ctrl, Key_Y }, GraphicsBitmap::load_from_file("/res/icons/16x16/redo.png"), move(callback), parent);
}
-NonnullRefPtr<GAction> make_delete_action(Function<void(GAction&)> callback, CObject* parent)
+NonnullRefPtr<GAction> make_delete_action(Function<void(GAction&)> callback, Core::Object* parent)
{
return GAction::create("Delete", { Mod_None, Key_Delete }, GraphicsBitmap::load_from_file("/res/icons/16x16/delete.png"), move(callback), parent);
}
-NonnullRefPtr<GAction> make_cut_action(Function<void(GAction&)> callback, CObject* parent)
+NonnullRefPtr<GAction> make_cut_action(Function<void(GAction&)> callback, Core::Object* parent)
{
return GAction::create("Cut", { Mod_Ctrl, Key_X }, GraphicsBitmap::load_from_file("/res/icons/cut16.png"), move(callback), parent);
}
-NonnullRefPtr<GAction> make_copy_action(Function<void(GAction&)> callback, CObject* parent)
+NonnullRefPtr<GAction> make_copy_action(Function<void(GAction&)> callback, Core::Object* parent)
{
return GAction::create("Copy", { Mod_Ctrl, Key_C }, GraphicsBitmap::load_from_file("/res/icons/16x16/edit-copy.png"), move(callback), parent);
}
-NonnullRefPtr<GAction> make_paste_action(Function<void(GAction&)> callback, CObject* parent)
+NonnullRefPtr<GAction> make_paste_action(Function<void(GAction&)> callback, Core::Object* parent)
{
return GAction::create("Paste", { Mod_Ctrl, Key_V }, GraphicsBitmap::load_from_file("/res/icons/paste16.png"), move(callback), parent);
}
-NonnullRefPtr<GAction> make_fullscreen_action(Function<void(GAction&)> callback, CObject* parent)
+NonnullRefPtr<GAction> make_fullscreen_action(Function<void(GAction&)> callback, Core::Object* parent)
{
return GAction::create("Fullscreen", { Mod_None, Key_F11 }, move(callback), parent);
}
@@ -87,58 +87,58 @@ NonnullRefPtr<GAction> make_quit_action(Function<void(GAction&)> callback)
return GAction::create("Quit", { Mod_Alt, Key_F4 }, move(callback));
}
-NonnullRefPtr<GAction> make_go_back_action(Function<void(GAction&)> callback, CObject* parent)
+NonnullRefPtr<GAction> make_go_back_action(Function<void(GAction&)> callback, Core::Object* parent)
{
return GAction::create("Go back", { Mod_Alt, Key_Left }, GraphicsBitmap::load_from_file("/res/icons/16x16/go-back.png"), move(callback), parent);
}
-NonnullRefPtr<GAction> make_go_forward_action(Function<void(GAction&)> callback, CObject* parent)
+NonnullRefPtr<GAction> make_go_forward_action(Function<void(GAction&)> callback, Core::Object* parent)
{
return GAction::create("Go forward", { Mod_Alt, Key_Right }, GraphicsBitmap::load_from_file("/res/icons/16x16/go-forward.png"), move(callback), parent);
}
-NonnullRefPtr<GAction> make_go_home_action(Function<void(GAction&)> callback, CObject* parent)
+NonnullRefPtr<GAction> make_go_home_action(Function<void(GAction&)> callback, Core::Object* parent)
{
return GAction::create("Go home", { Mod_Alt, Key_Home }, GraphicsBitmap::load_from_file("/res/icons/16x16/go-home.png"), move(callback), parent);
}
-NonnullRefPtr<GAction> make_reload_action(Function<void(GAction&)> callback, CObject* parent)
+NonnullRefPtr<GAction> make_reload_action(Function<void(GAction&)> callback, Core::Object* parent)
{
return GAction::create("Reload", { Mod_Ctrl, Key_R }, GraphicsBitmap::load_from_file("/res/icons/16x16/reload.png"), move(callback), parent);
}
}
-GAction::GAction(const StringView& text, Function<void(GAction&)> on_activation_callback, CObject* parent)
- : CObject(parent)
+GAction::GAction(const StringView& text, Function<void(GAction&)> on_activation_callback, Core::Object* parent)
+ : Core::Object(parent)
, on_activation(move(on_activation_callback))
, m_text(text)
{
}
-GAction::GAction(const StringView& text, RefPtr<GraphicsBitmap>&& icon, Function<void(GAction&)> on_activation_callback, CObject* parent)
- : CObject(parent)
+GAction::GAction(const StringView& text, RefPtr<GraphicsBitmap>&& icon, Function<void(GAction&)> on_activation_callback, Core::Object* parent)
+ : Core::Object(parent)
, on_activation(move(on_activation_callback))
, m_text(text)
, m_icon(move(icon))
{
}
-GAction::GAction(const StringView& text, const GShortcut& shortcut, Function<void(GAction&)> on_activation_callback, CObject* parent)
+GAction::GAction(const StringView& text, const GShortcut& shortcut, Function<void(GAction&)> on_activation_callback, Core::Object* parent)
: GAction(text, shortcut, nullptr, move(on_activation_callback), parent)
{
}
-GAction::GAction(const StringView& text, const GShortcut& shortcut, RefPtr<GraphicsBitmap>&& icon, Function<void(GAction&)> on_activation_callback, CObject* parent)
- : CObject(parent)
+GAction::GAction(const StringView& text, const GShortcut& shortcut, RefPtr<GraphicsBitmap>&& icon, Function<void(GAction&)> on_activation_callback, Core::Object* parent)
+ : Core::Object(parent)
, on_activation(move(on_activation_callback))
, m_text(text)
, m_icon(move(icon))
, m_shortcut(shortcut)
{
- if (parent && is<GWidget>(*parent)) {
+ if (parent && Core::is<GWidget>(*parent)) {
m_scope = ShortcutScope::WidgetLocal;
- } else if (parent && is<GWindow>(*parent)) {
+ } else if (parent && Core::is<GWindow>(*parent)) {
m_scope = ShortcutScope::WindowLocal;
} else {
m_scope = ShortcutScope::ApplicationGlobal;
@@ -152,7 +152,7 @@ GAction::~GAction()
GApplication::the().unregister_global_shortcut_action({}, *this);
}
-void GAction::activate(CObject* activator)
+void GAction::activate(Core::Object* activator)
{
if (activator)
m_activator = activator->make_weak_ptr();
diff --git a/Libraries/LibGUI/GAction.h b/Libraries/LibGUI/GAction.h
index 31827f66d0..e9c9ddc608 100644
--- a/Libraries/LibGUI/GAction.h
+++ b/Libraries/LibGUI/GAction.h
@@ -44,24 +44,24 @@ class GButton;
class GMenuItem;
namespace GCommonActions {
-NonnullRefPtr<GAction> make_open_action(Function<void(GAction&)>, CObject* parent = nullptr);
-NonnullRefPtr<GAction> make_undo_action(Function<void(GAction&)>, CObject* parent = nullptr);
-NonnullRefPtr<GAction> make_redo_action(Function<void(GAction&)>, CObject* parent = nullptr);
-NonnullRefPtr<GAction> make_cut_action(Function<void(GAction&)>, CObject* parent = nullptr);
-NonnullRefPtr<GAction> make_copy_action(Function<void(GAction&)>, CObject* parent = nullptr);
-NonnullRefPtr<GAction> make_paste_action(Function<void(GAction&)>, CObject* parent = nullptr);
-NonnullRefPtr<GAction> make_delete_action(Function<void(GAction&)>, CObject* parent = nullptr);
-NonnullRefPtr<GAction> make_move_to_front_action(Function<void(GAction&)>, CObject* parent = nullptr);
-NonnullRefPtr<GAction> make_move_to_back_action(Function<void(GAction&)>, CObject* parent = nullptr);
-NonnullRefPtr<GAction> make_fullscreen_action(Function<void(GAction&)>, CObject* parent = nullptr);
+NonnullRefPtr<GAction> make_open_action(Function<void(GAction&)>, Core::Object* parent = nullptr);
+NonnullRefPtr<GAction> make_undo_action(Function<void(GAction&)>, Core::Object* parent = nullptr);
+NonnullRefPtr<GAction> make_redo_action(Function<void(GAction&)>, Core::Object* parent = nullptr);
+NonnullRefPtr<GAction> make_cut_action(Function<void(GAction&)>, Core::Object* parent = nullptr);
+NonnullRefPtr<GAction> make_copy_action(Function<void(GAction&)>, Core::Object* parent = nullptr);
+NonnullRefPtr<GAction> make_paste_action(Function<void(GAction&)>, Core::Object* parent = nullptr);
+NonnullRefPtr<GAction> make_delete_action(Function<void(GAction&)>, Core::Object* parent = nullptr);
+NonnullRefPtr<GAction> make_move_to_front_action(Function<void(GAction&)>, Core::Object* parent = nullptr);
+NonnullRefPtr<GAction> make_move_to_back_action(Function<void(GAction&)>, Core::Object* parent = nullptr);
+NonnullRefPtr<GAction> make_fullscreen_action(Function<void(GAction&)>, Core::Object* parent = nullptr);
NonnullRefPtr<GAction> make_quit_action(Function<void(GAction&)>);
-NonnullRefPtr<GAction> make_go_back_action(Function<void(GAction&)>, CObject* parent = nullptr);
-NonnullRefPtr<GAction> make_go_forward_action(Function<void(GAction&)>, CObject* parent = nullptr);
-NonnullRefPtr<GAction> make_go_home_action(Function<void(GAction&)> callback, CObject* parent = nullptr);
-NonnullRefPtr<GAction> make_reload_action(Function<void(GAction&)>, CObject* parent = nullptr);
+NonnullRefPtr<GAction> make_go_back_action(Function<void(GAction&)>, Core::Object* parent = nullptr);
+NonnullRefPtr<GAction> make_go_forward_action(Function<void(GAction&)>, Core::Object* parent = nullptr);
+NonnullRefPtr<GAction> make_go_home_action(Function<void(GAction&)> callback, Core::Object* parent = nullptr);
+NonnullRefPtr<GAction> make_reload_action(Function<void(GAction&)>, Core::Object* parent = nullptr);
};
-class GAction final : public CObject {
+class GAction final : public Core::Object {
C_OBJECT(GAction)
public:
enum class ShortcutScope {
@@ -70,19 +70,19 @@ public:
WindowLocal,
ApplicationGlobal,
};
- static NonnullRefPtr<GAction> create(const StringView& text, Function<void(GAction&)> callback, CObject* parent = nullptr)
+ static NonnullRefPtr<GAction> create(const StringView& text, Function<void(GAction&)> callback, Core::Object* parent = nullptr)
{
return adopt(*new GAction(text, move(callback), parent));
}
- static NonnullRefPtr<GAction> create(const StringView& text, RefPtr<GraphicsBitmap>&& icon, Function<void(GAction&)> callback, CObject* parent = nullptr)
+ static NonnullRefPtr<GAction> create(const StringView& text, RefPtr<GraphicsBitmap>&& icon, Function<void(GAction&)> callback, Core::Object* parent = nullptr)
{
return adopt(*new GAction(text, move(icon), move(callback), parent));
}
- static NonnullRefPtr<GAction> create(const StringView& text, const GShortcut& shortcut, Function<void(GAction&)> callback, CObject* parent = nullptr)
+ static NonnullRefPtr<GAction> create(const StringView& text, const GShortcut& shortcut, Function<void(GAction&)> callback, Core::Object* parent = nullptr)
{
return adopt(*new GAction(text, shortcut, move(callback), parent));
}
- static NonnullRefPtr<GAction> create(const StringView& text, const GShortcut& shortcut, RefPtr<GraphicsBitmap>&& icon, Function<void(GAction&)> callback, CObject* parent = nullptr)
+ static NonnullRefPtr<GAction> create(const StringView& text, const GShortcut& shortcut, RefPtr<GraphicsBitmap>&& icon, Function<void(GAction&)> callback, Core::Object* parent = nullptr)
{
return adopt(*new GAction(text, shortcut, move(icon), move(callback), parent));
}
@@ -93,12 +93,12 @@ public:
const GraphicsBitmap* icon() const { return m_icon.ptr(); }
void set_icon(const GraphicsBitmap* icon) { m_icon = icon; }
- const CObject* activator() const { return m_activator.ptr(); }
- CObject* activator() { return m_activator.ptr(); }
+ const Core::Object* activator() const { return m_activator.ptr(); }
+ Core::Object* activator() { return m_activator.ptr(); }
Function<void(GAction&)> on_activation;
- void activate(CObject* activator = nullptr);
+ void activate(Core::Object* activator = nullptr);
bool is_enabled() const { return m_enabled; }
void set_enabled(bool);
@@ -124,10 +124,10 @@ public:
private:
virtual bool is_action() const override { return true; }
- GAction(const StringView& text, Function<void(GAction&)> = nullptr, CObject* = nullptr);
- GAction(const StringView& text, const GShortcut&, Function<void(GAction&)> = nullptr, CObject* = nullptr);
- GAction(const StringView& text, const GShortcut&, RefPtr<GraphicsBitmap>&& icon, Function<void(GAction&)> = nullptr, CObject* = nullptr);
- GAction(const StringView& text, RefPtr<GraphicsBitmap>&& icon, Function<void(GAction&)> = nullptr, CObject* = nullptr);
+ GAction(const StringView& text, Function<void(GAction&)> = nullptr, Core::Object* = nullptr);
+ GAction(const StringView& text, const GShortcut&, Function<void(GAction&)> = nullptr, Core::Object* = nullptr);
+ GAction(const StringView& text, const GShortcut&, RefPtr<GraphicsBitmap>&& icon, Function<void(GAction&)> = nullptr, Core::Object* = nullptr);
+ GAction(const StringView& text, RefPtr<GraphicsBitmap>&& icon, Function<void(GAction&)> = nullptr, Core::Object* = nullptr);
template<typename Callback>
void for_each_toolbar_button(Callback);
@@ -145,11 +145,11 @@ private:
HashTable<GButton*> m_buttons;
HashTable<GMenuItem*> m_menu_items;
WeakPtr<GActionGroup> m_action_group;
- WeakPtr<CObject> m_activator;
+ WeakPtr<Core::Object> m_activator;
};
template<>
-inline bool is<GAction>(const CObject& object)
+inline bool Core::is<GAction>(const Core::Object& object)
{
return object.is_action();
}
diff --git a/Libraries/LibGUI/GApplication.cpp b/Libraries/LibGUI/GApplication.cpp
index 4343bd639c..893a952dfe 100644
--- a/Libraries/LibGUI/GApplication.cpp
+++ b/Libraries/LibGUI/GApplication.cpp
@@ -48,7 +48,7 @@ GApplication::GApplication(int argc, char** argv)
(void)argv;
ASSERT(!s_the);
s_the = this;
- m_event_loop = make<CEventLoop>();
+ m_event_loop = make<Core::EventLoop>();
GWindowServerConnection::the();
if (argc > 0)
m_invoked_as = argv[0];
diff --git a/Libraries/LibGUI/GApplication.h b/Libraries/LibGUI/GApplication.h
index a1b783f325..0067d8da88 100644
--- a/Libraries/LibGUI/GApplication.h
+++ b/Libraries/LibGUI/GApplication.h
@@ -35,8 +35,10 @@
namespace AK {
class SharedBuffer;
}
+namespace Core {
+class EventLoop;
+}
-class CEventLoop;
class GAction;
class GKeyEvent;
class GMenuBar;
@@ -78,7 +80,7 @@ public:
void set_system_palette(SharedBuffer&);
private:
- OwnPtr<CEventLoop> m_event_loop;
+ OwnPtr<Core::EventLoop> m_event_loop;
OwnPtr<GMenuBar> m_menubar;
RefPtr<PaletteImpl> m_palette;
RefPtr<PaletteImpl> m_system_palette;
diff --git a/Libraries/LibGUI/GColorPicker.cpp b/Libraries/LibGUI/GColorPicker.cpp
index 50318b97be..8ff9f5ce45 100644
--- a/Libraries/LibGUI/GColorPicker.cpp
+++ b/Libraries/LibGUI/GColorPicker.cpp
@@ -31,7 +31,7 @@
#include <LibGUI/GSpinBox.h>
#include <LibGUI/GWidget.h>
-GColorPicker::GColorPicker(Color color, CObject* parent)
+GColorPicker::GColorPicker(Color color, Core::Object* parent)
: GDialog(parent)
, m_color(color)
{
diff --git a/Libraries/LibGUI/GColorPicker.h b/Libraries/LibGUI/GColorPicker.h
index c9446753d0..4554270430 100644
--- a/Libraries/LibGUI/GColorPicker.h
+++ b/Libraries/LibGUI/GColorPicker.h
@@ -38,7 +38,7 @@ public:
Color color() const { return m_color; }
private:
- explicit GColorPicker(Color, CObject* parent = nullptr);
+ explicit GColorPicker(Color, Core::Object* parent = nullptr);
void build();
diff --git a/Libraries/LibGUI/GDialog.cpp b/Libraries/LibGUI/GDialog.cpp
index 0ff2200dda..22069c434a 100644
--- a/Libraries/LibGUI/GDialog.cpp
+++ b/Libraries/LibGUI/GDialog.cpp
@@ -28,7 +28,7 @@
#include <LibGUI/GDialog.h>
#include <LibGUI/GEvent.h>
-GDialog::GDialog(CObject* parent)
+GDialog::GDialog(Core::Object* parent)
: GWindow(parent)
{
set_modal(true);
@@ -41,7 +41,7 @@ GDialog::~GDialog()
int GDialog::exec()
{
ASSERT(!m_event_loop);
- m_event_loop = make<CEventLoop>();
+ m_event_loop = make<Core::EventLoop>();
auto new_rect = rect();
if (parent() && parent()->is_window()) {
auto& parent_window = *static_cast<GWindow*>(parent());
@@ -67,7 +67,7 @@ void GDialog::done(int result)
m_event_loop->quit(result);
}
-void GDialog::event(CEvent& event)
+void GDialog::event(Core::Event& event)
{
if (event.type() == GEvent::KeyUp) {
auto& key_event = static_cast<GKeyEvent&>(event);
diff --git a/Libraries/LibGUI/GDialog.h b/Libraries/LibGUI/GDialog.h
index 788b85d645..4b5f8fd7b7 100644
--- a/Libraries/LibGUI/GDialog.h
+++ b/Libraries/LibGUI/GDialog.h
@@ -45,14 +45,14 @@ public:
int result() const { return m_result; }
void done(int result);
- virtual void event(CEvent&) override;
+ virtual void event(Core::Event&) override;
virtual void close() override;
protected:
- explicit GDialog(CObject* parent);
+ explicit GDialog(Core::Object* parent);
private:
- OwnPtr<CEventLoop> m_event_loop;
+ OwnPtr<Core::EventLoop> m_event_loop;
int m_result { ExecAborted };
};
diff --git a/Libraries/LibGUI/GDragOperation.cpp b/Libraries/LibGUI/GDragOperation.cpp
index ca09d2d624..04424b9494 100644
--- a/Libraries/LibGUI/GDragOperation.cpp
+++ b/Libraries/LibGUI/GDragOperation.cpp
@@ -30,8 +30,8 @@
static GDragOperation* s_current_drag_operation;
-GDragOperation::GDragOperation(CObject* parent)
- : CObject(parent)
+GDragOperation::GDragOperation(Core::Object* parent)
+ : Core::Object(parent)
{
}
@@ -61,7 +61,7 @@ GDragOperation::Outcome GDragOperation::exec()
}
s_current_drag_operation = this;
- m_event_loop = make<CEventLoop>();
+ m_event_loop = make<Core::EventLoop>();
auto result = m_event_loop->exec();
m_event_loop = nullptr;
dbgprintf("%s: event loop returned with result %d\n", class_name(), result);
diff --git a/Libraries/LibGUI/GDragOperation.h b/Libraries/LibGUI/GDragOperation.h
index 0a02ab403b..8713e4c34f 100644
--- a/Libraries/LibGUI/GDragOperation.h
+++ b/Libraries/LibGUI/GDragOperation.h
@@ -32,7 +32,7 @@
class GraphicsBitmap;
class GWindowServerConnection;
-class GDragOperation : public CObject {
+class GDragOperation : public Core::Object {
C_OBJECT(GDragOperation)
public:
enum class Outcome {
@@ -58,12 +58,12 @@ public:
static void notify_cancelled(Badge<GWindowServerConnection>);
protected:
- explicit GDragOperation(CObject* parent = nullptr);
+ explicit GDragOperation(Core::Object* parent = nullptr);
private:
void done(Outcome);
- OwnPtr<CEventLoop> m_event_loop;
+ OwnPtr<Core::EventLoop> m_event_loop;
Outcome m_outcome { Outcome::None };
String m_text;
String m_data_type;
diff --git a/Libraries/LibGUI/GEvent.h b/Libraries/LibGUI/GEvent.h
index 5a1457de81..59d65fabc5 100644
--- a/Libraries/LibGUI/GEvent.h
+++ b/Libraries/LibGUI/GEvent.h
@@ -32,9 +32,7 @@
#include <LibDraw/Rect.h>
#include <LibGUI/GWindowType.h>
-class CObject;
-
-class GEvent : public CEvent {
+class GEvent : public Core::Event {
public:
enum Type {
Show = 1000,
@@ -72,7 +70,7 @@ public:
GEvent() {}
explicit GEvent(Type type)
- : CEvent(type)
+ : Core::Event(type)
{
}
virtual ~GEvent() {}
diff --git a/Libraries/LibGUI/GFilePicker.cpp b/Libraries/LibGUI/GFilePicker.cpp
index ab4a538da0..d510fc456f 100644
--- a/Libraries/LibGUI/GFilePicker.cpp
+++ b/Libraries/LibGUI/GFilePicker.cpp
@@ -72,7 +72,7 @@ Optional<String> GFilePicker::get_save_filepath(const String& title, const Strin
return {};
}
-GFilePicker::GFilePicker(Mode mode, const StringView& file_name, const StringView& path, CObject* parent)
+GFilePicker::GFilePicker(Mode mode, const StringView& file_name, const StringView& path, Core::Object* parent)
: GDialog(parent)
, m_model(GFileSystemModel::create())
, m_mode(mode)
diff --git a/Libraries/LibGUI/GFilePicker.h b/Libraries/LibGUI/GFilePicker.h
index 04ce58a35f..21beee489b 100644
--- a/Libraries/LibGUI/GFilePicker.h
+++ b/Libraries/LibGUI/GFilePicker.h
@@ -55,7 +55,7 @@ private:
void clear_preview();
void on_file_return();
- GFilePicker(Mode type = Mode::Open, const StringView& file_name = "Untitled", const StringView& path = String(get_current_user_home_path()), CObject* parent = nullptr);
+ GFilePicker(Mode type = Mode::Open, const StringView& file_name = "Untitled", const StringView& path = String(get_current_user_home_path()), Core::Object* parent = nullptr);
static String ok_button_name(Mode mode)
{
diff --git a/Libraries/LibGUI/GFileSystemModel.cpp b/Libraries/LibGUI/GFileSystemModel.cpp
index ed532d5500..4c8d28598b 100644
--- a/Libraries/LibGUI/GFileSystemModel.cpp
+++ b/Libraries/LibGUI/GFileSystemModel.cpp
@@ -91,7 +91,7 @@ void GFileSystemModel::Node::traverse_if_needed(const GFileSystemModel& model)
total_size = 0;
auto full_path = this->full_path(model);
- CDirIterator di(full_path, CDirIterator::SkipDots);
+ Core::DirIterator di(full_path, Core::DirIterator::SkipDots);
if (di.has_error()) {
fprintf(stderr, "CDirIterator: %s\n", di.error_string());
return;
@@ -122,7 +122,7 @@ void GFileSystemModel::Node::traverse_if_needed(const GFileSystemModel& model)
}
fcntl(m_watch_fd, F_SETFD, FD_CLOEXEC);
dbg() << "Watching " << full_path << " for changes, m_watch_fd = " << m_watch_fd;
- m_notifier = CNotifier::construct(m_watch_fd, CNotifier::Event::Read);
+ m_notifier = Core::Notifier::construct(m_watch_fd, Core::Notifier::Event::Read);
m_notifier->on_ready_to_read = [this, &model] {
char buffer[32];
int rc = read(m_notifier->fd(), buffer, sizeof(buffer));
diff --git a/Libraries/LibGUI/GFileSystemModel.h b/Libraries/LibGUI/GFileSystemModel.h
index 276c99df50..971a1b0001 100644
--- a/Libraries/LibGUI/GFileSystemModel.h
+++ b/Libraries/LibGUI/GFileSystemModel.h
@@ -85,7 +85,7 @@ public:
bool has_traversed { false };
int m_watch_fd { -1 };
- RefPtr<CNotifier> m_notifier;
+ RefPtr<Core::Notifier> m_notifier;
GModelIndex index(const GFileSystemModel&, int column) const;
void traverse_if_needed(const GFileSystemModel&);
diff --git a/Libraries/LibGUI/GFontDatabase.cpp b/Libraries/LibGUI/GFontDatabase.cpp
index d01a414b50..80883ac51b 100644
--- a/Libraries/LibGUI/GFontDatabase.cpp
+++ b/Libraries/LibGUI/GFontDatabase.cpp
@@ -43,7 +43,7 @@ GFontDatabase& GFontDatabase::the()
GFontDatabase::GFontDatabase()
{
- CDirIterator di("/res/fonts", CDirIterator::SkipDots);
+ Core::DirIterator di("/res/fonts", Core::DirIterator::SkipDots);
if (di.has_error()) {
fprintf(stderr, "CDirIterator: %s\n", di.error_string());
exit(1);
diff --git a/Libraries/LibGUI/GInputBox.cpp b/Libraries/LibGUI/GInputBox.cpp
index e43e4d0dac..709c3b0861 100644
--- a/Libraries/LibGUI/GInputBox.cpp
+++ b/Libraries/LibGUI/GInputBox.cpp
@@ -31,7 +31,7 @@
#include <LibGUI/GTextEditor.h>
#include <stdio.h>
-GInputBox::GInputBox(const StringView& prompt, const StringView& title, CObject* parent)
+GInputBox::GInputBox(const StringView& prompt, const StringView& title, Core::Object* parent)
: GDialog(parent)
, m_prompt(prompt)
{
diff --git a/Libraries/LibGUI/GInputBox.h b/Libraries/LibGUI/GInputBox.h
index beb5a54c8a..a957ccdba1 100644
--- a/Libraries/LibGUI/GInputBox.h
+++ b/Libraries/LibGUI/GInputBox.h
@@ -34,7 +34,7 @@ class GTextEditor;
class GInputBox : public GDialog {
C_OBJECT(GInputBox)
public:
- explicit GInputBox(const StringView& prompt, const StringView& title, CObject* parent = nullptr);
+ explicit GInputBox(const StringView& prompt, const StringView& title, Core::Object* parent = nullptr);
virtual ~GInputBox() override;
String text_value() const { return m_text_value; }
diff --git a/Libraries/LibGUI/GJsonArrayModel.cpp b/Libraries/LibGUI/GJsonArrayModel.cpp
index 7f9d988a19..f706a08ab0 100644
--- a/Libraries/LibGUI/GJsonArrayModel.cpp
+++ b/Libraries/LibGUI/GJsonArrayModel.cpp
@@ -30,8 +30,8 @@
void GJsonArrayModel::update()
{
- auto file = CFile::construct(m_json_path);
- if (!file->open(CIODevice::ReadOnly)) {
+ auto file = Core::File::construct(m_json_path);
+ if (!file->open(Core::IODevice::ReadOnly)) {
dbg() << "Unable to open " << file->filename();
m_array.clear();
did_update();
diff --git a/Libraries/LibGUI/GMenu.h b/Libraries/LibGUI/GMenu.h
index 885f7315cd..0c4820d294 100644
--- a/Libraries/LibGUI/GMenu.h
+++ b/Libraries/LibGUI/GMenu.h
@@ -35,7 +35,7 @@
class GAction;
class Point;
-class GMenu final : public CObject {
+class GMenu final : public Core::Object {
C_OBJECT(GMenu)
public:
explicit GMenu(const StringView& name = "");
diff --git a/Libraries/LibGUI/GMessageBox.cpp b/Libraries/LibGUI/GMessageBox.cpp
index 9a38040fa7..ab7b0769d0 100644
--- a/Libraries/LibGUI/GMessageBox.cpp
+++ b/Libraries/LibGUI/GMessageBox.cpp
@@ -30,13 +30,13 @@
#include <LibGUI/GMessageBox.h>
#include <stdio.h>
-int GMessageBox::show(const StringView& text, const StringView& title, Type type, InputType input_type, CObject* parent)
+int GMessageBox::show(const StringView& text, const StringView& title, Type type, InputType input_type, Core::Object* parent)
{
auto box = GMessageBox::construct(text, title, type, input_type, parent);
return box->exec();
}
-GMessageBox::GMessageBox(const StringView& text, const StringView& title, Type type, InputType input_type, CObject* parent)
+GMessageBox::GMessageBox(const StringView& text, const StringView& title, Type type, InputType input_type, Core::Object* parent)
: GDialog(parent)
, m_text(text)
, m_type(type)
diff --git a/Libraries/LibGUI/GMessageBox.h b/Libraries/LibGUI/GMessageBox.h
index 2b7c62d448..f0df664d71 100644
--- a/Libraries/LibGUI/GMessageBox.h
+++ b/Libraries/LibGUI/GMessageBox.h
@@ -45,10 +45,10 @@ public:
virtual ~GMessageBox() override;
- static int show(const StringView& text, const StringView& title, Type type = Type::None, InputType = InputType::OK, CObject* parent = nullptr);
+ static int show(const StringView& text, const StringView& title, Type type = Type::None, InputType = InputType::OK, Core::Object* parent = nullptr);
private:
- explicit GMessageBox(const StringView& text, const StringView& title, Type type = Type::None, InputType = InputType::OK, CObject* parent = nullptr);
+ explicit GMessageBox(const StringView& text, const StringView& title, Type type = Type::None, InputType = InputType::OK, Core::Object* parent = nullptr);
bool should_include_ok_button() const;
bool should_include_cancel_button() const;
diff --git a/Libraries/LibGUI/GRadioButton.h b/Libraries/LibGUI/GRadioButton.h
index be2217039f..4c905ca893 100644
--- a/Libraries/LibGUI/GRadioButton.h
+++ b/Libraries/LibGUI/GRadioButton.h
@@ -53,7 +53,7 @@ private:
};
template<>
-inline bool is<GRadioButton>(const CObject& object)
+inline bool Core::is<GRadioButton>(const Core::Object& object)
{
if (!is<GWidget>(object))
return false;
diff --git a/Libraries/LibGUI/GResizeCorner.cpp b/Libraries/LibGUI/GResizeCorner.cpp
index 49a5b88daf..ce84aa2bef 100644
--- a/Libraries/LibGUI/GResizeCorner.cpp
+++ b/Libraries/LibGUI/GResizeCorner.cpp
@@ -60,13 +60,13 @@ void GResizeCorner::mousedown_event(GMouseEvent& event)
GWidget::mousedown_event(event);
}
-void GResizeCorner::enter_event(CEvent& event)
+void GResizeCorner::enter_event(Core::Event& event)
{
window()->set_override_cursor(GStandardCursor::ResizeDiagonalTLBR);
GWidget::enter_event(event);
}
-void GResizeCorner::leave_event(CEvent& event)
+void GResizeCorner::leave_event(Core::Event& event)
{
window()->set_override_cursor(GStandardCursor::None);
GWidget::leave_event(event);
diff --git a/Libraries/LibGUI/GResizeCorner.h b/Libraries/LibGUI/GResizeCorner.h
index 682afc7652..7f27928d93 100644
--- a/Libraries/LibGUI/GResizeCorner.h
+++ b/Libraries/LibGUI/GResizeCorner.h
@@ -36,8 +36,8 @@ protected:
virtual void paint_event(GPaintEvent&) override;
virtual void mousedown_event(GMouseEvent&) override;
- virtual void enter_event(CEvent&) override;
- virtual void leave_event(CEvent&) override;
+ virtual void enter_event(Core::Event&) override;
+ virtual void leave_event(Core::Event&) override;
private:
RefPtr<GraphicsBitmap> m_bitmap;
diff --git a/Libraries/LibGUI/GScrollBar.cpp b/Libraries/LibGUI/GScrollBar.cpp
index b278b8331e..5b70bb9bc7 100644
--- a/Libraries/LibGUI/GScrollBar.cpp
+++ b/Libraries/LibGUI/GScrollBar.cpp
@@ -93,7 +93,7 @@ GScrollBar::GScrollBar(Orientation orientation, GWidget* parent)
: GWidget(parent)
, m_orientation(orientation)
{
- m_automatic_scrolling_timer = CTimer::construct(this);
+ m_automatic_scrolling_timer = Core::Timer::construct(this);
if (!s_up_arrow_bitmap)
s_up_arrow_bitmap = &CharacterBitmap::create_from_ascii(s_up_arrow_bitmap_data, 9, 9).leak_ref();
if (!s_down_arrow_bitmap)
@@ -355,7 +355,7 @@ void GScrollBar::mousemove_event(GMouseEvent& event)
set_value(new_value);
}
-void GScrollBar::leave_event(CEvent&)
+void GScrollBar::leave_event(Core::Event&)
{
if (m_hovered_component != Component::Invalid) {
m_hovered_component = Component::Invalid;
diff --git a/Libraries/LibGUI/GScrollBar.h b/Libraries/LibGUI/GScrollBar.h
index bb4abd940d..dcb5dc84ae 100644
--- a/Libraries/LibGUI/GScrollBar.h
+++ b/Libraries/LibGUI/GScrollBar.h
@@ -72,7 +72,7 @@ private:
virtual void mouseup_event(GMouseEvent&) override;
virtual void mousemove_event(GMouseEvent&) override;
virtual void mousewheel_event(GMouseEvent&) override;
- virtual void leave_event(CEvent&) override;
+ virtual void leave_event(Core::Event&) override;
virtual void change_event(GEvent&) override;
int default_button_size() const { return 16; }
@@ -110,5 +110,5 @@ private:
};
AutomaticScrollingDirection m_automatic_scrolling_direction { AutomaticScrollingDirection::None };
- RefPtr<CTimer> m_automatic_scrolling_timer;
+ RefPtr<Core::Timer> m_automatic_scrolling_timer;
};
diff --git a/Libraries/LibGUI/GSlider.cpp b/Libraries/LibGUI/GSlider.cpp
index 8f07095dfb..610cb151a4 100644
--- a/Libraries/LibGUI/GSlider.cpp
+++ b/Libraries/LibGUI/GSlider.cpp
@@ -162,7 +162,7 @@ void GSlider::mouseup_event(GMouseEvent& event)
return GWidget::mouseup_event(event);
}
-void GSlider::leave_event(CEvent& event)
+void GSlider::leave_event(Core::Event& event)
{
if (!is_enabled())
return;
diff --git a/Libraries/LibGUI/GSlider.h b/Libraries/LibGUI/GSlider.h
index 1dc1eb2ddb..1ad1034c5a 100644
--- a/Libraries/LibGUI/GSlider.h
+++ b/Libraries/LibGUI/GSlider.h
@@ -77,7 +77,7 @@ protected:
virtual void mousedown_event(GMouseEvent&) override;
virtual void mousemove_event(GMouseEvent&) override;
virtual void mouseup_event(GMouseEvent&) override;
- virtual void leave_event(CEvent&) override;
+ virtual void leave_event(Core::Event&) override;
virtual void change_event(GEvent&) override;
private:
diff --git a/Libraries/LibGUI/GSplitter.cpp b/Libraries/LibGUI/GSplitter.cpp
index e1e689ed07..431bf8db3c 100644
--- a/Libraries/LibGUI/GSplitter.cpp
+++ b/Libraries/LibGUI/GSplitter.cpp
@@ -43,14 +43,14 @@ GSplitter::~GSplitter()
{
}
-void GSplitter::enter_event(CEvent&)
+void GSplitter::enter_event(Core::Event&)
{
set_background_role(ColorRole::HoverHighlight);
window()->set_override_cursor(m_orientation == Orientation::Horizontal ? GStandardCursor::ResizeHorizontal : GStandardCursor::ResizeVertical);
update();
}
-void GSplitter::leave_event(CEvent&)
+void GSplitter::leave_event(Core::Event&)
{
set_background_role(ColorRole::Button);
if (!m_resizing)
diff --git a/Libraries/LibGUI/GSplitter.h b/Libraries/LibGUI/GSplitter.h
index ff45769ed3..e061f7887f 100644
--- a/Libraries/LibGUI/GSplitter.h
+++ b/Libraries/LibGUI/GSplitter.h
@@ -39,8 +39,8 @@ protected:
virtual void mousedown_event(GMouseEvent&) override;
virtual void mousemove_event(GMouseEvent&) override;
virtual void mouseup_event(GMouseEvent&) override;
- virtual void enter_event(CEvent&) override;
- virtual void leave_event(CEvent&) override;
+ virtual void enter_event(Core::Event&) override;
+ virtual void leave_event(Core::Event&) override;
private:
Orientation m_orientation;
diff --git a/Libraries/LibGUI/GStackWidget.cpp b/Libraries/LibGUI/GStackWidget.cpp
index 548f38890f..6895948c99 100644
--- a/Libraries/LibGUI/GStackWidget.cpp
+++ b/Libraries/LibGUI/GStackWidget.cpp
@@ -59,11 +59,11 @@ void GStackWidget::resize_event(GResizeEvent& event)
m_active_widget->set_relative_rect({ {}, event.size() });
}
-void GStackWidget::child_event(CChildEvent& event)
+void GStackWidget::child_event(Core::ChildEvent& event)
{
- if (!event.child() || !is<GWidget>(*event.child()))
+ if (!event.child() || !Core::is<GWidget>(*event.child()))
return GWidget::child_event(event);
- auto& child = to<GWidget>(*event.child());
+ auto& child = Core::to<GWidget>(*event.child());
if (event.type() == GEvent::ChildAdded) {
if (!m_active_widget)
set_active_widget(&child);
diff --git a/Libraries/LibGUI/GStackWidget.h b/Libraries/LibGUI/GStackWidget.h
index 0bb240c137..2cd071576e 100644
--- a/Libraries/LibGUI/GStackWidget.h
+++ b/Libraries/LibGUI/GStackWidget.h
@@ -41,7 +41,7 @@ public:
protected:
explicit GStackWidget(GWidget* parent);
- virtual void child_event(CChildEvent&) override;
+ virtual void child_event(Core::ChildEvent&) override;
virtual void resize_event(GResizeEvent&) override;
private:
diff --git a/Libraries/LibGUI/GTabWidget.cpp b/Libraries/LibGUI/GTabWidget.cpp
index 10d2d41dc3..c9a45d2936 100644
--- a/Libraries/LibGUI/GTabWidget.cpp
+++ b/Libraries/LibGUI/GTabWidget.cpp
@@ -84,11 +84,11 @@ Rect GTabWidget::child_rect_for_size(const Size& size) const
return rect;
}
-void GTabWidget::child_event(CChildEvent& event)
+void GTabWidget::child_event(Core::ChildEvent& event)
{
- if (!event.child() || !is<GWidget>(*event.child()))
+ if (!event.child() || !Core::is<GWidget>(*event.child()))
return GWidget::child_event(event);
- auto& child = to<GWidget>(*event.child());
+ auto& child = Core::to<GWidget>(*event.child());
if (event.type() == GEvent::ChildAdded) {
if (!m_active_widget)
set_active_widget(&child);
@@ -214,7 +214,7 @@ void GTabWidget::mousemove_event(GMouseEvent& event)
update_bar();
}
-void GTabWidget::leave_event(CEvent&)
+void GTabWidget::leave_event(Core::Event&)
{
if (m_hovered_tab_index != -1) {
m_hovered_tab_index = -1;
diff --git a/Libraries/LibGUI/GTabWidget.h b/Libraries/LibGUI/GTabWidget.h
index 15a428acdf..72514b2505 100644
--- a/Libraries/LibGUI/GTabWidget.h
+++ b/Libraries/LibGUI/GTabWidget.h
@@ -55,11 +55,11 @@ public:
protected:
virtual void paint_event(GPaintEvent&) override;
- virtual void child_event(CChildEvent&) override;
+ virtual void child_event(Core::ChildEvent&) override;
virtual void resize_event(GResizeEvent&) override;
virtual void mousedown_event(GMouseEvent&) override;
virtual void mousemove_event(GMouseEvent&) override;
- virtual void leave_event(CEvent&) override;
+ virtual void leave_event(Core::Event&) override;
private:
Rect child_rect_for_size(const Size&) const;
diff --git a/Libraries/LibGUI/GTextDocument.cpp b/Libraries/LibGUI/GTextDocument.cpp
index e751ca533e..c6389cb0a8 100644
--- a/Libraries/LibGUI/GTextDocument.cpp
+++ b/Libraries/LibGUI/GTextDocument.cpp
@@ -37,7 +37,7 @@ GTextDocument::GTextDocument(Client* client)
append_line(make<GTextDocumentLine>(*this));
// TODO: Instead of a repating timer, this we should call a delayed 2 sec timer when the user types.
- m_undo_timer = CTimer::construct(
+ m_undo_timer = Core::Timer::construct(
2000, [this] {
update_undo_timer();
});
diff --git a/Libraries/LibGUI/GTextDocument.h b/Libraries/LibGUI/GTextDocument.h
index fb974c3221..7e12e14b80 100644
--- a/Libraries/LibGUI/GTextDocument.h
+++ b/Libraries/LibGUI/GTextDocument.h
@@ -146,7 +146,7 @@ private:
bool m_client_notifications_enabled { true };
GUndoStack m_undo_stack;
- RefPtr<CTimer> m_undo_timer;
+ RefPtr<Core::Timer> m_undo_timer;
};
class GTextDocumentLine {
diff --git a/Libraries/LibGUI/GTextEditor.cpp b/Libraries/LibGUI/GTextEditor.cpp
index baccab38c7..50f162322f 100644
--- a/Libraries/LibGUI/GTextEditor.cpp
+++ b/Libraries/LibGUI/GTextEditor.cpp
@@ -235,7 +235,7 @@ void GTextEditor::mousedown_event(GMouseEvent& event)
}
if (m_triple_click_timer.is_valid() && m_triple_click_timer.elapsed() < 250) {
- m_triple_click_timer = CElapsedTimer();
+ m_triple_click_timer = Core::ElapsedTimer();
GTextPosition start;
GTextPosition end;
@@ -1030,18 +1030,18 @@ void GTextEditor::set_cursor(const GTextPosition& a_position)
on_cursor_change();
}
-void GTextEditor::focusin_event(CEvent&)
+void GTextEditor::focusin_event(Core::Event&)
{
update_cursor();
start_timer(500);
}
-void GTextEditor::focusout_event(CEvent&)
+void GTextEditor::focusout_event(Core::Event&)
{
stop_timer();
}
-void GTextEditor::timer_event(CTimerEvent&)
+void GTextEditor::timer_event(Core::TimerEvent&)
{
m_cursor_state = !m_cursor_state;
if (is_focused())
@@ -1171,13 +1171,13 @@ void GTextEditor::paste()
insert_at_cursor_or_replace_selection(paste_text);
}
-void GTextEditor::enter_event(CEvent&)
+void GTextEditor::enter_event(Core::Event&)
{
ASSERT(window());
window()->set_override_cursor(GStandardCursor::IBeam);
}
-void GTextEditor::leave_event(CEvent&)
+void GTextEditor::leave_event(Core::Event&)
{
ASSERT(window());
window()->set_override_cursor(GStandardCursor::None);
diff --git a/Libraries/LibGUI/GTextEditor.h b/Libraries/LibGUI/GTextEditor.h
index b278a49a61..8c67fce7b5 100644
--- a/Libraries/LibGUI/GTextEditor.h
+++ b/Libraries/LibGUI/GTextEditor.h
@@ -142,12 +142,12 @@ protected:
virtual void mousemove_event(GMouseEvent&) override;
virtual void doubleclick_event(GMouseEvent&) override;
virtual void keydown_event(GKeyEvent&) override;
- virtual void focusin_event(CEvent&) override;
- virtual void focusout_event(CEvent&) override;
- virtual void timer_event(CTimerEvent&) override;
+ virtual void focusin_event(Core::Event&) override;
+ virtual void focusout_event(Core::Event&) override;
+ virtual void timer_event(Core::TimerEvent&) override;
virtual bool accepts_focus() const override { return true; }
- virtual void enter_event(CEvent&) override;
- virtual void leave_event(CEvent&) override;
+ virtual void enter_event(Core::Event&) override;
+ virtual void leave_event(Core::Event&) override;
virtual void context_menu_event(GContextMenuEvent&) override;
virtual void resize_event(GResizeEvent&) override;
virtual void cursor_did_change() {}
@@ -232,7 +232,7 @@ private:
RefPtr<GAction> m_paste_action;
RefPtr<GAction> m_delete_action;
RefPtr<GAction> m_go_to_line_action;
- CElapsedTimer m_triple_click_timer;
+ Core::ElapsedTimer m_triple_click_timer;
NonnullRefPtrVector<GAction> m_custom_context_menu_actions;
RefPtr<GTextDocument> m_document;
diff --git a/Libraries/LibGUI/GWidget.cpp b/Libraries/LibGUI/GWidget.cpp
index 0ee5a83356..f4c76f1e1e 100644
--- a/Libraries/LibGUI/GWidget.cpp
+++ b/Libraries/LibGUI/GWidget.cpp
@@ -91,7 +91,7 @@ const GWidgetClassRegistration* GWidgetClassRegistration::find(const String& cla
}
GWidget::GWidget(GWidget* parent)
- : CObject(parent, true)
+ : Core::Object(parent, true)
, m_font(Font::default_font())
, m_palette(GApplication::the().palette().impl())
{
@@ -101,26 +101,26 @@ GWidget::~GWidget()
{
}
-void GWidget::child_event(CChildEvent& event)
+void GWidget::child_event(Core::ChildEvent& event)
{
if (event.type() == GEvent::ChildAdded) {
- if (event.child() && is<GWidget>(*event.child()) && layout()) {
+ if (event.child() && Core::is<GWidget>(*event.child()) && layout()) {
if (event.insertion_before_child() && event.insertion_before_child()->is_widget())
- layout()->insert_widget_before(to<GWidget>(*event.child()), to<GWidget>(*event.insertion_before_child()));
+ layout()->insert_widget_before(Core::to<GWidget>(*event.child()), Core::to<GWidget>(*event.insertion_before_child()));
else
- layout()->add_widget(to<GWidget>(*event.child()));
+ layout()->add_widget(Core::to<GWidget>(*event.child()));
}
}
if (event.type() == GEvent::ChildRemoved) {
if (layout()) {
- if (event.child() && is<GWidget>(*event.child()))
- layout()->remove_widget(to<GWidget>(*event.child()));
+ if (event.child() && Core::is<GWidget>(*event.child()))
+ layout()->remove_widget(Core::to<GWidget>(*event.child()));
else
invalidate_layout();
}
update();
}
- return CObject::child_event(event);
+ return Core::Object::child_event(event);
}
void GWidget::set_relative_rect(const Rect& a_rect)
@@ -151,7 +151,7 @@ void GWidget::set_relative_rect(const Rect& a_rect)
update();
}
-void GWidget::event(CEvent& event)
+void GWidget::event(Core::Event& event)
{
switch (event.type()) {
case GEvent::Paint:
@@ -189,7 +189,7 @@ void GWidget::event(CEvent& event)
case GEvent::EnabledChange:
return change_event(static_cast<GEvent&>(event));
default:
- return CObject::event(event);
+ return Core::Object::event(event);
}
}
@@ -278,14 +278,14 @@ void GWidget::handle_mousedoubleclick_event(GMouseEvent& event)
doubleclick_event(event);
}
-void GWidget::handle_enter_event(CEvent& event)
+void GWidget::handle_enter_event(Core::Event& event)
{
if (has_tooltip())
GApplication::the().show_tooltip(m_tooltip, screen_relative_rect().center().translated(0, height() / 2));
enter_event(event);
}
-void GWidget::handle_leave_event(CEvent& event)
+void GWidget::handle_leave_event(Core::Event& event)
{
GApplication::the().hide_tooltip();
leave_event(event);
@@ -356,19 +356,19 @@ void GWidget::context_menu_event(GContextMenuEvent&)
{
}
-void GWidget::focusin_event(CEvent&)
+void GWidget::focusin_event(Core::Event&)
{
}
-void GWidget::focusout_event(CEvent&)
+void GWidget::focusout_event(Core::Event&)
{
}
-void GWidget::enter_event(CEvent&)
+void GWidget::enter_event(Core::Event&)
{
}
-void GWidget::leave_event(CEvent&)
+void GWidget::leave_event(Core::Event&)
{
}
@@ -426,9 +426,9 @@ Rect GWidget::screen_relative_rect() const
GWidget* GWidget::child_at(const Point& point) const
{
for (int i = children().size() - 1; i >= 0; --i) {
- if (!is<GWidget>(children()[i]))
+ if (!Core::is<GWidget>(children()[i]))
continue;
- auto& child = to<GWidget>(children()[i]);
+ auto& child = Core::to<GWidget>(children()[i]);
if (!child.is_visible())
continue;
if (child.relative_rect().contains(point))
@@ -701,7 +701,7 @@ void GWidget::save_to(AK::JsonObject& json)
json.set("foreground_color", foreground_color().to_string());
json.set("preferred_size", preferred_size().to_string());
json.set("size_policy", String::format("[%s,%s]", to_string(horizontal_size_policy()), to_string(vertical_size_policy())));
- CObject::save_to(json);
+ Core::Object::save_to(json);
}
Vector<GWidget*> GWidget::child_widgets() const
diff --git a/Libraries/LibGUI/GWidget.h b/Libraries/LibGUI/GWidget.h
index f9a3921564..9efeac0780 100644
--- a/Libraries/LibGUI/GWidget.h
+++ b/Libraries/LibGUI/GWidget.h
@@ -94,7 +94,7 @@ private:
Function<NonnullRefPtr<GWidget>(GWidget*)> m_factory;
};
-class GWidget : public CObject {
+class GWidget : public Core::Object {
C_OBJECT(GWidget)
public:
virtual ~GWidget() override;
@@ -123,7 +123,7 @@ public:
bool updates_enabled() const { return m_updates_enabled; }
void set_updates_enabled(bool);
- virtual void event(CEvent&) override;
+ virtual void event(Core::Event&) override;
// This is called after children have been painted.
virtual void second_paint_event(GPaintEvent&);
@@ -245,8 +245,8 @@ public:
void for_each_child_widget(Callback callback)
{
for_each_child([&](auto& child) {
- if (is<GWidget>(child))
- return callback(to<GWidget>(child));
+ if (Core::is<GWidget>(child))
+ return callback(Core::to<GWidget>(child));
return IterationDecision::Continue;
});
}
@@ -281,11 +281,11 @@ protected:
virtual void click_event(GMouseEvent&);
virtual void doubleclick_event(GMouseEvent&);
virtual void context_menu_event(GContextMenuEvent&);
- virtual void focusin_event(CEvent&);
- virtual void focusout_event(CEvent&);
- virtual void enter_event(CEvent&);
- virtual void leave_event(CEvent&);
- virtual void child_event(CChildEvent&) override;
+ virtual void focusin_event(Core::Event&);
+ virtual void focusout_event(Core::Event&);
+ virtual void enter_event(Core::Event&);
+ virtual void leave_event(Core::Event&);
+ virtual void child_event(Core::ChildEvent&) override;
virtual void change_event(GEvent&);
virtual void drop_event(GDropEvent&);
@@ -295,8 +295,8 @@ private:
void handle_mousedown_event(GMouseEvent&);
void handle_mousedoubleclick_event(GMouseEvent&);
void handle_mouseup_event(GMouseEvent&);
- void handle_enter_event(CEvent&);
- void handle_leave_event(CEvent&);
+ void handle_enter_event(Core::Event&);
+ void handle_leave_event(Core::Event&);
void focus_previous_widget();
void focus_next_widget();
@@ -326,20 +326,20 @@ private:
};
template<>
-inline bool is<GWidget>(const CObject& object)
+inline bool Core::is<GWidget>(const Core::Object& object)
{
return object.is_widget();
}
inline GWidget* GWidget::parent_widget()
{
- if (parent() && is<GWidget>(*parent()))
- return &to<GWidget>(*parent());
+ if (parent() && Core::is<GWidget>(*parent()))
+ return &Core::to<GWidget>(*parent());
return nullptr;
}
inline const GWidget* GWidget::parent_widget() const
{
- if (parent() && is<GWidget>(*parent()))
- return &to<const GWidget>(*parent());
+ if (parent() && Core::is<GWidget>(*parent()))
+ return &Core::to<const GWidget>(*parent());
return nullptr;
}
diff --git a/Libraries/LibGUI/GWindow.cpp b/Libraries/LibGUI/GWindow.cpp
index 4bab839163..d60c49a3ca 100644
--- a/Libraries/LibGUI/GWindow.cpp
+++ b/Libraries/LibGUI/GWindow.cpp
@@ -53,8 +53,8 @@ GWindow* GWindow::from_window_id(int window_id)
return nullptr;
}
-GWindow::GWindow(CObject* parent)
- : CObject(parent)
+GWindow::GWindow(Core::Object* parent)
+ : Core::Object(parent)
{
all_windows->set(this);
m_rect_when_windowless = { 100, 400, 140, 140 };
@@ -179,7 +179,7 @@ void GWindow::set_override_cursor(GStandardCursor cursor)
GWindowServerConnection::the().send_sync<WindowServer::SetWindowOverrideCursor>(m_window_id, (u32)cursor);
}
-void GWindow::event(CEvent& event)
+void GWindow::event(Core::Event& event)
{
if (event.type() == GEvent::Drop) {
auto& drop_event = static_cast<GDropEvent&>(event);
@@ -317,7 +317,7 @@ void GWindow::event(CEvent& event)
if (event.type() > GEvent::__Begin_WM_Events && event.type() < GEvent::__End_WM_Events)
return wm_event(static_cast<GWMEvent&>(event));
- CObject::event(event);
+ Core::Object::event(event);
}
bool GWindow::is_visible() const
@@ -386,12 +386,12 @@ void GWindow::set_focused_widget(GWidget* widget)
if (m_focused_widget == widget)
return;
if (m_focused_widget) {
- CEventLoop::current().post_event(*m_focused_widget, make<GEvent>(GEvent::FocusOut));
+ Core::EventLoop::current().post_event(*m_focused_widget, make<GEvent>(GEvent::FocusOut));
m_focused_widget->update();
}
m_focused_widget = widget ? widget->make_weak_ptr() : nullptr;
if (m_focused_widget) {
- CEventLoop::current().post_event(*m_focused_widget, make<GEvent>(GEvent::FocusIn));
+ Core::EventLoop::current().post_event(*m_focused_widget, make<GEvent>(GEvent::FocusIn));
m_focused_widget->update();
}
}
@@ -446,12 +446,12 @@ void GWindow::set_hovered_widget(GWidget* widget)
return;
if (m_hovered_widget)
- CEventLoop::current().post_event(*m_hovered_widget, make<GEvent>(GEvent::Leave));
+ Core::EventLoop::current().post_event(*m_hovered_widget, make<GEvent>(GEvent::Leave));
m_hovered_widget = widget ? widget->make_weak_ptr() : nullptr;
if (m_hovered_widget)
- CEventLoop::current().post_event(*m_hovered_widget, make<GEvent>(GEvent::Enter));
+ Core::EventLoop::current().post_event(*m_hovered_widget, make<GEvent>(GEvent::Enter));
}
void GWindow::set_current_backing_bitmap(GraphicsBitmap& bitmap, bool flush_immediately)
@@ -583,7 +583,7 @@ void GWindow::save_to(AK::JsonObject& json)
json.set("rect", rect().to_string());
json.set("base_size", base_size().to_string());
json.set("size_increment", size_increment().to_string());
- CObject::save_to(json);
+ Core::Object::save_to(json);
}
void GWindow::set_fullscreen(bool fullscreen)
diff --git a/Libraries/LibGUI/GWindow.h b/Libraries/LibGUI/GWindow.h
index ae47f1efe8..708ebfe707 100644
--- a/Libraries/LibGUI/GWindow.h
+++ b/Libraries/LibGUI/GWindow.h
@@ -52,7 +52,7 @@ enum class GStandardCursor {
Hand,
};
-class GWindow : public CObject {
+class GWindow : public Core::Object {
C_OBJECT(GWindow)
public:
virtual ~GWindow() override;
@@ -112,7 +112,7 @@ public:
void resize(int width, int height) { resize({ width, height }); }
void resize(const Size& size) { set_rect({ position(), size }); }
- virtual void event(CEvent&) override;
+ virtual void event(Core::Event&) override;
bool is_visible() const;
bool is_active() const { return m_is_active; }
@@ -175,7 +175,7 @@ public:
GAction* action_for_key_event(const GKeyEvent&);
protected:
- GWindow(CObject* parent = nullptr);
+ GWindow(Core::Object* parent = nullptr);
virtual void wm_event(GWMEvent&);
private:
@@ -216,7 +216,7 @@ private:
};
template<>
-inline bool is<GWindow>(const CObject& object)
+inline bool Core::is<GWindow>(const Core::Object& object)
{
return object.is_window();
}
diff --git a/Libraries/LibGUI/GWindowServerConnection.cpp b/Libraries/LibGUI/GWindowServerConnection.cpp
index c8ac8c775f..c514e59a99 100644
--- a/Libraries/LibGUI/GWindowServerConnection.cpp
+++ b/Libraries/LibGUI/GWindowServerConnection.cpp
@@ -75,13 +75,13 @@ void GWindowServerConnection::handle(const WindowClient::Paint& message)
dbgprintf("WID=%d Paint\n", message.window_id());
#endif
if (auto* window = GWindow::from_window_id(message.window_id()))
- CEventLoop::current().post_event(*window, make<GMultiPaintEvent>(message.rects(), message.window_size()));
+ Core::EventLoop::current().post_event(*window, make<GMultiPaintEvent>(message.rects(), message.window_size()));
}
void GWindowServerConnection::handle(const WindowClient::WindowResized& message)
{
if (auto* window = GWindow::from_window_id(message.window_id())) {
- CEventLoop::current().post_event(*window, make<GResizeEvent>(message.old_rect().size(), message.new_rect().size()));
+ Core::EventLoop::current().post_event(*window, make<GResizeEvent>(message.old_rect().size(), message.new_rect().size()));
}
}
@@ -91,7 +91,7 @@ void GWindowServerConnection::handle(const WindowClient::WindowActivated& messag
dbgprintf("(%d) WID=%d WindowActivated\n", getpid(), message.window_id());
#endif
if (auto* window = GWindow::from_window_id(message.window_id()))
- CEventLoop::current().post_event(*window, make<GEvent>(GEvent::WindowBecameActive));
+ Core::EventLoop::current().post_event(*window, make<GEvent>(GEvent::WindowBecameActive));
}
void GWindowServerConnection::handle(const WindowClient::WindowDeactivated& message)
@@ -100,25 +100,25 @@ void GWindowServerConnection::handle(const WindowClient::WindowDeactivated& mess
dbgprintf("(%d) WID=%d WindowDeactivated\n", getpid(), message.window_id());
#endif
if (auto* window = GWindow::from_window_id(message.window_id()))
- CEventLoop::current().post_event(*window, make<GEvent>(GEvent::WindowBecameInactive));
+ Core::EventLoop::current().post_event(*window, make<GEvent>(GEvent::WindowBecameInactive));
}
void GWindowServerConnection::handle(const WindowClient::WindowCloseRequest& message)
{
if (auto* window = GWindow::from_window_id(message.window_id()))
- CEventLoop::current().post_event(*window, make<GEvent>(GEvent::WindowCloseRequest));
+ Core::EventLoop::current().post_event(*window, make<GEvent>(GEvent::WindowCloseRequest));
}
void GWindowServerConnection::handle(const WindowClient::WindowEntered& message)
{
if (auto* window = GWindow::from_window_id(message.window_id()))
- CEventLoop::current().post_event(*window, make<GEvent>(GEvent::WindowEntered));
+ Core::EventLoop::current().post_event(*window, make<GEvent>(GEvent::WindowEntered));
}
void GWindowServerConnection::handle(const WindowClient::WindowLeft& message)
{
if (auto* window = GWindow::from_window_id(message.window_id()))
- CEventLoop::current().post_event(*window, make<GEvent>(GEvent::WindowLeft));
+ Core::EventLoop::current().post_event(*window, make<GEvent>(GEvent::WindowLeft));
}
void GWindowServerConnection::handle(const WindowClient::KeyDown& message)
@@ -151,7 +151,7 @@ void GWindowServerConnection::handle(const WindowClient::KeyDown& message)
action->activate();
return;
}
- CEventLoop::current().post_event(*window, move(key_event));
+ Core::EventLoop::current().post_event(*window, move(key_event));
}
void GWindowServerConnection::handle(const WindowClient::KeyUp& message)
@@ -169,7 +169,7 @@ void GWindowServerConnection::handle(const WindowClient::KeyUp& message)
key_event->m_text = String(&ch, 1);
}
- CEventLoop::current().post_event(*window, move(key_event));
+ Core::EventLoop::current().post_event(*window, move(key_event));
}
GMouseButton to_gmousebutton(u32 button)
@@ -196,7 +196,7 @@ void GWindowServerConnection::handle(const WindowClient::MouseDown& message)
#endif
if (auto* window = GWindow::from_window_id(message.window_id()))
- CEventLoop::current().post_event(*window, make<GMouseEvent>(GEvent::MouseDown, message.mouse_position(), message.buttons(), to_gmousebutton(message.button()), message.modifiers(), message.wheel_delta()));
+ Core::EventLoop::current().post_event(*window, make<GMouseEvent>(GEvent::MouseDown, message.mouse_position(), message.buttons(), to_gmousebutton(message.button()), message.modifiers(), message.wheel_delta()));
}
void GWindowServerConnection::handle(const WindowClient::MouseUp& message)
@@ -206,7 +206,7 @@ void GWindowServerConnection::handle(const WindowClient::MouseUp& message)
#endif
if (auto* window = GWindow::from_window_id(message.window_id()))
- CEventLoop::current().post_event(*window, make<GMouseEvent>(GEvent::MouseUp, message.mouse_position(), message.buttons(), to_gmousebutton(message.button()), message.modifiers(), message.wheel_delta()));
+ Core::EventLoop::current().post_event(*window, make<GMouseEvent>(GEvent::MouseUp, message.mouse_position(), message.buttons(), to_gmousebutton(message.button()), message.modifiers(), message.wheel_delta()));
}
void GWindowServerConnection::handle(const WindowClient::MouseMove& message)
@@ -216,7 +216,7 @@ void GWindowServerConnection::handle(const WindowClient::MouseMove& message)
#endif
if (auto* window = GWindow::from_window_id(message.window_id()))
- CEventLoop::current().post_event(*window, make<GMouseEvent>(GEvent::MouseMove, message.mouse_position(), message.buttons(), to_gmousebutton(message.button()), message.modifiers(), message.wheel_delta()));
+ Core::EventLoop::current().post_event(*window, make<GMouseEvent>(GEvent::MouseMove, message.mouse_position(), message.buttons(), to_gmousebutton(message.button()), message.modifiers(), message.wheel_delta()));
}
void GWindowServerConnection::handle(const WindowClient::MouseDoubleClick& message)
@@ -226,7 +226,7 @@ void GWindowServerConnection::handle(const WindowClient::MouseDoubleClick& messa
#endif
if (auto* window = GWindow::from_window_id(message.window_id()))
- CEventLoop::current().post_event(*window, make<GMouseEvent>(GEvent::MouseDoubleClick, message.mouse_position(), message.buttons(), to_gmousebutton(message.button()), message.modifiers(), message.wheel_delta()));
+ Core::EventLoop::current().post_event(*window, make<GMouseEvent>(GEvent::MouseDoubleClick, message.mouse_position(), message.buttons(), to_gmousebutton(message.button()), message.modifiers(), message.wheel_delta()));
}
void GWindowServerConnection::handle(const WindowClient::MouseWheel& message)
@@ -236,7 +236,7 @@ void GWindowServerConnection::handle(const WindowClient::MouseWheel& message)
#endif
if (auto* window = GWindow::from_window_id(message.window_id()))
- CEventLoop::current().post_event(*window, make<GMouseEvent>(GEvent::MouseWheel, message.mouse_position(), message.buttons(), to_gmousebutton(message.button()), message.modifiers(), message.wheel_delta()));
+ Core::EventLoop::current().post_event(*window, make<GMouseEvent>(GEvent::MouseWheel, message.mouse_position(), message.buttons(), to_gmousebutton(message.button()), message.modifiers(), message.wheel_delta()));
}
void GWindowServerConnection::handle(const WindowClient::MenuItemActivated& message)
@@ -256,7 +256,7 @@ void GWindowServerConnection::handle(const WindowClient::WM_WindowStateChanged&
dbgprintf("GEventLoop: handle_wm_event: %d\n", (int)event.type);
#endif
if (auto* window = GWindow::from_window_id(message.wm_id()))
- CEventLoop::current().post_event(*window, make<GWMWindowStateChangedEvent>(message.client_id(), message.window_id(), message.title(), message.rect(), message.is_active(), (GWindowType)message.window_type(), message.is_minimized()));
+ Core::EventLoop::current().post_event(*window, make<GWMWindowStateChangedEvent>(message.client_id(), message.window_id(), message.title(), message.rect(), message.is_active(), (GWindowType)message.window_type(), message.is_minimized()));
}
void GWindowServerConnection::handle(const WindowClient::WM_WindowRectChanged& message)
@@ -265,7 +265,7 @@ void GWindowServerConnection::handle(const WindowClient::WM_WindowRectChanged& m
dbgprintf("GEventLoop: handle_wm_event: %d\n", (int)event.type);
#endif
if (auto* window = GWindow::from_window_id(message.wm_id()))
- CEventLoop::current().post_event(*window, make<GWMWindowRectChangedEvent>(message.client_id(), message.window_id(), message.rect()));
+ Core::EventLoop::current().post_event(*window, make<GWMWindowRectChangedEvent>(message.client_id(), message.window_id(), message.rect()));
}
void GWindowServerConnection::handle(const WindowClient::WM_WindowIconBitmapChanged& message)
@@ -274,7 +274,7 @@ void GWindowServerConnection::handle(const WindowClient::WM_WindowIconBitmapChan
dbgprintf("GEventLoop: handle_wm_event: %d\n", (int)event.type);
#endif
if (auto* window = GWindow::from_window_id(message.wm_id()))
- CEventLoop::current().post_event(*window, make<GWMWindowIconBitmapChangedEvent>(message.client_id(), message.window_id(), message.icon_buffer_id(), message.icon_size()));
+ Core::EventLoop::current().post_event(*window, make<GWMWindowIconBitmapChangedEvent>(message.client_id(), message.window_id(), message.icon_buffer_id(), message.icon_size()));
}
void GWindowServerConnection::handle(const WindowClient::WM_WindowRemoved& message)
@@ -283,7 +283,7 @@ void GWindowServerConnection::handle(const WindowClient::WM_WindowRemoved& messa
dbgprintf("GEventLoop: handle_wm_event: %d\n", (int)event.type);
#endif
if (auto* window = GWindow::from_window_id(message.wm_id()))
- CEventLoop::current().post_event(*window, make<GWMWindowRemovedEvent>(message.client_id(), message.window_id()));
+ Core::EventLoop::current().post_event(*window, make<GWMWindowRemovedEvent>(message.client_id(), message.window_id()));
}
void GWindowServerConnection::handle(const WindowClient::ScreenRectChanged& message)
@@ -304,7 +304,7 @@ void GWindowServerConnection::handle(const WindowClient::AsyncSetWallpaperFinish
void GWindowServerConnection::handle(const WindowClient::DragDropped& message)
{
if (auto* window = GWindow::from_window_id(message.window_id()))
- CEventLoop::current().post_event(*window, make<GDropEvent>(message.mouse_position(), message.text(), message.data_type(), message.data()));
+ Core::EventLoop::current().post_event(*window, make<GDropEvent>(message.mouse_position(), message.text(), message.data_type(), message.data()));
}
void GWindowServerConnection::handle(const WindowClient::DragAccepted&)
diff --git a/Libraries/LibHTML/CSS/StyleProperties.cpp b/Libraries/LibHTML/CSS/StyleProperties.cpp
index a7e10a087f..a2c3fe7b64 100644
--- a/Libraries/LibHTML/CSS/StyleProperties.cpp
+++ b/Libraries/LibHTML/CSS/StyleProperties.cpp
@@ -109,7 +109,7 @@ void StyleProperties::load_font() const
auto look_for_file = [](const StringView& expected_name) -> String {
// TODO: handle font sizes properly?
- CDirIterator it { "/res/fonts/", CDirIterator::Flags::SkipDots };
+ Core::DirIterator it { "/res/fonts/", Core::DirIterator::Flags::SkipDots };
while (it.has_next()) {
String name = it.next_path();
ASSERT(name.ends_with(".font"));
diff --git a/Libraries/LibHTML/CodeGenerators/Generate_CSS_PropertyID_cpp/Generate_CSS_PropertyID_cpp.cpp b/Libraries/LibHTML/CodeGenerators/Generate_CSS_PropertyID_cpp/Generate_CSS_PropertyID_cpp.cpp
index 173fa4ef84..ebcd2b60d9 100644
--- a/Libraries/LibHTML/CodeGenerators/Generate_CSS_PropertyID_cpp/Generate_CSS_PropertyID_cpp.cpp
+++ b/Libraries/LibHTML/CodeGenerators/Generate_CSS_PropertyID_cpp/Generate_CSS_PropertyID_cpp.cpp
@@ -51,8 +51,8 @@ int main(int argc, char** argv)
fprintf(stderr, "usage: %s <path/to/CSS/Properties.json>\n", argv[0]);
return 1;
}
- auto file = CFile::construct(argv[1]);
- if (!file->open(CIODevice::ReadOnly))
+ auto file = Core::File::construct(argv[1]);
+ if (!file->open(Core::IODevice::ReadOnly))
return 1;
auto json = JsonValue::from_string(file->read_all());
diff --git a/Libraries/LibHTML/CodeGenerators/Generate_CSS_PropertyID_h/Generate_CSS_PropertyID_h.cpp b/Libraries/LibHTML/CodeGenerators/Generate_CSS_PropertyID_h/Generate_CSS_PropertyID_h.cpp
index 571f42fd12..0a53d66696 100644
--- a/Libraries/LibHTML/CodeGenerators/Generate_CSS_PropertyID_h/Generate_CSS_PropertyID_h.cpp
+++ b/Libraries/LibHTML/CodeGenerators/Generate_CSS_PropertyID_h/Generate_CSS_PropertyID_h.cpp
@@ -51,8 +51,8 @@ int main(int argc, char** argv)
fprintf(stderr, "usage: %s <path/to/CSS/Properties.json>\n", argv[0]);
return 1;
}
- auto file = CFile::construct(argv[1]);
- if (!file->open(CIODevice::ReadOnly))
+ auto file = Core::File::construct(argv[1]);
+ if (!file->open(Core::IODevice::ReadOnly))
return 1;
auto json = JsonValue::from_string(file->read_all());
diff --git a/Libraries/LibHTML/DOM/Document.cpp b/Libraries/LibHTML/DOM/Document.cpp
index 9fdd86be36..e06d503554 100644
--- a/Libraries/LibHTML/DOM/Document.cpp
+++ b/Libraries/LibHTML/DOM/Document.cpp
@@ -47,7 +47,7 @@ Document::Document()
: ParentNode(*this, NodeType::DOCUMENT_NODE)
, m_style_resolver(make<StyleResolver>(*this))
{
- m_style_update_timer = CTimer::construct();
+ m_style_update_timer = Core::Timer::construct();
m_style_update_timer->set_single_shot(true);
m_style_update_timer->set_interval(0);
m_style_update_timer->on_timeout = [this] {
diff --git a/Libraries/LibHTML/DOM/Document.h b/Libraries/LibHTML/DOM/Document.h
index dc781a25c6..49bef5168b 100644
--- a/Libraries/LibHTML/DOM/Document.h
+++ b/Libraries/LibHTML/DOM/Document.h
@@ -36,8 +36,11 @@
#include <LibHTML/CSS/StyleSheet.h>
#include <LibHTML/DOM/ParentNode.h>
+namespace Core {
+class Timer;
+}
+
class Palette;
-class CTimer;
class Frame;
class HTMLBodyElement;
class HTMLHtmlElement;
@@ -135,7 +138,7 @@ private:
Optional<Color> m_active_link_color;
Optional<Color> m_visited_link_color;
- RefPtr<CTimer> m_style_update_timer;
+ RefPtr<Core::Timer> m_style_update_timer;
String m_source;
};
diff --git a/Libraries/LibHTML/DOM/HTMLBlinkElement.cpp b/Libraries/LibHTML/DOM/HTMLBlinkElement.cpp
index ff174eaac6..26d4ac6b71 100644
--- a/Libraries/LibHTML/DOM/HTMLBlinkElement.cpp
+++ b/Libraries/LibHTML/DOM/HTMLBlinkElement.cpp
@@ -32,7 +32,7 @@
HTMLBlinkElement::HTMLBlinkElement(Document& document, const String& tag_name)
: HTMLElement(document, tag_name)
- , m_timer(CTimer::construct())
+ , m_timer(Core::Timer::construct())
{
m_timer->set_interval(500);
m_timer->on_timeout = [this] { blink(); };
diff --git a/Libraries/LibHTML/DOM/HTMLBlinkElement.h b/Libraries/LibHTML/DOM/HTMLBlinkElement.h
index a673d81c36..8e9594bbf3 100644
--- a/Libraries/LibHTML/DOM/HTMLBlinkElement.h
+++ b/Libraries/LibHTML/DOM/HTMLBlinkElement.h
@@ -28,7 +28,9 @@
#include <LibHTML/DOM/HTMLElement.h>
-class CTimer;
+namespace Core {
+class Timer;
+}
class HTMLBlinkElement : public HTMLElement {
public:
@@ -38,5 +40,5 @@ public:
private:
void blink();
- NonnullRefPtr<CTimer> m_timer;
+ NonnullRefPtr<Core::Timer> m_timer;
};
diff --git a/Libraries/LibHTML/ResourceLoader.cpp b/Libraries/LibHTML/ResourceLoader.cpp
index 759144c9ad..6aabe84732 100644
--- a/Libraries/LibHTML/ResourceLoader.cpp
+++ b/Libraries/LibHTML/ResourceLoader.cpp
@@ -46,9 +46,9 @@ ResourceLoader::ResourceLoader()
void ResourceLoader::load(const URL& url, Function<void(const ByteBuffer&)> callback)
{
if (url.protocol() == "file") {
- auto f = CFile::construct();
+ auto f = Core::File::construct();
f->set_filename(url.path());
- if (!f->open(CIODevice::OpenMode::ReadOnly)) {
+ if (!f->open(Core::IODevice::OpenMode::ReadOnly)) {
dbg() << "ResourceLoader::load: Error: " << f->error_string();
callback({});
return;
diff --git a/Libraries/LibHTML/ResourceLoader.h b/Libraries/LibHTML/ResourceLoader.h
index 62fff3f89b..ef634deea2 100644
--- a/Libraries/LibHTML/ResourceLoader.h
+++ b/Libraries/LibHTML/ResourceLoader.h
@@ -34,7 +34,7 @@ namespace LibProtocol {
class Client;
}
-class ResourceLoader : public CObject {
+class ResourceLoader : public Core::Object {
C_OBJECT(ResourceLoader)
public:
static ResourceLoader& the();
diff --git a/Libraries/LibIPC/IClientConnection.h b/Libraries/LibIPC/IClientConnection.h
index e20219cbbb..7542d7b78c 100644
--- a/Libraries/LibIPC/IClientConnection.h
+++ b/Libraries/LibIPC/IClientConnection.h
@@ -40,7 +40,7 @@
#include <sys/types.h>
#include <unistd.h>
-class IEvent : public CEvent {
+class IEvent : public Core::Event {
public:
enum Type {
Invalid = 2000,
@@ -48,7 +48,7 @@ public:
};
IEvent() {}
explicit IEvent(Type type)
- : CEvent(type)
+ : Core::Event(type)
{
}
};
@@ -74,9 +74,9 @@ NonnullRefPtr<T> new_client_connection(Args&&... args)
}
template<typename Endpoint>
-class IClientConnection : public CObject {
+class IClientConnection : public Core::Object {
public:
- IClientConnection(Endpoint& endpoint, CLocalSocket& socket, int client_id)
+ IClientConnection(Endpoint& endpoint, Core::LocalSocket& socket, int client_id)
: m_endpoint(endpoint)
, m_socket(socket)
, m_client_id(client_id)
@@ -133,7 +133,7 @@ public:
ssize_t nread = recv(m_socket->fd(), buffer, sizeof(buffer), MSG_DONTWAIT);
if (nread == 0 || (nread == -1 && errno == EAGAIN)) {
if (bytes.is_empty()) {
- CEventLoop::current().post_event(*this, make<IDisconnectedEvent>(client_id()));
+ Core::EventLoop::current().post_event(*this, make<IDisconnectedEvent>(client_id()));
return;
}
break;
@@ -184,7 +184,7 @@ public:
virtual void die() = 0;
protected:
- void event(CEvent& event) override
+ void event(Core::Event& event) override
{
if (event.type() == IEvent::Disconnected) {
int client_id = static_cast<const IDisconnectedEvent&>(event).client_id();
@@ -193,12 +193,12 @@ protected:
return;
}
- CObject::event(event);
+ Core::Object::event(event);
}
private:
Endpoint& m_endpoint;
- RefPtr<CLocalSocket> m_socket;
+ RefPtr<Core::LocalSocket> m_socket;
int m_client_id { -1 };
int m_client_pid { -1 };
};
diff --git a/Libraries/LibIPC/IServerConnection.h b/Libraries/LibIPC/IServerConnection.h
index 31b7ce7f56..90dfbe7730 100644
--- a/Libraries/LibIPC/IServerConnection.h
+++ b/Libraries/LibIPC/IServerConnection.h
@@ -41,12 +41,12 @@
#include <unistd.h>
template<typename LocalEndpoint, typename PeerEndpoint>
-class IServerConnection : public CObject {
+class IServerConnection : public Core::Object {
public:
IServerConnection(LocalEndpoint& local_endpoint, const StringView& address)
: m_local_endpoint(local_endpoint)
- , m_connection(CLocalSocket::construct(this))
- , m_notifier(CNotifier::construct(m_connection->fd(), CNotifier::Read, this))
+ , m_connection(Core::LocalSocket::construct(this))
+ , m_notifier(Core::Notifier::construct(m_connection->fd(), Core::Notifier::Read, this))
{
// We want to rate-limit our clients
m_connection->set_blocking(true);
@@ -57,7 +57,7 @@ public:
int retries = 100000;
while (retries) {
- if (m_connection->connect(CSocketAddress::local(address))) {
+ if (m_connection->connect(Core::SocketAddress::local(address))) {
break;
}
@@ -193,8 +193,8 @@ private:
}
LocalEndpoint& m_local_endpoint;
- RefPtr<CLocalSocket> m_connection;
- RefPtr<CNotifier> m_notifier;
+ RefPtr<Core::LocalSocket> m_connection;
+ RefPtr<Core::Notifier> m_notifier;
Vector<OwnPtr<IMessage>> m_unprocessed_messages;
int m_server_pid { -1 };
int m_my_client_id { -1 };
diff --git a/Libraries/LibThread/BackgroundAction.h b/Libraries/LibThread/BackgroundAction.h
index 44cece2b75..35d39d3724 100644
--- a/Libraries/LibThread/BackgroundAction.h
+++ b/Libraries/LibThread/BackgroundAction.h
@@ -52,14 +52,14 @@ private:
};
template<typename Result>
-class BackgroundAction final : public CObject
+class BackgroundAction final : public Core::Object
, private BackgroundActionBase {
C_OBJECT(BackgroundAction);
+
public:
static NonnullRefPtr<BackgroundAction<Result>> create(
Function<Result()> action,
- Function<void(Result)> on_complete = nullptr
- )
+ Function<void(Result)> on_complete = nullptr)
{
return adopt(*new BackgroundAction(move(action), move(on_complete)));
}
@@ -67,9 +67,8 @@ public:
virtual ~BackgroundAction() {}
private:
-
BackgroundAction(Function<Result()> action, Function<void(Result)> on_complete)
- : CObject(&background_thread())
+ : Core::Object(&background_thread())
, m_action(move(action))
, m_on_complete(move(on_complete))
{
@@ -79,11 +78,11 @@ private:
all_actions().resource().enqueue([this] {
m_result = m_action();
if (m_on_complete) {
- CEventLoop::main().post_event(*this, make<CDeferredInvocationEvent>([this](CObject&) {
+ Core::EventLoop::main().post_event(*this, make<Core::DeferredInvocationEvent>([this](auto&) {
m_on_complete(m_result.release_value());
this->unref();
}));
- CEventLoop::main().wake();
+ Core::EventLoop::main().wake();
} else
this->unref();
});
diff --git a/Libraries/LibThread/Thread.cpp b/Libraries/LibThread/Thread.cpp
index 26ee7a4d6a..2e1475ff25 100644
--- a/Libraries/LibThread/Thread.cpp
+++ b/Libraries/LibThread/Thread.cpp
@@ -29,7 +29,7 @@
#include <unistd.h>
LibThread::Thread::Thread(Function<int()> action, StringView thread_name)
- : CObject(nullptr)
+ : Core::Object(nullptr)
, m_action(move(action))
, m_thread_name(thread_name.is_null() ? "" : thread_name)
{
diff --git a/Libraries/LibThread/Thread.h b/Libraries/LibThread/Thread.h
index 12db8bda84..474a17fa42 100644
--- a/Libraries/LibThread/Thread.h
+++ b/Libraries/LibThread/Thread.h
@@ -32,7 +32,7 @@
namespace LibThread {
-class Thread final : public CObject {
+class Thread final : public Core::Object {
C_OBJECT(Thread);
public:
diff --git a/Libraries/LibVT/TerminalWidget.cpp b/Libraries/LibVT/TerminalWidget.cpp
index 50e9f2ec13..933c8be176 100644
--- a/Libraries/LibVT/TerminalWidget.cpp
+++ b/Libraries/LibVT/TerminalWidget.cpp
@@ -54,7 +54,7 @@ void TerminalWidget::set_pty_master_fd(int fd)
m_notifier = nullptr;
return;
}
- m_notifier = CNotifier::construct(m_ptm_fd, CNotifier::Read);
+ m_notifier = Core::Notifier::construct(m_ptm_fd, Core::Notifier::Read);
m_notifier->on_ready_to_read = [this] {
u8 buffer[BUFSIZ];
ssize_t nread = read(m_ptm_fd, buffer, sizeof(buffer));
@@ -81,14 +81,14 @@ void TerminalWidget::set_pty_master_fd(int fd)
};
}
-TerminalWidget::TerminalWidget(int ptm_fd, bool automatic_size_policy, RefPtr<CConfigFile> config)
+TerminalWidget::TerminalWidget(int ptm_fd, bool automatic_size_policy, RefPtr<Core::ConfigFile> config)
: m_terminal(*this)
, m_automatic_size_policy(automatic_size_policy)
, m_config(move(config))
{
set_pty_master_fd(ptm_fd);
- m_cursor_blink_timer = CTimer::construct();
- m_visual_beep_timer = CTimer::construct();
+ m_cursor_blink_timer = Core::Timer::construct();
+ m_visual_beep_timer = Core::Timer::construct();
set_frame_shape(FrameShape::Container);
set_frame_shadow(FrameShadow::Sunken);
@@ -165,19 +165,19 @@ void TerminalWidget::set_logical_focus(bool focus)
update();
}
-void TerminalWidget::focusin_event(CEvent& event)
+void TerminalWidget::focusin_event(Core::Event& event)
{
set_logical_focus(true);
return GFrame::focusin_event(event);
}
-void TerminalWidget::focusout_event(CEvent& event)
+void TerminalWidget::focusout_event(Core::Event& event)
{
set_logical_focus(false);
return GFrame::focusout_event(event);
}
-void TerminalWidget::event(CEvent& event)
+void TerminalWidget::event(Core::Event& event)
{
if (event.type() == GEvent::WindowBecameActive)
set_logical_focus(true);
diff --git a/Libraries/LibVT/TerminalWidget.h b/Libraries/LibVT/TerminalWidget.h
index fcd4adeedb..abae678816 100644
--- a/Libraries/LibVT/TerminalWidget.h
+++ b/Libraries/LibVT/TerminalWidget.h
@@ -41,7 +41,7 @@ class TerminalWidget final : public GFrame
, public VT::TerminalClient {
C_OBJECT(TerminalWidget)
public:
- TerminalWidget(int ptm_fd, bool automatic_size_policy, RefPtr<CConfigFile> config);
+ TerminalWidget(int ptm_fd, bool automatic_size_policy, RefPtr<Core::ConfigFile> config);
virtual ~TerminalWidget() override;
void set_pty_master_fd(int fd);
@@ -65,7 +65,7 @@ public:
bool should_beep() { return m_should_beep; }
void set_should_beep(bool sb) { m_should_beep = sb; };
- RefPtr<CConfigFile> config() const { return m_config; }
+ RefPtr<Core::ConfigFile> config() const { return m_config; }
bool has_selection() const;
bool selection_contains(const VT::Position&) const;
@@ -89,7 +89,7 @@ public:
private:
// ^GWidget
- virtual void event(CEvent&) override;
+ virtual void event(Core::Event&) override;
virtual void paint_event(GPaintEvent&) override;
virtual void resize_event(GResizeEvent&) override;
virtual void keydown_event(GKeyEvent&) override;
@@ -97,8 +97,8 @@ private:
virtual void mousemove_event(GMouseEvent&) override;
virtual void mousewheel_event(GMouseEvent&) override;
virtual void doubleclick_event(GMouseEvent&) override;
- 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 context_menu_event(GContextMenuEvent&) override;
virtual void drop_event(GDropEvent&) override;
virtual void did_change_font() override;
@@ -143,7 +143,7 @@ private:
bool m_has_logical_focus { false };
- RefPtr<CNotifier> m_notifier;
+ RefPtr<Core::Notifier> m_notifier;
u8 m_opacity { 255 };
bool m_needs_background_fill { true };
@@ -154,9 +154,9 @@ private:
int m_glyph_width { 0 };
- RefPtr<CTimer> m_cursor_blink_timer;
- RefPtr<CTimer> m_visual_beep_timer;
- RefPtr<CConfigFile> m_config;
+ RefPtr<Core::Timer> m_cursor_blink_timer;
+ RefPtr<Core::Timer> m_visual_beep_timer;
+ RefPtr<Core::ConfigFile> m_config;
RefPtr<GScrollBar> m_scrollbar;
@@ -165,5 +165,5 @@ private:
RefPtr<GMenu> m_context_menu;
- CElapsedTimer m_triple_click_timer;
+ Core::ElapsedTimer m_triple_click_timer;
};
diff --git a/MenuApplets/CPUGraph/main.cpp b/MenuApplets/CPUGraph/main.cpp
index 4d1ed71b7d..1ce99a1d37 100644
--- a/MenuApplets/CPUGraph/main.cpp
+++ b/MenuApplets/CPUGraph/main.cpp
@@ -45,7 +45,7 @@ public:
virtual ~GraphWidget() override {}
private:
- virtual void timer_event(CTimerEvent&) override
+ virtual void timer_event(Core::TimerEvent&) override
{
unsigned busy;
unsigned idle;
@@ -93,7 +93,7 @@ private:
busy = 0;
idle = 0;
- auto all_processes = CProcessStatisticsReader::get_all();
+ auto all_processes = Core::ProcessStatisticsReader::get_all();
for (auto& it : all_processes) {
for (auto& jt : it.value.threads) {
@@ -137,7 +137,7 @@ int main(int argc, char** argv)
return 1;
}
- // FIXME: This is required by CProcessStatisticsReader.
+ // FIXME: This is required by Core::ProcessStatisticsReader.
// It would be good if we didn't depend on that.
if (unveil("/etc/passwd", "r") < 0) {
perror("unveil");
diff --git a/MenuApplets/Clock/main.cpp b/MenuApplets/Clock/main.cpp
index 200f230cb7..1167a529f4 100644
--- a/MenuApplets/Clock/main.cpp
+++ b/MenuApplets/Clock/main.cpp
@@ -41,7 +41,7 @@ public:
{
m_time_width = Font::default_bold_font().width("2222-22-22 22:22:22");
- m_timer = CTimer::construct(1000, [this] {
+ m_timer = Core::Timer::construct(1000, [this] {
static time_t last_update_time;
time_t now = time(nullptr);
if (now != last_update_time) {
@@ -84,7 +84,7 @@ private:
update();
}
- RefPtr<CTimer> m_timer;
+ RefPtr<Core::Timer> m_timer;
int m_time_width;
};
diff --git a/Meta/Lagom/SimpleIPCClient.cpp b/Meta/Lagom/SimpleIPCClient.cpp
index e12d6493f4..8993cee63f 100644
--- a/Meta/Lagom/SimpleIPCClient.cpp
+++ b/Meta/Lagom/SimpleIPCClient.cpp
@@ -47,7 +47,7 @@ public:
int main(int, char**)
{
- CEventLoop event_loop;
+ Core::EventLoop event_loop;
SimpleIPCClient client;
diff --git a/Meta/Lagom/SimpleIPCServer.cpp b/Meta/Lagom/SimpleIPCServer.cpp
index 607a9d8f1d..c200f99a69 100644
--- a/Meta/Lagom/SimpleIPCServer.cpp
+++ b/Meta/Lagom/SimpleIPCServer.cpp
@@ -37,7 +37,7 @@ class SimpleIPCServer final :
C_OBJECT(SimpleIPCServer)
public:
- SimpleIPCServer(CLocalSocket& socket, int client_id)
+ SimpleIPCServer(Core::LocalSocket& socket, int client_id)
: ConnectionNG(*this, socket, client_id)
{
}
@@ -50,10 +50,10 @@ public:
int main(int, char**)
{
- CEventLoop event_loop;
+ Core::EventLoop event_loop;
unlink("/tmp/simple-ipc");
- auto server = CLocalServer::construct();
+ auto server = Core::LocalServer::construct();
server->listen("/tmp/simple-ipc");
server->on_ready_to_accept = [&] {
auto client_socket = server->accept();
diff --git a/Meta/Lagom/TestApp.cpp b/Meta/Lagom/TestApp.cpp
index 43c9edb13e..82b06450c4 100644
--- a/Meta/Lagom/TestApp.cpp
+++ b/Meta/Lagom/TestApp.cpp
@@ -30,9 +30,9 @@
int main(int, char**)
{
- CEventLoop event_loop;
+ Core::EventLoop event_loop;
- auto timer = CTimer::construct(100, [&] {
+ auto timer = Core::Timer::construct(100, [&] {
dbg() << "Timer fired, good-bye! :^)";
event_loop.quit(0);
});
diff --git a/Servers/AudioServer/ASClientConnection.cpp b/Servers/AudioServer/ASClientConnection.cpp
index bff8ca5f03..cdcfe1c088 100644
--- a/Servers/AudioServer/ASClientConnection.cpp
+++ b/Servers/AudioServer/ASClientConnection.cpp
@@ -48,7 +48,7 @@ void ASClientConnection::for_each(Function<void(ASClientConnection&)> callback)
callback(connection);
}
-ASClientConnection::ASClientConnection(CLocalSocket& client_socket, int client_id, ASMixer& mixer)
+ASClientConnection::ASClientConnection(Core::LocalSocket& client_socket, int client_id, ASMixer& mixer)
: IClientConnection(*this, client_socket, client_id)
, m_mixer(mixer)
{
diff --git a/Servers/AudioServer/ASClientConnection.h b/Servers/AudioServer/ASClientConnection.h
index 29873ef152..29f8d695cc 100644
--- a/Servers/AudioServer/ASClientConnection.h
+++ b/Servers/AudioServer/ASClientConnection.h
@@ -37,7 +37,7 @@ class ASClientConnection final : public IClientConnection<AudioServerEndpoint>
, public AudioServerEndpoint {
C_OBJECT(ASClientConnection)
public:
- explicit ASClientConnection(CLocalSocket&, int client_id, ASMixer& mixer);
+ explicit ASClientConnection(Core::LocalSocket&, int client_id, ASMixer& mixer);
~ASClientConnection() override;
void did_finish_playing_buffer(Badge<ASBufferQueue>, int buffer_id);
diff --git a/Servers/AudioServer/ASEventLoop.cpp b/Servers/AudioServer/ASEventLoop.cpp
index 607c19915b..62e70a675c 100644
--- a/Servers/AudioServer/ASEventLoop.cpp
+++ b/Servers/AudioServer/ASEventLoop.cpp
@@ -31,7 +31,7 @@
#include <unistd.h>
ASEventLoop::ASEventLoop()
- : m_server(CLocalServer::construct())
+ : m_server(Core::LocalServer::construct())
{
bool ok = m_server->take_over_from_system_server();
ASSERT(ok);
diff --git a/Servers/AudioServer/ASEventLoop.h b/Servers/AudioServer/ASEventLoop.h
index e377bbaf16..03fe9a4d8c 100644
--- a/Servers/AudioServer/ASEventLoop.h
+++ b/Servers/AudioServer/ASEventLoop.h
@@ -37,7 +37,7 @@ public:
int exec() { return m_event_loop.exec(); }
private:
- CEventLoop m_event_loop;
- RefPtr<CLocalServer> m_server;
+ Core::EventLoop m_event_loop;
+ RefPtr<Core::LocalServer> m_server;
ASMixer m_mixer;
};
diff --git a/Servers/AudioServer/ASMixer.cpp b/Servers/AudioServer/ASMixer.cpp
index 134c95f83b..2b0fff83bb 100644
--- a/Servers/AudioServer/ASMixer.cpp
+++ b/Servers/AudioServer/ASMixer.cpp
@@ -31,7 +31,7 @@
#include <pthread.h>
ASMixer::ASMixer()
- : m_device(CFile::construct("/dev/audio", this))
+ : m_device(Core::File::construct("/dev/audio", this))
, m_sound_thread(
[this] {
mix();
@@ -39,7 +39,7 @@ ASMixer::ASMixer()
},
"AudioServer[mixer]")
{
- if (!m_device->open(CIODevice::WriteOnly)) {
+ if (!m_device->open(Core::IODevice::WriteOnly)) {
dbgprintf("Can't open audio device: %s\n", m_device->error_string());
return;
}
diff --git a/Servers/AudioServer/ASMixer.h b/Servers/AudioServer/ASMixer.h
index d4dfe4b82e..5fd0ef0441 100644
--- a/Servers/AudioServer/ASMixer.h
+++ b/Servers/AudioServer/ASMixer.h
@@ -106,7 +106,7 @@ private:
WeakPtr<ASClientConnection> m_client;
};
-class ASMixer : public CObject {
+class ASMixer : public Core::Object {
C_OBJECT(ASMixer)
public:
ASMixer();
@@ -125,7 +125,7 @@ private:
pthread_mutex_t m_pending_mutex;
pthread_cond_t m_pending_cond;
- RefPtr<CFile> m_device;
+ RefPtr<Core::File> m_device;
LibThread::Thread m_sound_thread;
diff --git a/Servers/LookupServer/LookupServer.cpp b/Servers/LookupServer/LookupServer.cpp
index a33bb4fce8..530c6d0c17 100644
--- a/Servers/LookupServer/LookupServer.cpp
+++ b/Servers/LookupServer/LookupServer.cpp
@@ -41,19 +41,19 @@
LookupServer::LookupServer()
{
- auto config = CConfigFile::get_for_system("LookupServer");
+ auto config = Core::ConfigFile::get_for_system("LookupServer");
dbg() << "Using network config file at " << config->file_name();
m_nameserver = config->read_entry("DNS", "Nameserver", "1.1.1.1");
load_etc_hosts();
- m_local_server = CLocalServer::construct(this);
+ m_local_server = Core::LocalServer::construct(this);
m_local_server->on_ready_to_accept = [this]() {
auto socket = m_local_server->accept();
socket->on_ready_to_read = [this, socket]() {
service_client(socket);
- RefPtr<CLocalSocket> keeper = socket;
- const_cast<CLocalSocket&>(*socket).on_ready_to_read = [] {};
+ RefPtr<Core::LocalSocket> keeper = socket;
+ const_cast<Core::LocalSocket&>(*socket).on_ready_to_read = [] {};
};
};
bool ok = m_local_server->take_over_from_system_server();
@@ -62,8 +62,8 @@ LookupServer::LookupServer()
void LookupServer::load_etc_hosts()
{
- auto file = CFile::construct("/etc/hosts");
- if (!file->open(CIODevice::ReadOnly))
+ auto file = Core::File::construct("/etc/hosts");
+ if (!file->open(Core::IODevice::ReadOnly))
return;
while (!file->eof()) {
auto line = file->read_line(1024);
@@ -96,7 +96,7 @@ void LookupServer::load_etc_hosts()
}
}
-void LookupServer::service_client(RefPtr<CLocalSocket> socket)
+void LookupServer::service_client(RefPtr<Core::LocalSocket> socket)
{
u8 client_buffer[1024];
int nrecv = socket->read(client_buffer, sizeof(client_buffer) - 1);
@@ -176,7 +176,7 @@ Vector<String> LookupServer::lookup(const String& hostname, bool& did_timeout, u
auto buffer = request.to_byte_buffer();
- auto udp_socket = CUdpSocket::construct();
+ auto udp_socket = Core::UdpSocket::construct();
udp_socket->set_blocking(true);
struct timeval timeout {
diff --git a/Servers/LookupServer/LookupServer.h b/Servers/LookupServer/LookupServer.h
index c36f60a044..9f9a221707 100644
--- a/Servers/LookupServer/LookupServer.h
+++ b/Servers/LookupServer/LookupServer.h
@@ -31,11 +31,14 @@
#include <AK/HashMap.h>
#include <LibCore/CObject.h>
-class CLocalSocket;
-class CLocalServer;
+namespace Core {
+class LocalSocket;
+class LocalServer;
+}
+
class DNSAnswer;
-class LookupServer final : public CObject {
+class LookupServer final : public Core::Object {
C_OBJECT(LookupServer)
public:
@@ -43,7 +46,7 @@ public:
private:
void load_etc_hosts();
- void service_client(RefPtr<CLocalSocket>);
+ void service_client(RefPtr<Core::LocalSocket>);
Vector<String> lookup(const String& hostname, bool& did_timeout, unsigned short record_type, ShouldRandomizeCase = ShouldRandomizeCase::Yes);
struct CachedLookup {
@@ -51,7 +54,7 @@ private:
Vector<DNSAnswer> answers;
};
- RefPtr<CLocalServer> m_local_server;
+ RefPtr<Core::LocalServer> m_local_server;
String m_nameserver;
HashMap<String, String> m_etc_hosts;
HashMap<String, CachedLookup> m_lookup_cache;
diff --git a/Servers/LookupServer/main.cpp b/Servers/LookupServer/main.cpp
index b9b967d650..f921f5d668 100644
--- a/Servers/LookupServer/main.cpp
+++ b/Servers/LookupServer/main.cpp
@@ -38,7 +38,7 @@ int main(int argc, char** argv)
return 1;
}
- CEventLoop event_loop;
+ Core::EventLoop event_loop;
LookupServer server;
if (pledge("stdio accept inet", nullptr) < 0) {
diff --git a/Servers/ProtocolServer/HttpDownload.cpp b/Servers/ProtocolServer/HttpDownload.cpp
index fc5b986c56..57dff970e7 100644
--- a/Servers/ProtocolServer/HttpDownload.cpp
+++ b/Servers/ProtocolServer/HttpDownload.cpp
@@ -28,7 +28,7 @@
#include <LibCore/CHttpResponse.h>
#include <ProtocolServer/HttpDownload.h>
-HttpDownload::HttpDownload(PSClientConnection& client, NonnullRefPtr<CHttpJob>&& job)
+HttpDownload::HttpDownload(PSClientConnection& client, NonnullRefPtr<Core::HttpJob>&& job)
: Download(client)
, m_job(job)
{
@@ -43,7 +43,7 @@ HttpDownload::~HttpDownload()
{
}
-NonnullRefPtr<HttpDownload> HttpDownload::create_with_job(Badge<HttpProtocol>, PSClientConnection& client, NonnullRefPtr<CHttpJob>&& job)
+NonnullRefPtr<HttpDownload> HttpDownload::create_with_job(Badge<HttpProtocol>, PSClientConnection& client, NonnullRefPtr<Core::HttpJob>&& job)
{
return adopt(*new HttpDownload(client, move(job)));
}
diff --git a/Servers/ProtocolServer/HttpDownload.h b/Servers/ProtocolServer/HttpDownload.h
index 6d1d914d8f..246f18e26f 100644
--- a/Servers/ProtocolServer/HttpDownload.h
+++ b/Servers/ProtocolServer/HttpDownload.h
@@ -29,16 +29,19 @@
#include <AK/Badge.h>
#include <ProtocolServer/Download.h>
-class CHttpJob;
+namespace Core {
+class CoreHttpJob;
+}
+
class HttpProtocol;
class HttpDownload final : public Download {
public:
virtual ~HttpDownload() override;
- static NonnullRefPtr<HttpDownload> create_with_job(Badge<HttpProtocol>, PSClientConnection&, NonnullRefPtr<CHttpJob>&&);
+ static NonnullRefPtr<HttpDownload> create_with_job(Badge<HttpProtocol>, PSClientConnection&, NonnullRefPtr<Core::HttpJob>&&);
private:
- explicit HttpDownload(PSClientConnection&, NonnullRefPtr<CHttpJob>&&);
+ explicit HttpDownload(PSClientConnection&, NonnullRefPtr<Core::HttpJob>&&);
- NonnullRefPtr<CHttpJob> m_job;
+ NonnullRefPtr<Core::HttpJob> m_job;
};
diff --git a/Servers/ProtocolServer/HttpProtocol.cpp b/Servers/ProtocolServer/HttpProtocol.cpp
index 352d203459..a5b3df70ad 100644
--- a/Servers/ProtocolServer/HttpProtocol.cpp
+++ b/Servers/ProtocolServer/HttpProtocol.cpp
@@ -40,11 +40,11 @@ HttpProtocol::~HttpProtocol()
RefPtr<Download> HttpProtocol::start_download(PSClientConnection& client, const URL& url)
{
- CHttpRequest request;
- request.set_method(CHttpRequest::Method::GET);
+ Core::HttpRequest request;
+ request.set_method(Core::HttpRequest::Method::GET);
request.set_url(url);
auto job = request.schedule();
if (!job)
return nullptr;
- return HttpDownload::create_with_job({}, client, (CHttpJob&)*job);
+ return HttpDownload::create_with_job({}, client, (Core::HttpJob&)*job);
}
diff --git a/Servers/ProtocolServer/PSClientConnection.cpp b/Servers/ProtocolServer/PSClientConnection.cpp
index 4e55653b52..29a3679fee 100644
--- a/Servers/ProtocolServer/PSClientConnection.cpp
+++ b/Servers/ProtocolServer/PSClientConnection.cpp
@@ -32,7 +32,7 @@
static HashMap<int, RefPtr<PSClientConnection>> s_connections;
-PSClientConnection::PSClientConnection(CLocalSocket& socket, int client_id)
+PSClientConnection::PSClientConnection(Core::LocalSocket& socket, int client_id)
: IClientConnection(*this, socket, client_id)
{
s_connections.set(client_id, *this);
diff --git a/Servers/ProtocolServer/PSClientConnection.h b/Servers/ProtocolServer/PSClientConnection.h
index 18d8c9ac86..81bc4f32d8 100644
--- a/Servers/ProtocolServer/PSClientConnection.h
+++ b/Servers/ProtocolServer/PSClientConnection.h
@@ -40,7 +40,7 @@ class PSClientConnection final : public IClientConnection<ProtocolServerEndpoint
, public ProtocolServerEndpoint {
C_OBJECT(PSClientConnection)
public:
- explicit PSClientConnection(CLocalSocket&, int client_id);
+ explicit PSClientConnection(Core::LocalSocket&, int client_id);
~PSClientConnection() override;
virtual void die() override;
diff --git a/Servers/ProtocolServer/main.cpp b/Servers/ProtocolServer/main.cpp
index acf947ad3f..dd56305145 100644
--- a/Servers/ProtocolServer/main.cpp
+++ b/Servers/ProtocolServer/main.cpp
@@ -36,14 +36,14 @@ int main(int, char**)
perror("pledge");
return 1;
}
- CEventLoop event_loop;
+ Core::EventLoop event_loop;
// FIXME: Establish a connection to LookupServer and then drop "unix"?
if (pledge("stdio inet shared_buffer accept unix", nullptr) < 0) {
perror("pledge");
return 1;
}
(void)*new HttpProtocol;
- auto server = CLocalServer::construct();
+ auto server = Core::LocalServer::construct();
bool ok = server->take_over_from_system_server();
ASSERT(ok);
server->on_ready_to_accept = [&] {
diff --git a/Servers/SystemServer/Service.cpp b/Servers/SystemServer/Service.cpp
index cbe1500f4c..1af41157bb 100644
--- a/Servers/SystemServer/Service.cpp
+++ b/Servers/SystemServer/Service.cpp
@@ -135,7 +135,7 @@ void Service::setup_socket()
ASSERT_NOT_REACHED();
}
- auto socket_address = CSocketAddress::local(m_socket_path);
+ auto socket_address = Core::SocketAddress::local(m_socket_path);
auto un = socket_address.to_sockaddr_un();
int rc = bind(m_socket_fd, (const sockaddr*)&un, sizeof(un));
if (rc < 0) {
@@ -156,7 +156,7 @@ void Service::setup_notifier()
ASSERT(m_socket_fd >= 0);
ASSERT(!m_socket_notifier);
- m_socket_notifier = CNotifier::construct(m_socket_fd, CNotifier::Event::Read, this);
+ m_socket_notifier = Core::Notifier::construct(m_socket_fd, Core::Notifier::Event::Read, this);
m_socket_notifier->on_ready_to_read = [this] {
dbg() << "Ready to read on behalf of " << name();
remove_child(*m_socket_notifier);
@@ -267,8 +267,8 @@ void Service::did_exit(int exit_code)
activate();
}
-Service::Service(const CConfigFile& config, const StringView& name)
- : CObject(nullptr)
+Service::Service(const Core::ConfigFile& config, const StringView& name)
+ : Core::Object(nullptr)
{
ASSERT(config.has_group(name));
@@ -304,7 +304,7 @@ Service::Service(const CConfigFile& config, const StringView& name)
void Service::save_to(JsonObject& json)
{
- CObject::save_to(json);
+ Core::Object::save_to(json);
json.set("executable_path", m_executable_path);
diff --git a/Servers/SystemServer/Service.h b/Servers/SystemServer/Service.h
index a5cad72d75..ebf06582d4 100644
--- a/Servers/SystemServer/Service.h
+++ b/Servers/SystemServer/Service.h
@@ -31,13 +31,14 @@
#include <LibCore/CNotifier.h>
#include <LibCore/CObject.h>
-class CConfigFile;
-
namespace AK {
class JsonObject;
}
+namespace Core {
+class ConfigFile;
+}
-class Service final : public CObject {
+class Service final : public Core::Object {
C_OBJECT(Service)
public:
@@ -49,7 +50,7 @@ public:
void save_to(AK::JsonObject&) override;
private:
- Service(const CConfigFile&, const StringView& name);
+ Service(const Core::ConfigFile&, const StringView& name);
void spawn();
@@ -78,7 +79,7 @@ private:
pid_t m_pid { -1 };
// An open fd to the socket.
int m_socket_fd { -1 };
- RefPtr<CNotifier> m_socket_notifier;
+ RefPtr<Core::Notifier> m_socket_notifier;
void resolve_user();
void setup_socket();
diff --git a/Servers/SystemServer/main.cpp b/Servers/SystemServer/main.cpp
index ee2fe3fb4e..629925834f 100644
--- a/Servers/SystemServer/main.cpp
+++ b/Servers/SystemServer/main.cpp
@@ -54,16 +54,16 @@ static void sigchld_handler(int)
// We wouldn't want to run the complex logic, such
// as possibly spawning the service again, from the
// signal handler, so defer it.
- CEventLoop::main().post_event(*service, make<CDeferredInvocationEvent>([=](CObject&) {
+ Core::EventLoop::main().post_event(*service, make<Core::DeferredInvocationEvent>([=](auto&) {
service->did_exit(status);
}));
- CEventLoop::wake();
+ Core::EventLoop::wake();
}
static void check_for_test_mode()
{
- auto f = CFile::construct("/proc/cmdline");
- if (!f->open(CIODevice::ReadOnly)) {
+ auto f = Core::File::construct("/proc/cmdline");
+ if (!f->open(Core::IODevice::ReadOnly)) {
dbg() << "Failed to read command line: " << f->error_string();
ASSERT(false);
}
@@ -117,12 +117,12 @@ int main(int, char**)
};
sigaction(SIGCHLD, &sa, nullptr);
- CEventLoop event_loop;
+ Core::EventLoop event_loop;
// Read our config and instantiate services.
// This takes care of setting up sockets.
Vector<RefPtr<Service>> services;
- auto config = CConfigFile::get_for_system("SystemServer");
+ auto config = Core::ConfigFile::get_for_system("SystemServer");
for (auto name : config->groups())
services.append(Service::construct(*config, name));
diff --git a/Servers/TelnetServer/Client.cpp b/Servers/TelnetServer/Client.cpp
index 427bef4409..a13ab7c42c 100644
--- a/Servers/TelnetServer/Client.cpp
+++ b/Servers/TelnetServer/Client.cpp
@@ -36,11 +36,11 @@
#include <stdio.h>
#include <unistd.h>
-Client::Client(int id, RefPtr<CTCPSocket> socket, int ptm_fd)
+Client::Client(int id, RefPtr<Core::TCPSocket> socket, int ptm_fd)
: m_id(id)
, m_socket(move(socket))
, m_ptm_fd(ptm_fd)
- , m_ptm_notifier(CNotifier::construct(ptm_fd, CNotifier::Read))
+ , m_ptm_notifier(Core::Notifier::construct(ptm_fd, Core::Notifier::Read))
{
m_socket->on_ready_to_read = [this] { drain_socket(); };
m_ptm_notifier->on_ready_to_read = [this] { drain_pty(); };
diff --git a/Servers/TelnetServer/Client.h b/Servers/TelnetServer/Client.h
index 3e3feb82dc..06efeb4528 100644
--- a/Servers/TelnetServer/Client.h
+++ b/Servers/TelnetServer/Client.h
@@ -37,7 +37,7 @@
class Client : public RefCounted<Client> {
public:
- static NonnullRefPtr<Client> create(int id, RefPtr<CTCPSocket> socket, int ptm_fd)
+ static NonnullRefPtr<Client> create(int id, RefPtr<Core::TCPSocket> socket, int ptm_fd)
{
return adopt(*new Client(id, move(socket), ptm_fd));
}
@@ -45,7 +45,7 @@ public:
Function<void()> on_exit;
protected:
- Client(int id, RefPtr<CTCPSocket> socket, int ptm_fd);
+ Client(int id, RefPtr<Core::TCPSocket> socket, int ptm_fd);
void drain_socket();
void drain_pty();
@@ -61,9 +61,9 @@ private:
// client id
int m_id { 0 };
// client resources
- RefPtr<CTCPSocket> m_socket;
+ RefPtr<Core::TCPSocket> m_socket;
Parser m_parser;
// pty resources
int m_ptm_fd { -1 };
- RefPtr<CNotifier> m_ptm_notifier;
+ RefPtr<Core::Notifier> m_ptm_notifier;
};
diff --git a/Servers/TelnetServer/main.cpp b/Servers/TelnetServer/main.cpp
index 84c941a994..fbfddbae7d 100644
--- a/Servers/TelnetServer/main.cpp
+++ b/Servers/TelnetServer/main.cpp
@@ -106,8 +106,8 @@ static void run_command(int ptm_fd, String command)
int main(int argc, char** argv)
{
- CEventLoop event_loop;
- auto server = CTCPServer::construct();
+ Core::EventLoop event_loop;
+ auto server = Core::TCPServer::construct();
int opt;
u16 port = 23;
diff --git a/Servers/WindowServer/WSClientConnection.cpp b/Servers/WindowServer/WSClientConnection.cpp
index 393a5de426..7185d3ab9e 100644
--- a/Servers/WindowServer/WSClientConnection.cpp
+++ b/Servers/WindowServer/WSClientConnection.cpp
@@ -65,7 +65,7 @@ WSClientConnection* WSClientConnection::from_client_id(int client_id)
return (*it).value.ptr();
}
-WSClientConnection::WSClientConnection(CLocalSocket& client_socket, int client_id)
+WSClientConnection::WSClientConnection(Core::LocalSocket& client_socket, int client_id)
: IClientConnection(*this, client_socket, client_id)
{
if (!s_connections)
diff --git a/Servers/WindowServer/WSClientConnection.h b/Servers/WindowServer/WSClientConnection.h
index ddcd3b04c9..3f871760fc 100644
--- a/Servers/WindowServer/WSClientConnection.h
+++ b/Servers/WindowServer/WSClientConnection.h
@@ -71,7 +71,7 @@ public:
}
private:
- explicit WSClientConnection(CLocalSocket&, int client_id);
+ explicit WSClientConnection(Core::LocalSocket&, int client_id);
virtual OwnPtr<WindowServer::GreetResponse> handle(const WindowServer::Greet&) override;
virtual OwnPtr<WindowServer::CreateMenubarResponse> handle(const WindowServer::CreateMenubar&) override;
diff --git a/Servers/WindowServer/WSCompositor.cpp b/Servers/WindowServer/WSCompositor.cpp
index 2541a2fdc2..823759d133 100644
--- a/Servers/WindowServer/WSCompositor.cpp
+++ b/Servers/WindowServer/WSCompositor.cpp
@@ -58,8 +58,8 @@ WallpaperMode mode_to_enum(const String& name)
WSCompositor::WSCompositor()
{
- m_compose_timer = CTimer::construct(this);
- m_immediate_compose_timer = CTimer::construct(this);
+ m_compose_timer = Core::Timer::construct(this);
+ m_immediate_compose_timer = Core::Timer::construct(this);
m_screen_can_set_buffer = WSScreen::the().can_set_buffer();
diff --git a/Servers/WindowServer/WSCompositor.h b/Servers/WindowServer/WSCompositor.h
index 0f81dfb0fe..c643bf8e0d 100644
--- a/Servers/WindowServer/WSCompositor.h
+++ b/Servers/WindowServer/WSCompositor.h
@@ -44,7 +44,7 @@ enum class WallpaperMode {
Unchecked
};
-class WSCompositor final : public CObject {
+class WSCompositor final : public Core::Object {
C_OBJECT(WSCompositor)
public:
static WSCompositor& the();
@@ -73,8 +73,8 @@ private:
unsigned m_compose_count { 0 };
unsigned m_flush_count { 0 };
- RefPtr<CTimer> m_compose_timer;
- RefPtr<CTimer> m_immediate_compose_timer;
+ RefPtr<Core::Timer> m_compose_timer;
+ RefPtr<Core::Timer> m_immediate_compose_timer;
bool m_flash_flush { false };
bool m_buffers_are_flipped { false };
bool m_screen_can_set_buffer { false };
diff --git a/Servers/WindowServer/WSEvent.h b/Servers/WindowServer/WSEvent.h
index c3468abbe0..5a8020b24c 100644
--- a/Servers/WindowServer/WSEvent.h
+++ b/Servers/WindowServer/WSEvent.h
@@ -33,7 +33,7 @@
#include <WindowServer/WSCursor.h>
#include <WindowServer/WSWindowType.h>
-class WSEvent : public CEvent {
+class WSEvent : public Core::Event {
public:
enum Type {
Invalid = 3000,
@@ -54,7 +54,7 @@ public:
WSEvent() {}
explicit WSEvent(Type type)
- : CEvent(type)
+ : Core::Event(type)
{
}
virtual ~WSEvent() {}
diff --git a/Servers/WindowServer/WSEventLoop.cpp b/Servers/WindowServer/WSEventLoop.cpp
index b6daaf2327..9e5fc7930a 100644
--- a/Servers/WindowServer/WSEventLoop.cpp
+++ b/Servers/WindowServer/WSEventLoop.cpp
@@ -47,7 +47,7 @@
//#define WSMESSAGELOOP_DEBUG
WSEventLoop::WSEventLoop()
- : m_server(CLocalServer::construct())
+ : m_server(Core::LocalServer::construct())
{
m_keyboard_fd = open("/dev/keyboard", O_RDONLY | O_NONBLOCK | O_CLOEXEC);
m_mouse_fd = open("/dev/psaux", O_RDONLY | O_NONBLOCK | O_CLOEXEC);
@@ -69,10 +69,10 @@ WSEventLoop::WSEventLoop()
ASSERT(m_keyboard_fd >= 0);
ASSERT(m_mouse_fd >= 0);
- m_keyboard_notifier = CNotifier::construct(m_keyboard_fd, CNotifier::Read);
+ m_keyboard_notifier = Core::Notifier::construct(m_keyboard_fd, Core::Notifier::Read);
m_keyboard_notifier->on_ready_to_read = [this] { drain_keyboard(); };
- m_mouse_notifier = CNotifier::construct(m_mouse_fd, CNotifier::Read);
+ m_mouse_notifier = Core::Notifier::construct(m_mouse_fd, Core::Notifier::Read);
m_mouse_notifier->on_ready_to_read = [this] { drain_mouse(); };
WSClipboard::the().on_content_change = [&] {
diff --git a/Servers/WindowServer/WSEventLoop.h b/Servers/WindowServer/WSEventLoop.h
index f81d19379e..77c1d2abe5 100644
--- a/Servers/WindowServer/WSEventLoop.h
+++ b/Servers/WindowServer/WSEventLoop.h
@@ -44,10 +44,10 @@ private:
void drain_mouse();
void drain_keyboard();
- CEventLoop m_event_loop;
+ Core::EventLoop m_event_loop;
int m_keyboard_fd { -1 };
- RefPtr<CNotifier> m_keyboard_notifier;
+ RefPtr<Core::Notifier> m_keyboard_notifier;
int m_mouse_fd { -1 };
- RefPtr<CNotifier> m_mouse_notifier;
- RefPtr<CLocalServer> m_server;
+ RefPtr<Core::Notifier> m_mouse_notifier;
+ RefPtr<Core::LocalServer> m_server;
};
diff --git a/Servers/WindowServer/WSMenu.cpp b/Servers/WindowServer/WSMenu.cpp
index f59d30bcee..9ba7dec97a 100644
--- a/Servers/WindowServer/WSMenu.cpp
+++ b/Servers/WindowServer/WSMenu.cpp
@@ -43,7 +43,7 @@
#include <WindowServer/WindowClientEndpoint.h>
WSMenu::WSMenu(WSClientConnection* client, int menu_id, const String& name)
- : CObject(client)
+ : Core::Object(client)
, m_client(client)
, m_menu_id(menu_id)
, m_name(move(name))
@@ -328,7 +328,7 @@ void WSMenu::handle_mouse_move_event(const WSMouseEvent& mouse_event)
return;
}
-void WSMenu::event(CEvent& event)
+void WSMenu::event(Core::Event& event)
{
if (event.type() == WSEvent::MouseMove) {
handle_mouse_move_event(static_cast<const WSMouseEvent&>(event));
@@ -446,7 +446,7 @@ void WSMenu::event(CEvent& event)
return;
}
}
- CObject::event(event);
+ Core::Object::event(event);
}
void WSMenu::clear_hovered_item()
diff --git a/Servers/WindowServer/WSMenu.h b/Servers/WindowServer/WSMenu.h
index e59eec5cbb..8fa9a65ac9 100644
--- a/Servers/WindowServer/WSMenu.h
+++ b/Servers/WindowServer/WSMenu.h
@@ -40,7 +40,7 @@ class WSMenuBar;
class WSEvent;
class Font;
-class WSMenu final : public CObject {
+class WSMenu final : public Core::Object {
C_OBJECT(WSMenu)
public:
WSMenu(WSClientConnection*, int menu_id, const String& name);
@@ -115,7 +115,7 @@ public:
int scroll_offset() const { return m_scroll_offset; }
private:
- virtual void event(CEvent&) override;
+ virtual void event(Core::Event&) override;
void handle_mouse_move_event(const WSMouseEvent&);
int visible_item_count() const;
diff --git a/Servers/WindowServer/WSMenuManager.cpp b/Servers/WindowServer/WSMenuManager.cpp
index 221487631f..10069f8876 100644
--- a/Servers/WindowServer/WSMenuManager.cpp
+++ b/Servers/WindowServer/WSMenuManager.cpp
@@ -53,11 +53,11 @@ WSMenuManager::WSMenuManager()
HashTable<String> seen_app_categories;
{
- CDirIterator dt("/res/apps", CDirIterator::SkipDots);
+ Core::DirIterator dt("/res/apps", Core::DirIterator::SkipDots);
while (dt.has_next()) {
auto af_name = dt.next_path();
auto af_path = String::format("/res/apps/%s", af_name.characters());
- auto af = CConfigFile::open(af_path);
+ auto af = Core::ConfigFile::open(af_path);
if (!af->has_key("App", "Name") || !af->has_key("App", "Executable"))
continue;
auto app_name = af->read_entry("App", "Name");
@@ -114,7 +114,7 @@ WSMenuManager::WSMenuManager()
m_system_menu->add_item(move(themes_menu_item));
{
- CDirIterator dt("/res/themes", CDirIterator::SkipDots);
+ Core::DirIterator dt("/res/themes", Core::DirIterator::SkipDots);
while (dt.has_next()) {
auto theme_name = dt.next_path();
auto theme_path = String::format("/res/themes/%s", theme_name.characters());
@@ -270,10 +270,10 @@ void WSMenuManager::refresh()
window().invalidate();
}
-void WSMenuManager::event(CEvent& event)
+void WSMenuManager::event(Core::Event& event)
{
if (WSWindowManager::the().active_window_is_modal())
- return CObject::event(event);
+ return Core::Object::event(event);
if (event.type() == WSEvent::MouseMove || event.type() == WSEvent::MouseUp || event.type() == WSEvent::MouseDown || event.type() == WSEvent::MouseWheel) {
@@ -313,7 +313,7 @@ void WSMenuManager::event(CEvent& event)
}
}
- return CObject::event(event);
+ return Core::Object::event(event);
}
void WSMenuManager::handle_menu_mouse_event(WSMenu& menu, const WSMouseEvent& event)
diff --git a/Servers/WindowServer/WSMenuManager.h b/Servers/WindowServer/WSMenuManager.h
index ea1a22fd53..e883254756 100644
--- a/Servers/WindowServer/WSMenuManager.h
+++ b/Servers/WindowServer/WSMenuManager.h
@@ -34,7 +34,7 @@
class AClientConnection;
-class WSMenuManager final : public CObject {
+class WSMenuManager final : public Core::Object {
C_OBJECT(WSMenuManager)
public:
static WSMenuManager& the();
@@ -44,7 +44,7 @@ public:
void refresh();
- virtual void event(CEvent&) override;
+ virtual void event(Core::Event&) override;
bool is_open(const WSMenu&) const;
diff --git a/Servers/WindowServer/WSScreen.cpp b/Servers/WindowServer/WSScreen.cpp
index d72ed020c7..6e9f9f6bea 100644
--- a/Servers/WindowServer/WSScreen.cpp
+++ b/Servers/WindowServer/WSScreen.cpp
@@ -113,19 +113,19 @@ void WSScreen::on_receive_mouse_data(int dx, int dy, int dz, unsigned buttons)
if (!(changed_buttons & (unsigned)button))
return;
auto message = make<WSMouseEvent>(buttons & (unsigned)button ? WSEvent::MouseDown : WSEvent::MouseUp, m_cursor_location, buttons, button, m_modifiers);
- CEventLoop::current().post_event(WSWindowManager::the(), move(message));
+ Core::EventLoop::current().post_event(WSWindowManager::the(), move(message));
};
post_mousedown_or_mouseup_if_needed(MouseButton::Left);
post_mousedown_or_mouseup_if_needed(MouseButton::Right);
post_mousedown_or_mouseup_if_needed(MouseButton::Middle);
if (m_cursor_location != prev_location) {
auto message = make<WSMouseEvent>(WSEvent::MouseMove, m_cursor_location, buttons, MouseButton::None, m_modifiers);
- CEventLoop::current().post_event(WSWindowManager::the(), move(message));
+ Core::EventLoop::current().post_event(WSWindowManager::the(), move(message));
}
if (dz) {
auto message = make<WSMouseEvent>(WSEvent::MouseWheel, m_cursor_location, buttons, MouseButton::None, m_modifiers, dz);
- CEventLoop::current().post_event(WSWindowManager::the(), move(message));
+ Core::EventLoop::current().post_event(WSWindowManager::the(), move(message));
}
if (m_cursor_location != prev_location)
@@ -136,5 +136,5 @@ void WSScreen::on_receive_keyboard_data(KeyEvent kernel_event)
{
m_modifiers = kernel_event.modifiers();
auto message = make<WSKeyEvent>(kernel_event.is_press() ? WSEvent::KeyDown : WSEvent::KeyUp, kernel_event.key, kernel_event.character, kernel_event.modifiers());
- CEventLoop::current().post_event(WSWindowManager::the(), move(message));
+ Core::EventLoop::current().post_event(WSWindowManager::the(), move(message));
}
diff --git a/Servers/WindowServer/WSWindow.cpp b/Servers/WindowServer/WSWindow.cpp
index d2befbcafc..095d690212 100644
--- a/Servers/WindowServer/WSWindow.cpp
+++ b/Servers/WindowServer/WSWindow.cpp
@@ -45,8 +45,8 @@ static GraphicsBitmap& default_window_icon()
return *s_icon;
}
-WSWindow::WSWindow(CObject& parent, WSWindowType type)
- : CObject(&parent)
+WSWindow::WSWindow(Core::Object& parent, WSWindowType type)
+ : Core::Object(&parent)
, m_type(type)
, m_icon(default_window_icon())
, m_frame(*this)
@@ -55,7 +55,7 @@ WSWindow::WSWindow(CObject& parent, WSWindowType type)
}
WSWindow::WSWindow(WSClientConnection& client, WSWindowType window_type, int window_id, bool modal, bool minimizable, bool resizable, bool fullscreen)
- : CObject(&client)
+ : Core::Object(&client)
, m_client(&client)
, m_type(window_type)
, m_modal(modal)
@@ -208,7 +208,7 @@ void WSWindow::set_maximized(bool maximized)
set_rect(m_unmaximized_rect);
}
m_frame.did_set_maximized({}, maximized);
- CEventLoop::current().post_event(*this, make<WSResizeEvent>(old_rect, m_rect));
+ Core::EventLoop::current().post_event(*this, make<WSResizeEvent>(old_rect, m_rect));
}
void WSWindow::set_resizable(bool resizable)
@@ -220,7 +220,7 @@ void WSWindow::set_resizable(bool resizable)
// TODO: Hide/show (or alternatively change enabled state of) window maximize button dynamically depending on value of is_resizable()
}
-void WSWindow::event(CEvent& event)
+void WSWindow::event(Core::Event& event)
{
if (!m_client) {
ASSERT(parent());
@@ -378,7 +378,7 @@ void WSWindow::set_fullscreen(bool fullscreen)
} else if (!m_saved_nonfullscreen_rect.is_empty()) {
new_window_rect = m_saved_nonfullscreen_rect;
}
- CEventLoop::current().post_event(*this, make<WSResizeEvent>(m_rect, new_window_rect));
+ Core::EventLoop::current().post_event(*this, make<WSResizeEvent>(m_rect, new_window_rect));
set_rect(new_window_rect);
}
@@ -409,5 +409,5 @@ void WSWindow::set_tiled(WindowTileType tiled)
WSWindowManager::the().maximized_window_rect(*this).height());
break;
}
- CEventLoop::current().post_event(*this, make<WSResizeEvent>(old_rect, m_rect));
+ Core::EventLoop::current().post_event(*this, make<WSResizeEvent>(old_rect, m_rect));
}
diff --git a/Servers/WindowServer/WSWindow.h b/Servers/WindowServer/WSWindow.h
index f77bd3ad30..f09ad9c603 100644
--- a/Servers/WindowServer/WSWindow.h
+++ b/Servers/WindowServer/WSWindow.h
@@ -58,12 +58,12 @@ enum class PopupMenuItem {
Maximize,
};
-class WSWindow final : public CObject
+class WSWindow final : public Core::Object
, public InlineLinkedListNode<WSWindow> {
C_OBJECT(WSWindow)
public:
WSWindow(WSClientConnection&, WSWindowType, int window_id, bool modal, bool minimizable, bool resizable, bool fullscreen);
- WSWindow(CObject&, WSWindowType);
+ WSWindow(Core::Object&, WSWindowType);
virtual ~WSWindow() override;
void popup_window_menu(const Point&);
@@ -164,7 +164,7 @@ public:
void invalidate();
void invalidate(const Rect&);
- virtual void event(CEvent&) override;
+ virtual void event(Core::Event&) override;
// Only used by WSWindowType::MenuApplet. Perhaps it could be a WSWindow subclass? I don't know.
void set_rect_in_menubar(const Rect& rect) { m_rect_in_menubar = rect; }
diff --git a/Servers/WindowServer/WSWindowManager.cpp b/Servers/WindowServer/WSWindowManager.cpp
index 2c1290a141..6fd37231a2 100644
--- a/Servers/WindowServer/WSWindowManager.cpp
+++ b/Servers/WindowServer/WSWindowManager.cpp
@@ -98,7 +98,7 @@ NonnullRefPtr<WSCursor> WSWindowManager::get_cursor(const String& name)
void WSWindowManager::reload_config(bool set_screen)
{
- m_wm_config = CConfigFile::get_for_app("WindowManager");
+ m_wm_config = Core::ConfigFile::get_for_app("WindowManager");
m_double_click_speed = m_wm_config->read_num_entry("Input", "DoubleClickSpeed", 250);
@@ -158,7 +158,7 @@ void WSWindowManager::add_window(WSWindow& window)
m_windows_in_order.append(&window);
if (window.is_fullscreen()) {
- CEventLoop::current().post_event(window, make<WSResizeEvent>(window.rect(), WSScreen::the().rect()));
+ Core::EventLoop::current().post_event(window, make<WSResizeEvent>(window.rect(), WSScreen::the().rect()));
window.set_rect(WSScreen::the().rect());
}
@@ -486,7 +486,7 @@ bool WSWindowManager::process_ongoing_window_resize(const WSMouseEvent& event, W
#ifdef RESIZE_DEBUG
dbg() << "[WM] Finish resizing WSWindow{" << m_resize_window << "}";
#endif
- CEventLoop::current().post_event(*m_resize_window, make<WSResizeEvent>(m_resize_window->rect(), m_resize_window->rect()));
+ Core::EventLoop::current().post_event(*m_resize_window, make<WSResizeEvent>(m_resize_window->rect(), m_resize_window->rect()));
invalidate(*m_resize_window);
if (m_resize_window->rect().contains(event.position()))
hovered_window = m_resize_window;
@@ -588,7 +588,7 @@ bool WSWindowManager::process_ongoing_window_resize(const WSMouseEvent& event, W
dbg() << "[WM] Resizing, original: " << m_resize_window_original_rect << ", now: " << new_rect;
#endif
m_resize_window->set_rect(new_rect);
- CEventLoop::current().post_event(*m_resize_window, make<WSResizeEvent>(old_rect, new_rect));
+ Core::EventLoop::current().post_event(*m_resize_window, make<WSResizeEvent>(old_rect, new_rect));
return true;
}
@@ -950,7 +950,7 @@ void WSWindowManager::draw_window_switcher()
m_switcher.draw();
}
-void WSWindowManager::event(CEvent& event)
+void WSWindowManager::event(Core::Event& event)
{
if (static_cast<WSEvent&>(event).is_mouse_event()) {
WSWindow* hovered_window = nullptr;
@@ -1040,7 +1040,7 @@ void WSWindowManager::event(CEvent& event)
}
}
- CObject::event(event);
+ Core::Object::event(event);
}
void WSWindowManager::set_highlight_window(WSWindow* window)
@@ -1072,7 +1072,7 @@ void WSWindowManager::set_active_window(WSWindow* window)
if (previously_active_window) {
previously_active_client = previously_active_window->client();
- CEventLoop::current().post_event(*previously_active_window, make<WSEvent>(WSEvent::WindowDeactivated));
+ Core::EventLoop::current().post_event(*previously_active_window, make<WSEvent>(WSEvent::WindowDeactivated));
invalidate(*previously_active_window);
m_active_window = nullptr;
tell_wm_listeners_window_state_changed(*previously_active_window);
@@ -1081,7 +1081,7 @@ void WSWindowManager::set_active_window(WSWindow* window)
if (window) {
m_active_window = window->make_weak_ptr();
active_client = m_active_window->client();
- CEventLoop::current().post_event(*m_active_window, make<WSEvent>(WSEvent::WindowActivated));
+ Core::EventLoop::current().post_event(*m_active_window, make<WSEvent>(WSEvent::WindowActivated));
invalidate(*m_active_window);
auto* client = window->client();
@@ -1106,12 +1106,12 @@ void WSWindowManager::set_hovered_window(WSWindow* window)
return;
if (m_hovered_window)
- CEventLoop::current().post_event(*m_hovered_window, make<WSEvent>(WSEvent::WindowLeft));
+ Core::EventLoop::current().post_event(*m_hovered_window, make<WSEvent>(WSEvent::WindowLeft));
m_hovered_window = window ? window->make_weak_ptr() : nullptr;
if (m_hovered_window)
- CEventLoop::current().post_event(*m_hovered_window, make<WSEvent>(WSEvent::WindowEntered));
+ Core::EventLoop::current().post_event(*m_hovered_window, make<WSEvent>(WSEvent::WindowEntered));
}
void WSWindowManager::invalidate()
@@ -1280,7 +1280,7 @@ void WSWindowManager::update_theme(String theme_path, String theme_name)
}
return IterationDecision::Continue;
});
- auto wm_config = CConfigFile::get_for_app("WindowManager");
+ auto wm_config = Core::ConfigFile::get_for_app("WindowManager");
wm_config->write_entry("Theme", "Name", theme_name);
wm_config->sync();
invalidate();
diff --git a/Servers/WindowServer/WSWindowManager.h b/Servers/WindowServer/WSWindowManager.h
index b8516c7af1..5eaa8476ce 100644
--- a/Servers/WindowServer/WSWindowManager.h
+++ b/Servers/WindowServer/WSWindowManager.h
@@ -66,7 +66,7 @@ enum class ResizeDirection {
DownLeft
};
-class WSWindowManager : public CObject {
+class WSWindowManager : public Core::Object {
C_OBJECT(WSWindowManager)
friend class WSCompositor;
@@ -81,7 +81,7 @@ public:
Palette palette() const { return Palette(*m_palette); }
- RefPtr<CConfigFile> wm_config() const
+ RefPtr<Core::ConfigFile> wm_config() const
{
return m_wm_config;
}
@@ -201,7 +201,7 @@ private:
template<typename Callback>
IterationDecision for_each_window_of_type_from_front_to_back(WSWindowType, Callback, bool ignore_highlight = false);
- virtual void event(CEvent&) override;
+ virtual void event(Core::Event&) override;
void paint_window_frame(const WSWindow&);
void tell_wm_listener_about_window(WSWindow& listener, WSWindow&);
void tell_wm_listener_about_window_icon(WSWindow& listener, WSWindow&);
@@ -239,7 +239,7 @@ private:
struct DoubleClickInfo {
struct ClickMetadata {
- CElapsedTimer clock;
+ Core::ElapsedTimer clock;
Point last_position;
};
@@ -290,7 +290,7 @@ private:
NonnullRefPtr<PaletteImpl> m_palette;
- RefPtr<CConfigFile> m_wm_config;
+ RefPtr<Core::ConfigFile> m_wm_config;
WeakPtr<WSClientConnection> m_dnd_client;
String m_dnd_text;
diff --git a/Servers/WindowServer/WSWindowSwitcher.h b/Servers/WindowServer/WSWindowSwitcher.h
index ed49a9f2b2..97991f8648 100644
--- a/Servers/WindowServer/WSWindowSwitcher.h
+++ b/Servers/WindowServer/WSWindowSwitcher.h
@@ -35,7 +35,7 @@ class Painter;
class WSKeyEvent;
class WSWindow;
-class WSWindowSwitcher : public CObject {
+class WSWindowSwitcher : public Core::Object {
C_OBJECT(WSWindowSwitcher)
public:
static WSWindowSwitcher& the();
diff --git a/Servers/WindowServer/main.cpp b/Servers/WindowServer/main.cpp
index 8f142fe8c1..925af18d96 100644
--- a/Servers/WindowServer/main.cpp
+++ b/Servers/WindowServer/main.cpp
@@ -79,7 +79,7 @@ int main(int, char**)
return 1;
}
- auto wm_config = CConfigFile::get_for_app("WindowManager");
+ auto wm_config = Core::ConfigFile::get_for_app("WindowManager");
auto theme_name = wm_config->read_entry("Theme", "Name", "Default");
auto theme = load_system_theme(String::format("/res/themes/%s.ini", theme_name.characters()));
diff --git a/Shell/LineEditor.cpp b/Shell/LineEditor.cpp
index 0984a93900..c9f601288c 100644
--- a/Shell/LineEditor.cpp
+++ b/Shell/LineEditor.cpp
@@ -116,7 +116,7 @@ void LineEditor::cache_path()
auto directories = path.split(':');
for (const auto& directory : directories) {
- CDirIterator programs(directory.characters(), CDirIterator::SkipDots);
+ Core::DirIterator programs(directory.characters(), Core::DirIterator::SkipDots);
while (programs.has_next()) {
auto program = programs.next_path();
String program_path = String::format("%s/%s", directory.characters(), program.characters());
@@ -207,7 +207,7 @@ Vector<String> LineEditor::tab_complete_other_token(String& token)
// the suggestions list is incomplete.
// We only do this if the token is empty though.
if (token.is_empty()) {
- CDirIterator suggested_files(path, CDirIterator::SkipDots);
+ Core::DirIterator suggested_files(path, Core::DirIterator::SkipDots);
while (suggested_files.has_next()) {
suggestions.append(suggested_files.next_path());
}
@@ -216,7 +216,7 @@ Vector<String> LineEditor::tab_complete_other_token(String& token)
String completion;
bool seen_others = false;
- CDirIterator files(path, CDirIterator::SkipDots);
+ Core::DirIterator files(path, Core::DirIterator::SkipDots);
while (files.has_next()) {
auto file = files.next_path();
if (file.starts_with(token)) {
diff --git a/Shell/main.cpp b/Shell/main.cpp
index 26ba668f4c..8146a696d4 100644
--- a/Shell/main.cpp
+++ b/Shell/main.cpp
@@ -178,7 +178,7 @@ static int sh_time(int argc, char** argv)
if (i != argc - 1)
builder.append(' ');
}
- CElapsedTimer timer;
+ Core::ElapsedTimer timer;
timer.start();
int exit_code = run_command(builder.to_string());
printf("Time: %d ms\n", timer.elapsed());
@@ -479,7 +479,7 @@ public:
}
private:
- CElapsedTimer m_timer;
+ Core::ElapsedTimer m_timer;
String m_command;
};
@@ -536,7 +536,7 @@ static Vector<String> expand_globs(const StringView& path, const StringView& bas
StringView new_base_v = new_base;
if (new_base_v.is_empty())
new_base_v = ".";
- CDirIterator di(new_base_v, CDirIterator::NoFlags);
+ Core::DirIterator di(new_base_v, Core::DirIterator::NoFlags);
if (di.has_error()) {
return res;
@@ -848,8 +848,8 @@ static String get_history_path()
void load_history()
{
- auto history_file = CFile::construct(get_history_path());
- if (!history_file->open(CIODevice::ReadOnly))
+ auto history_file = Core::File::construct(get_history_path());
+ if (!history_file->open(Core::IODevice::ReadOnly))
return;
while (history_file->can_read_line()) {
auto b = history_file->read_line(1024);
@@ -860,8 +860,8 @@ void load_history()
void save_history()
{
- auto history_file = CFile::construct(get_history_path());
- if (!history_file->open(CIODevice::WriteOnly))
+ auto history_file = Core::File::construct(get_history_path());
+ if (!history_file->open(Core::IODevice::WriteOnly))
return;
for (const auto& line : editor.history()) {
history_file->write(line);
@@ -921,8 +921,8 @@ int main(int argc, char** argv)
}
if (argc == 2 && argv[1][0] != '-') {
- auto file = CFile::construct(argv[1]);
- if (!file->open(CIODevice::ReadOnly)) {
+ auto file = Core::File::construct(argv[1]);
+ if (!file->open(Core::IODevice::ReadOnly)) {
fprintf(stderr, "Failed to open %s: %s\n", file->filename().characters(), file->error_string());
return 1;
}
diff --git a/Userland/allocate.cpp b/Userland/allocate.cpp
index f016d6c4d6..a5c6d17cad 100644
--- a/Userland/allocate.cpp
+++ b/Userland/allocate.cpp
@@ -72,7 +72,7 @@ int main(int argc, char** argv)
break;
}
- CElapsedTimer timer;
+ Core::ElapsedTimer timer;
printf("allocating memory (%d bytes)...\n", count);
timer.start();
@@ -86,7 +86,7 @@ int main(int argc, char** argv)
auto pages = count / 4096;
auto step = pages / 10;
- CElapsedTimer timer2;
+ Core::ElapsedTimer timer2;
printf("writing one byte to each page of allocated memory...\n");
timer.start();
diff --git a/Userland/aplay.cpp b/Userland/aplay.cpp
index 1f2cdd1d0a..eb1c1497b2 100644
--- a/Userland/aplay.cpp
+++ b/Userland/aplay.cpp
@@ -32,7 +32,7 @@
int main(int argc, char** argv)
{
- CEventLoop loop;
+ Core::EventLoop loop;
if (argc < 2) {
fprintf(stderr, "Need a WAV to play\n");
return 1;
diff --git a/Userland/avol.cpp b/Userland/avol.cpp
index 6a9b516518..65eb78bf59 100644
--- a/Userland/avol.cpp
+++ b/Userland/avol.cpp
@@ -30,7 +30,7 @@
int main(int argc, char** argv)
{
- CEventLoop loop;
+ Core::EventLoop loop;
auto audio_client = AClientConnection::construct();
audio_client->handshake();
diff --git a/Userland/cal.cpp b/Userland/cal.cpp
index dd454f8c54..8c2a72d080 100644
--- a/Userland/cal.cpp
+++ b/Userland/cal.cpp
@@ -132,11 +132,11 @@ int main(int argc, char** argv)
int month = 0;
int year = 0;
- CArgsParser args_parser;
+ Core::ArgsParser args_parser;
// FIXME: This should ensure two values get parsed as month + year
- args_parser.add_positional_argument(day, "Day of year", "day", CArgsParser::Required::No);
- args_parser.add_positional_argument(month, "Month", "month", CArgsParser::Required::No);
- args_parser.add_positional_argument(year, "Year", "year", CArgsParser::Required::No);
+ args_parser.add_positional_argument(day, "Day of year", "day", Core::ArgsParser::Required::No);
+ args_parser.add_positional_argument(month, "Month", "month", Core::ArgsParser::Required::No);
+ args_parser.add_positional_argument(year, "Year", "year", Core::ArgsParser::Required::No);
args_parser.parse(argc, argv);
time_t now = time(nullptr);
diff --git a/Userland/chroot.cpp b/Userland/chroot.cpp
index e4e5cd3b6f..82d5f1f7c1 100644
--- a/Userland/chroot.cpp
+++ b/Userland/chroot.cpp
@@ -35,11 +35,11 @@ int main(int argc, char** argv)
const char* program = "/bin/Shell";
int flags = -1;
- CArgsParser args_parser;
+ Core::ArgsParser args_parser;
args_parser.add_positional_argument(path, "New root directory", "path");
- args_parser.add_positional_argument(program, "Program to run", "program", CArgsParser::Required::No);
+ args_parser.add_positional_argument(program, "Program to run", "program", Core::ArgsParser::Required::No);
- CArgsParser::Option option {
+ Core::ArgsParser::Option option {
true,
"Mount options",
"options",
diff --git a/Userland/copy.cpp b/Userland/copy.cpp
index aa74e815f9..0430bdef49 100644
--- a/Userland/copy.cpp
+++ b/Userland/copy.cpp
@@ -44,9 +44,9 @@ Options parse_options(int argc, char* argv[])
const char* type = nullptr;
Vector<const char*> text;
- CArgsParser args_parser;
+ Core::ArgsParser args_parser;
args_parser.add_option(type, "Pick a type", "type", 't', "type");
- args_parser.add_positional_argument(text, "Text to copy", "text", CArgsParser::Required::No);
+ args_parser.add_positional_argument(text, "Text to copy", "text", Core::ArgsParser::Required::No);
args_parser.parse(argc, argv);
Options options;
@@ -54,11 +54,11 @@ Options parse_options(int argc, char* argv[])
if (text.is_empty()) {
// Copy our stdin.
- auto c_stdin = CFile::construct();
+ auto c_stdin = Core::File::construct();
bool success = c_stdin->open(
STDIN_FILENO,
- CIODevice::OpenMode::ReadOnly,
- CFile::ShouldCloseFileDescription::No);
+ Core::IODevice::OpenMode::ReadOnly,
+ Core::File::ShouldCloseFileDescription::No);
ASSERT(success);
auto buffer = c_stdin->read_all();
dbg() << "Read size " << buffer.size();
diff --git a/Userland/cp.cpp b/Userland/cp.cpp
index 2a6adc1f7f..a9694bed4a 100644
--- a/Userland/cp.cpp
+++ b/Userland/cp.cpp
@@ -50,7 +50,7 @@ int main(int argc, char** argv)
Vector<const char*> sources;
const char* destination = nullptr;
- CArgsParser args_parser;
+ Core::ArgsParser args_parser;
args_parser.add_option(recursion_allowed, "Copy directories recursively", "recursive", 'r');
args_parser.add_positional_argument(sources, "Source file path", "source");
args_parser.add_positional_argument(destination, "Destination file path", "destination");
@@ -174,7 +174,7 @@ bool copy_directory(String src_path, String dst_path)
perror("cp: mkdir");
return false;
}
- CDirIterator di(src_path, CDirIterator::SkipDots);
+ Core::DirIterator di(src_path, Core::DirIterator::SkipDots);
if (di.has_error()) {
fprintf(stderr, "cp: CDirIterator: %s\n", di.error_string());
return false;
diff --git a/Userland/df.cpp b/Userland/df.cpp
index 4fa4a94bf7..af378e8f60 100644
--- a/Userland/df.cpp
+++ b/Userland/df.cpp
@@ -45,8 +45,8 @@ struct FileSystem {
int main(int, char**)
{
- auto file = CFile::construct("/proc/df");
- if (!file->open(CIODevice::ReadOnly)) {
+ auto file = Core::File::construct("/proc/df");
+ if (!file->open(Core::IODevice::ReadOnly)) {
fprintf(stderr, "Failed to open /proc/df: %s\n", file->error_string());
return 1;
}
diff --git a/Userland/disk_benchmark.cpp b/Userland/disk_benchmark.cpp
index 7de76943ca..66f2606815 100644
--- a/Userland/disk_benchmark.cpp
+++ b/Userland/disk_benchmark.cpp
@@ -119,7 +119,7 @@ int main(int argc, char** argv)
Vector<Result> results;
printf("Running: file_size=%d block_size=%d\n", file_size, block_size);
- CElapsedTimer timer;
+ Core::ElapsedTimer timer;
timer.start();
while (timer.elapsed() < time_per_benchmark * 1000) {
printf(".");
@@ -160,7 +160,7 @@ Result benchmark(const String& filename, int file_size, int block_size, ByteBuff
Result res;
- CElapsedTimer timer;
+ Core::ElapsedTimer timer;
timer.start();
int nwrote = 0;
diff --git a/Userland/dmesg.cpp b/Userland/dmesg.cpp
index 4e7492bd5e..05134e3f64 100644
--- a/Userland/dmesg.cpp
+++ b/Userland/dmesg.cpp
@@ -46,8 +46,8 @@ int main(int argc, char** argv)
(void)argc;
(void)argv;
- auto f = CFile::construct("/proc/dmesg");
- if (!f->open(CIODevice::ReadOnly)) {
+ auto f = Core::File::construct("/proc/dmesg");
+ if (!f->open(Core::IODevice::ReadOnly)) {
fprintf(stderr, "open: failed to open /proc/dmesg: %s\n", f->error_string());
return 1;
}
diff --git a/Userland/gron.cpp b/Userland/gron.cpp
index 1a2d7816bd..ceba6438f9 100644
--- a/Userland/gron.cpp
+++ b/Userland/gron.cpp
@@ -48,8 +48,8 @@ int main(int argc, char** argv)
fprintf(stderr, "usage: gron <file>\n");
return 0;
}
- auto file = CFile::construct(argv[1]);
- if (!file->open(CIODevice::ReadOnly)) {
+ auto file = Core::File::construct(argv[1]);
+ if (!file->open(Core::IODevice::ReadOnly)) {
fprintf(stderr, "Couldn't open %s for reading: %s\n", argv[1], file->error_string());
return 1;
}
diff --git a/Userland/head.cpp b/Userland/head.cpp
index aaeac55fa5..d4c4613cd9 100644
--- a/Userland/head.cpp
+++ b/Userland/head.cpp
@@ -41,12 +41,12 @@ int main(int argc, char** argv)
bool always_print_filenames = false;
Vector<const char*> files;
- CArgsParser args_parser;
+ Core::ArgsParser args_parser;
args_parser.add_option(line_count, "Number of lines to print (default 10)", "lines", 'n', "number");
args_parser.add_option(char_count, "Number of characters to print", "characters", 'c', "number");
args_parser.add_option(never_print_filenames, "Never print file names", "quiet", 'q');
args_parser.add_option(always_print_filenames, "Always print file names", "verbose", 'v');
- args_parser.add_positional_argument(files, "File to process", "file", CArgsParser::Required::No);
+ args_parser.add_positional_argument(files, "File to process", "file", Core::ArgsParser::Required::No);
args_parser.parse(argc, argv);
if (line_count == 0 && char_count == 0) {
diff --git a/Userland/html.cpp b/Userland/html.cpp
index 58e5ab88dd..b32fb2495e 100644
--- a/Userland/html.cpp
+++ b/Userland/html.cpp
@@ -46,13 +46,13 @@ int main(int argc, char** argv)
{
GApplication app(argc, argv);
- auto f = CFile::construct();
+ auto f = Core::File::construct();
bool success;
if (argc < 2) {
- success = f->open(STDIN_FILENO, CIODevice::OpenMode::ReadOnly, CFile::ShouldCloseFileDescription::No);
+ success = f->open(STDIN_FILENO, Core::IODevice::OpenMode::ReadOnly, Core::File::ShouldCloseFileDescription::No);
} else {
f->set_filename(argv[1]);
- success = f->open(CIODevice::OpenMode::ReadOnly);
+ success = f->open(Core::IODevice::OpenMode::ReadOnly);
}
if (!success) {
fprintf(stderr, "Error: %s\n", f->error_string());
diff --git a/Userland/id.cpp b/Userland/id.cpp
index 90276e15f0..dd21bf3ae1 100644
--- a/Userland/id.cpp
+++ b/Userland/id.cpp
@@ -60,7 +60,7 @@ int main(int argc, char** argv)
return 1;
}
- CArgsParser args_parser;
+ Core::ArgsParser args_parser;
args_parser.add_option(flag_print_uid, "Print UID", nullptr, 'u');
args_parser.add_option(flag_print_gid, "Print GID", nullptr, 'g');
args_parser.add_option(flag_print_gid_all, "Print all GIDs", nullptr, 'G');
diff --git a/Userland/ifconfig.cpp b/Userland/ifconfig.cpp
index dfebd5aec5..7a2d347551 100644
--- a/Userland/ifconfig.cpp
+++ b/Userland/ifconfig.cpp
@@ -78,8 +78,8 @@ int main(int argc, char** argv)
return 0;
}
- auto file = CFile::construct("/proc/net/adapters");
- if (!file->open(CIODevice::ReadOnly)) {
+ auto file = Core::File::construct("/proc/net/adapters");
+ if (!file->open(Core::IODevice::ReadOnly)) {
fprintf(stderr, "Error: %s\n", file->error_string());
return 1;
}
diff --git a/Userland/jp.cpp b/Userland/jp.cpp
index df4a62e260..0bd2246fba 100644
--- a/Userland/jp.cpp
+++ b/Userland/jp.cpp
@@ -44,8 +44,8 @@ int main(int argc, char** argv)
fprintf(stderr, "usage: jp <file>\n");
return 0;
}
- auto file = CFile::construct(argv[1]);
- if (!file->open(CIODevice::ReadOnly)) {
+ auto file = Core::File::construct(argv[1]);
+ if (!file->open(Core::IODevice::ReadOnly)) {
fprintf(stderr, "Couldn't open %s for reading: %s\n", argv[1], file->error_string());
return 1;
}
diff --git a/Userland/keymap.cpp b/Userland/keymap.cpp
index 310b8d650a..8708e8ae14 100644
--- a/Userland/keymap.cpp
+++ b/Userland/keymap.cpp
@@ -69,10 +69,10 @@ char* read_map(const JsonObject& json, const String& name)
return map;
}
-RefPtr<CFile> open_keymap_file(String& filename)
+RefPtr<Core::File> open_keymap_file(String& filename)
{
- auto file = CFile::construct(filename);
- if (file->open(CIODevice::ReadOnly))
+ auto file = Core::File::construct(filename);
+ if (file->open(Core::IODevice::ReadOnly))
return file;
if (!filename.ends_with(".json")) {
@@ -81,8 +81,8 @@ RefPtr<CFile> open_keymap_file(String& filename)
full_path.append(filename);
full_path.append(".json");
filename = full_path.to_string();
- file = CFile::construct(filename);
- if (file->open(CIODevice::ReadOnly))
+ file = Core::File::construct(filename);
+ if (file->open(Core::IODevice::ReadOnly))
return file;
}
diff --git a/Userland/killall.cpp b/Userland/killall.cpp
index b8923a7130..bc680ff7bd 100644
--- a/Userland/killall.cpp
+++ b/Userland/killall.cpp
@@ -39,7 +39,7 @@ static void print_usage_and_exit()
static int kill_all(const String& process_name, const unsigned signum)
{
- auto processes = CProcessStatisticsReader().get_all();
+ auto processes = Core::ProcessStatisticsReader().get_all();
for (auto& it : processes) {
if (it.value.name == process_name) {
diff --git a/Userland/ln.cpp b/Userland/ln.cpp
index c567db7dc9..a7c2b1bb51 100644
--- a/Userland/ln.cpp
+++ b/Userland/ln.cpp
@@ -36,7 +36,7 @@ int main(int argc, char** argv)
const char* target = nullptr;
const char* path = nullptr;
- CArgsParser args_parser;
+ Core::ArgsParser args_parser;
args_parser.add_option(symbolic, "Create a symlink", "symbolic", 's');
args_parser.add_positional_argument(target, "Link target", "target");
args_parser.add_positional_argument(path, "Link path", "path");
diff --git a/Userland/ls.cpp b/Userland/ls.cpp
index 072cb16147..a2f68c33fb 100644
--- a/Userland/ls.cpp
+++ b/Userland/ls.cpp
@@ -85,7 +85,7 @@ int main(int argc, char** argv)
Vector<const char*> paths;
- CArgsParser args_parser;
+ Core::ArgsParser args_parser;
args_parser.add_option(flag_show_dotfiles, "Show dotfiles", "all", 'a');
args_parser.add_option(flag_long, "Display long info", "long", 'l');
args_parser.add_option(flag_sort_by_timestamp, "Sort files by timestamp", nullptr, 't');
@@ -94,7 +94,7 @@ int main(int argc, char** argv)
args_parser.add_option(flag_show_inode, "Show inode ids", "inode", 'i');
args_parser.add_option(flag_print_numeric, "In long format, display numeric UID/GID", "numeric-uid-gid", 'n');
args_parser.add_option(flag_human_readable, "Print human-readable sizes", "human-readable", 'h');
- args_parser.add_positional_argument(paths, "Directory to list", "path", CArgsParser::Required::No);
+ args_parser.add_positional_argument(paths, "Directory to list", "path", Core::ArgsParser::Required::No);
args_parser.parse(argc, argv);
if (flag_long) {
@@ -288,7 +288,7 @@ bool print_filesystem_object(const String& path, const String& name, const struc
int do_file_system_object_long(const char* path)
{
- CDirIterator di(path, !flag_show_dotfiles ? CDirIterator::SkipDots : CDirIterator::Flags::NoFlags);
+ Core::DirIterator di(path, !flag_show_dotfiles ? Core::DirIterator::SkipDots : Core::DirIterator::Flags::NoFlags);
if (di.has_error()) {
if (di.error() == ENOTDIR) {
struct stat stat;
@@ -366,7 +366,7 @@ bool print_filesystem_object_short(const char* path, const char* name, int* npri
int do_file_system_object_short(const char* path)
{
- CDirIterator di(path, !flag_show_dotfiles ? CDirIterator::SkipDots : CDirIterator::Flags::NoFlags);
+ Core::DirIterator di(path, !flag_show_dotfiles ? Core::DirIterator::SkipDots : Core::DirIterator::Flags::NoFlags);
if (di.has_error()) {
if (di.error() == ENOTDIR) {
int nprinted;
diff --git a/Userland/lspci.cpp b/Userland/lspci.cpp
index 8800a887e5..ff2907928e 100644
--- a/Userland/lspci.cpp
+++ b/Userland/lspci.cpp
@@ -57,8 +57,8 @@ int main(int argc, char** argv)
if (!db)
fprintf(stderr, "Couldn't open PCI ID database\n");
- auto proc_pci = CFile::construct("/proc/pci");
- if (!proc_pci->open(CIODevice::ReadOnly)) {
+ auto proc_pci = Core::File::construct("/proc/pci");
+ if (!proc_pci->open(Core::IODevice::ReadOnly)) {
fprintf(stderr, "Error: %s\n", proc_pci->error_string());
return 1;
}
diff --git a/Userland/man.cpp b/Userland/man.cpp
index 91066fec0b..44ccdaebfe 100644
--- a/Userland/man.cpp
+++ b/Userland/man.cpp
@@ -86,10 +86,10 @@ int main(int argc, char* argv[])
}
}
- auto file = CFile::construct();
+ auto file = Core::File::construct();
file->set_filename(make_path(section));
- if (!file->open(CIODevice::OpenMode::ReadOnly)) {
+ if (!file->open(Core::IODevice::OpenMode::ReadOnly)) {
perror("Failed to open man page file");
exit(1);
}
diff --git a/Userland/md.cpp b/Userland/md.cpp
index fc3fc51bd3..dda60557d7 100644
--- a/Userland/md.cpp
+++ b/Userland/md.cpp
@@ -45,13 +45,13 @@ int main(int argc, char* argv[])
else
file_name = argv[i];
- auto file = CFile::construct();;
+ auto file = Core::File::construct();;
bool success;
if (file_name == nullptr) {
- success = file->open(STDIN_FILENO, CIODevice::OpenMode::ReadOnly, CFile::ShouldCloseFileDescription::No);
+ success = file->open(STDIN_FILENO, Core::IODevice::OpenMode::ReadOnly, Core::File::ShouldCloseFileDescription::No);
} else {
file->set_filename(file_name);
- success = file->open(CIODevice::OpenMode::ReadOnly);
+ success = file->open(Core::IODevice::OpenMode::ReadOnly);
}
if (!success) {
fprintf(stderr, "Error: %s\n", file->error_string());
diff --git a/Userland/mount.cpp b/Userland/mount.cpp
index 4260946d87..fb90ed4ff2 100644
--- a/Userland/mount.cpp
+++ b/Userland/mount.cpp
@@ -58,8 +58,8 @@ bool mount_all()
// Mount all filesystems listed in /etc/fstab.
dbg() << "Mounting all filesystems...";
- auto fstab = CFile::construct("/etc/fstab");
- if (!fstab->open(CIODevice::OpenMode::ReadOnly)) {
+ auto fstab = Core::File::construct("/etc/fstab");
+ if (!fstab->open(Core::IODevice::OpenMode::ReadOnly)) {
fprintf(stderr, "Failed to open /etc/fstab: %s\n", fstab->error_string());
return false;
}
@@ -111,8 +111,8 @@ bool mount_all()
bool print_mounts()
{
// Output info about currently mounted filesystems.
- auto df = CFile::construct("/proc/df");
- if (!df->open(CIODevice::ReadOnly)) {
+ auto df = Core::File::construct("/proc/df");
+ if (!df->open(Core::IODevice::ReadOnly)) {
fprintf(stderr, "Failed to open /proc/df: %s\n", df->error_string());
return false;
}
@@ -158,9 +158,9 @@ int main(int argc, char** argv)
const char* options = nullptr;
bool should_mount_all = false;
- CArgsParser args_parser;
- args_parser.add_positional_argument(source, "Source path", "source", CArgsParser::Required::No);
- args_parser.add_positional_argument(mountpoint, "Mount point", "mountpoint", CArgsParser::Required::No);
+ Core::ArgsParser args_parser;
+ args_parser.add_positional_argument(source, "Source path", "source", Core::ArgsParser::Required::No);
+ args_parser.add_positional_argument(mountpoint, "Mount point", "mountpoint", Core::ArgsParser::Required::No);
args_parser.add_option(fs_type, "File system type", nullptr, 't', "fstype");
args_parser.add_option(options, "Mount options", nullptr, 'o', "options");
args_parser.add_option(should_mount_all, "Mount all file systems listed in /etc/fstab", nullptr, 'a');
diff --git a/Userland/nl.cpp b/Userland/nl.cpp
index ab7ca2615a..99aed8a362 100644
--- a/Userland/nl.cpp
+++ b/Userland/nl.cpp
@@ -46,9 +46,9 @@ int main(int argc, char** argv)
int number_width = 6;
Vector<const char*> files;
- CArgsParser args_parser;
+ Core::ArgsParser args_parser;
- CArgsParser::Option number_style_option {
+ Core::ArgsParser::Option number_style_option {
true,
"Line numbering style: 't' for non-empty lines, 'a' for all lines, 'n' for no lines",
"body-numbering",
@@ -73,7 +73,7 @@ int main(int argc, char** argv)
args_parser.add_option(separator, "Separator between line numbers and lines", "separator", 's', "string");
args_parser.add_option(start_number, "Initial line number", "startnum", 'v', "number");
args_parser.add_option(number_width, "Number width", "width", 'w', "number");
- args_parser.add_positional_argument(files, "Files to process", "file", CArgsParser::Required::No);
+ args_parser.add_positional_argument(files, "Files to process", "file", Core::ArgsParser::Required::No);
args_parser.parse(argc, argv);
Vector<FILE*> file_pointers;
diff --git a/Userland/pape.cpp b/Userland/pape.cpp
index 317f54c133..8b35234bc1 100644
--- a/Userland/pape.cpp
+++ b/Userland/pape.cpp
@@ -42,7 +42,7 @@
static int handle_show_all()
{
- CDirIterator di("/res/wallpapers", CDirIterator::SkipDots);
+ Core::DirIterator di("/res/wallpapers", Core::DirIterator::SkipDots);
if (di.has_error()) {
fprintf(stderr, "CDirIterator: %s\n", di.error_string());
return 1;
@@ -80,10 +80,10 @@ int main(int argc, char** argv)
bool show_current = false;
const char* name = nullptr;
- CArgsParser args_parser;
+ Core::ArgsParser args_parser;
args_parser.add_option(show_all, "Show all wallpapers", "show-all", 'a');
args_parser.add_option(show_current, "Show current wallpaper", "show-current", 'c');
- args_parser.add_positional_argument(name, "Wallpaper to set", "name", CArgsParser::Required::No);
+ args_parser.add_positional_argument(name, "Wallpaper to set", "name", Core::ArgsParser::Required::No);
args_parser.parse(argc, argv);
GApplication app(argc, argv);
diff --git a/Userland/paste.cpp b/Userland/paste.cpp
index f14ad4588b..0f82a31bce 100644
--- a/Userland/paste.cpp
+++ b/Userland/paste.cpp
@@ -36,7 +36,7 @@ int main(int argc, char* argv[])
bool print_type = false;
bool no_newline = false;
- CArgsParser args_parser;
+ Core::ArgsParser args_parser;
args_parser.add_option(print_type, "Display the copied type", "print-type", 0);
args_parser.add_option(no_newline, "Do not append a newline", "no-newline", 'n');
args_parser.parse(argc, argv);
diff --git a/Userland/pidof.cpp b/Userland/pidof.cpp
index 332cc794f0..049da70e8e 100644
--- a/Userland/pidof.cpp
+++ b/Userland/pidof.cpp
@@ -38,7 +38,7 @@ static int pid_of(const String& process_name, bool single_shot, bool omit_pid, p
{
bool displayed_at_least_one = false;
- auto processes = CProcessStatisticsReader().get_all();
+ auto processes = Core::ProcessStatisticsReader().get_all();
for (auto& it : processes) {
if (it.value.name == process_name) {
@@ -64,7 +64,7 @@ int main(int argc, char** argv)
const char* omit_pid_value = nullptr;
const char* process_name = nullptr;
- CArgsParser args_parser;
+ Core::ArgsParser args_parser;
args_parser.add_option(single_shot, "Only return one pid", nullptr, 's');
args_parser.add_option(omit_pid_value, "Omit the given PID, or the parent process if the special value %PPID is passed", nullptr, 'o', "pid");
args_parser.add_positional_argument(process_name, "Process name to search for", "process-name");
diff --git a/Userland/pro.cpp b/Userland/pro.cpp
index f647371cc6..09e58d5de3 100644
--- a/Userland/pro.cpp
+++ b/Userland/pro.cpp
@@ -45,7 +45,7 @@ int main(int argc, char** argv)
return 1;
}
- CEventLoop loop;
+ Core::EventLoop loop;
auto protocol_client = LibProtocol::Client::construct();
auto download = protocol_client->start_download(url.to_string());
diff --git a/Userland/ps.cpp b/Userland/ps.cpp
index 595faf8bc0..dc71708aa9 100644
--- a/Userland/ps.cpp
+++ b/Userland/ps.cpp
@@ -37,7 +37,7 @@ int main(int argc, char** argv)
printf("PID TPG PGP SID UID STATE PPID NSCHED FDS TTY NAME\n");
- auto all_processes = CProcessStatisticsReader::get_all();
+ auto all_processes = Core::ProcessStatisticsReader::get_all();
for (const auto& it : all_processes) {
const auto& proc = it.value;
diff --git a/Userland/rm.cpp b/Userland/rm.cpp
index 3e208ae486..6fbbeb8a2c 100644
--- a/Userland/rm.cpp
+++ b/Userland/rm.cpp
@@ -28,7 +28,6 @@
#include <AK/StringBuilder.h>
#include <AK/Vector.h>
#include <LibCore/CArgsParser.h>
-#include <LibCore/CDirIterator.h>
#include <dirent.h>
#include <stdio.h>
#include <string.h>
@@ -80,7 +79,7 @@ int main(int argc, char** argv)
bool recursive = false;
const char* path = nullptr;
- CArgsParser args_parser;
+ Core::ArgsParser args_parser;
args_parser.add_option(recursive, "Delete directories recursively", "recursive", 'r');
args_parser.add_positional_argument(path, "File to remove", "path");
args_parser.parse(argc, argv);
diff --git a/Userland/rpcdump.cpp b/Userland/rpcdump.cpp
index 271c14e255..f4dc84e109 100644
--- a/Userland/rpcdump.cpp
+++ b/Userland/rpcdump.cpp
@@ -50,11 +50,11 @@ int main(int argc, char** argv)
return 0;
}
- CEventLoop loop;
+ Core::EventLoop loop;
int pid = atoi(argv[1]);
- auto socket = CLocalSocket::construct();
+ auto socket = Core::LocalSocket::construct();
if (pledge("stdio unix", nullptr) < 0) {
perror("pledge");
@@ -88,7 +88,7 @@ int main(int argc, char** argv)
loop.quit(0);
};
- auto success = socket->connect(CSocketAddress::local(String::format("/tmp/rpc.%d", pid)));
+ auto success = socket->connect(Core::SocketAddress::local(String::format("/tmp/rpc.%d", pid)));
if (!success) {
fprintf(stderr, "Couldn't connect to PID %d\n", pid);
return 1;
diff --git a/Userland/shutdown.cpp b/Userland/shutdown.cpp
index 7dd7fecc57..1d44c02144 100644
--- a/Userland/shutdown.cpp
+++ b/Userland/shutdown.cpp
@@ -32,7 +32,7 @@ int main(int argc, char** argv)
{
bool now = false;
- CArgsParser args_parser;
+ Core::ArgsParser args_parser;
args_parser.add_option(now, "Shut down now", "now", 'n');
args_parser.parse(argc, argv);
diff --git a/Userland/sysctl.cpp b/Userland/sysctl.cpp
index 35497c8cd2..f1525f8b12 100644
--- a/Userland/sysctl.cpp
+++ b/Userland/sysctl.cpp
@@ -43,8 +43,8 @@ static String read_var(const String& name)
builder.append("/proc/sys/");
builder.append(name);
auto path = builder.to_string();
- auto f = CFile::construct(path);
- if (!f->open(CIODevice::ReadOnly)) {
+ auto f = Core::File::construct(path);
+ if (!f->open(Core::IODevice::ReadOnly)) {
fprintf(stderr, "open: %s", f->error_string());
exit(1);
}
@@ -62,8 +62,8 @@ static void write_var(const String& name, const String& value)
builder.append("/proc/sys/");
builder.append(name);
auto path = builder.to_string();
- auto f = CFile::construct(path);
- if (!f->open(CIODevice::WriteOnly)) {
+ auto f = Core::File::construct(path);
+ if (!f->open(Core::IODevice::WriteOnly)) {
fprintf(stderr, "open: %s", f->error_string());
exit(1);
}
@@ -76,7 +76,7 @@ static void write_var(const String& name, const String& value)
static int handle_show_all()
{
- CDirIterator di("/proc/sys", CDirIterator::SkipDots);
+ Core::DirIterator di("/proc/sys", Core::DirIterator::SkipDots);
if (di.has_error()) {
fprintf(stderr, "CDirIterator: %s\n", di.error_string());
return 1;
@@ -112,7 +112,7 @@ int main(int argc, char** argv)
bool show_all = false;
const char* var = nullptr;
- CArgsParser args_parser;
+ Core::ArgsParser args_parser;
args_parser.add_option(show_all, "Show all variables", nullptr, 'a');
args_parser.add_positional_argument(var, "Command (var[=value])", "command");
args_parser.parse(argc, argv);
diff --git a/Userland/tail.cpp b/Userland/tail.cpp
index 220d9ab2ef..25c9a1e409 100644
--- a/Userland/tail.cpp
+++ b/Userland/tail.cpp
@@ -35,7 +35,7 @@
#define DEFAULT_LINE_COUNT 10
-int tail_from_pos(CFile& file, off_t startline, bool want_follow)
+int tail_from_pos(Core::File& file, off_t startline, bool want_follow)
{
if (!file.seek(startline + 1))
return 1;
@@ -61,12 +61,12 @@ int tail_from_pos(CFile& file, off_t startline, bool want_follow)
return 0;
}
-off_t find_seek_pos(CFile& file, int wanted_lines)
+off_t find_seek_pos(Core::File& file, int wanted_lines)
{
// Rather than reading the whole file, start at the end and work backwards,
// stopping when we've found the number of lines we want.
off_t pos = 0;
- if (!file.seek(0, CIODevice::SeekMode::FromEndPosition, &pos)) {
+ if (!file.seek(0, Core::IODevice::SeekMode::FromEndPosition, &pos)) {
fprintf(stderr, "Failed to find end of file: %s\n", file.error_string());
return 1;
}
@@ -105,14 +105,14 @@ int main(int argc, char* argv[])
int line_count = DEFAULT_LINE_COUNT;
const char* file = nullptr;
- CArgsParser args_parser;
+ Core::ArgsParser args_parser;
args_parser.add_option(follow, "Output data as it is written to the file", "follow", 'f');
args_parser.add_option(line_count, "Fetch the specified number of lines", "lines", 'n', "number");
args_parser.add_positional_argument(file, "File path", "file");
args_parser.parse(argc, argv);
- auto f = CFile::construct(file);
- if (!f->open(CIODevice::ReadOnly)) {
+ auto f = Core::File::construct(file);
+ if (!f->open(Core::IODevice::ReadOnly)) {
fprintf(stderr, "Error opening file %s: %s\n", file, strerror(errno));
exit(1);
}
diff --git a/Userland/tee.cpp b/Userland/tee.cpp
index 40005366a9..ec9809d2c5 100644
--- a/Userland/tee.cpp
+++ b/Userland/tee.cpp
@@ -123,10 +123,10 @@ int main(int argc, char** argv)
bool ignore_interrupts = false;
Vector<const char*> paths;
- CArgsParser args_parser;
+ Core::ArgsParser args_parser;
args_parser.add_option(append, "Append, don't overwrite", "append", 'a');
args_parser.add_option(ignore_interrupts, "Ignore SIGINT", "ignore-interrupts", 'i');
- args_parser.add_positional_argument(paths, "Files to copy stdin to", "file", CArgsParser::Required::No);
+ args_parser.add_positional_argument(paths, "Files to copy stdin to", "file", Core::ArgsParser::Required::No);
args_parser.parse(argc, argv);
if (ignore_interrupts) {
diff --git a/Userland/top.cpp b/Userland/top.cpp
index 723024234b..cca0a7c24d 100644
--- a/Userland/top.cpp
+++ b/Userland/top.cpp
@@ -93,7 +93,7 @@ static Snapshot get_snapshot()
{
Snapshot snapshot;
- auto all_processes = CProcessStatisticsReader::get_all();
+ auto all_processes = Core::ProcessStatisticsReader::get_all();
for (auto& it : all_processes) {
auto& stats = it.value;
diff --git a/Userland/truncate.cpp b/Userland/truncate.cpp
index 44f5079c17..b6f6d0398d 100644
--- a/Userland/truncate.cpp
+++ b/Userland/truncate.cpp
@@ -42,7 +42,7 @@ int main(int argc, char** argv)
const char* reference = nullptr;
const char* file = nullptr;
- CArgsParser args_parser;
+ Core::ArgsParser args_parser;
args_parser.add_option(resize, "Resize the target file to (or by) this size. Prefix with + or - to expand or shrink the file, or a bare number to set the size exactly", "size", 's', "size");
args_parser.add_option(reference, "Resize the target file to match the size of this one", "reference", 'r', "file");
args_parser.add_positional_argument(file, "File path", "file");
diff --git a/Userland/umount.cpp b/Userland/umount.cpp
index 845c3a50bf..d3e708e740 100644
--- a/Userland/umount.cpp
+++ b/Userland/umount.cpp
@@ -32,7 +32,7 @@ int main(int argc, char** argv)
{
const char* mount_point = nullptr;
- CArgsParser args_parser;
+ Core::ArgsParser args_parser;
args_parser.add_positional_argument(mount_point, "Mount point", "mountpoint");
args_parser.parse(argc, argv);
diff --git a/Userland/useradd.cpp b/Userland/useradd.cpp
index ef5e51b427..6e9a4b8493 100644
--- a/Userland/useradd.cpp
+++ b/Userland/useradd.cpp
@@ -46,7 +46,7 @@ int main(int argc, char** argv)
const char* gecos = "";
const char* username = nullptr;
- CArgsParser args_parser;
+ Core::ArgsParser args_parser;
args_parser.add_option(home_path, "Home directory for the new user", "home-dir", 'd', "path");
args_parser.add_option(uid, "User ID (uid) for the new user", "uid", 'u', "uid");
args_parser.add_option(gid, "Group ID (gid) for the new user", "gid", 'g', "gid");
diff --git a/Userland/wc.cpp b/Userland/wc.cpp
index 5cb2e95185..b2bb024eb5 100644
--- a/Userland/wc.cpp
+++ b/Userland/wc.cpp
@@ -124,11 +124,11 @@ int main(int argc, char** argv)
{
Vector<const char*> files;
- CArgsParser args_parser;
+ Core::ArgsParser args_parser;
args_parser.add_option(output_line, "Output line count", "lines", 'l');
args_parser.add_option(output_byte, "Output byte count", "bytes", 'c');
args_parser.add_option(output_word, "Output word count", "words", 'w');
- args_parser.add_positional_argument(files, "File to process", "file", CArgsParser::Required::No);
+ args_parser.add_positional_argument(files, "File to process", "file", Core::ArgsParser::Required::No);
args_parser.parse(argc, argv);
if (!output_line && !output_byte && !output_word)