mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 01:07:35 +00:00
LibCore: Put all classes in the Core namespace and remove the leading C
I've been wanting to do this for a long time. It's time we start being consistent about how this stuff works. The new convention is: - "LibFoo" is a userspace library that provides the "Foo" namespace. That's it :^) This was pretty tedious to convert and I didn't even start on LibGUI yet. But it's coming up next.
This commit is contained in:
parent
b7e3810b5c
commit
2d39da5405
265 changed files with 1380 additions and 1167 deletions
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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");
|
||||
}
|
||||
|
|
|
@ -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())
|
||||
|
|
|
@ -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 };
|
||||
};
|
||||
|
|
|
@ -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());
|
||||
}
|
||||
|
||||
|
|
|
@ -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());
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
};
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue