1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-24 22:17:42 +00:00

LibCore: Put all classes in the Core namespace and remove the leading C

I've been wanting to do this for a long time. It's time we start being
consistent about how this stuff works.

The new convention is:

- "LibFoo" is a userspace library that provides the "Foo" namespace.

That's it :^) This was pretty tedious to convert and I didn't even
start on LibGUI yet. But it's coming up next.
This commit is contained in:
Andreas Kling 2020-02-02 12:34:39 +01:00
parent b7e3810b5c
commit 2d39da5405
265 changed files with 1380 additions and 1167 deletions

View file

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