]> git.tdb.fi Git - libs/net.git/blobdiff - source/net/socket.h
Move the address family enum into sockaddr.h
[libs/net.git] / source / net / socket.h
index c55a5390a673d868b51d9e52a9675fee18f79b79..3e3c2aef13c29dba52f1bbcb27aa1c3eea2ed75d 100644 (file)
@@ -1,10 +1,10 @@
 #ifndef MSP_NET_SOCKET_H_
 #define MSP_NET_SOCKET_H_
 
+#include <memory>
 #include <msp/core/except.h>
 #include <msp/io/eventobject.h>
 #include <msp/io/handle.h>
-#include "constants.h"
 #include "sockaddr.h"
 
 namespace Msp {
@@ -30,8 +30,8 @@ protected:
 
        struct Private;
 
-       Private *priv = nullptr;
-       SockAddr *local_addr = nullptr;
+       std::unique_ptr<Private> priv;
+       std::unique_ptr<SockAddr> local_addr;
 
        Socket(const Private &);
        Socket(Family, int, int);
@@ -50,7 +50,7 @@ public:
        users of the address. */
        void bind(const SockAddr &);
 
-       bool is_bound() const { return local_addr; }
+       bool is_bound() const { return static_cast<bool>(local_addr); }
        const SockAddr &get_local_address() const;
 
        void set_timeout(const Time::TimeDelta &);