From: Vadim Zeitlin Date: Fri, 28 Nov 2008 15:06:50 +0000 (+0000) Subject: remove wxSocketManager::CreateSocket() function, we don't need to have different... X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/54cb21d692f6d62911820c3c6bc063af90d11e47 remove wxSocketManager::CreateSocket() function, we don't need to have different wxSocketImpl implementation for the same platform, all the differences between console and GUI applications are abstracted by wxSocketManager::Install/Uninstall_Callback() methods git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@57000 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/include/wx/private/socket.h b/include/wx/private/socket.h index 22d99911e0..e1c2f6ad25 100644 --- a/include/wx/private/socket.h +++ b/include/wx/private/socket.h @@ -21,7 +21,7 @@ - wxSocketImpl is actually just an abstract base class having only code common to all platforms, the concrete implementation classes derive from - it and are created by wxSocketManager::CreateSocket(). + it and are created by wxSocketImpl::Create(). - Some socket operations have different implementations in console-mode and GUI applications. wxSocketManager class exists to abstract this in such @@ -153,14 +153,6 @@ public: virtual void OnExit() = 0; - // create a concrete socket implementation associated with the given - // wxSocket object - // - // the returned object must be deleted by the caller - virtual wxSocketImpl *CreateSocket(wxSocketBase& wxsocket) = 0; - - - // these functions enable or disable monitoring of the given socket for the // specified events inside the currently running event loop (but notice // that both BSD and Winsock implementations actually use socket->m_server @@ -185,7 +177,7 @@ private: BSD and Winsock sockets. Objects of this class are not created directly but only via its static - Create() method which in turn forwards to wxSocketManager::CreateSocket(). + Create() method which is implemented in port-specific code. */ class wxSocketImpl { diff --git a/include/wx/unix/private/sockunix.h b/include/wx/unix/private/sockunix.h index dd82c31045..dd83004505 100644 --- a/include/wx/unix/private/sockunix.h +++ b/include/wx/unix/private/sockunix.h @@ -141,12 +141,6 @@ public: virtual bool OnInit() { return true; } virtual void OnExit() { } - // allocate/free the storage we need - virtual wxSocketImpl *CreateSocket(wxSocketBase& wxsocket) - { - return new wxSocketImplUnix(wxsocket); - } - protected: // identifies either input or output direction // diff --git a/src/common/socket.cpp b/src/common/socket.cpp index 541749394e..d17ce8f2ed 100644 --- a/src/common/socket.cpp +++ b/src/common/socket.cpp @@ -160,13 +160,6 @@ void wxSocketManager::Init() // wxSocketImpl // ========================================================================== -/* static */ -wxSocketImpl *wxSocketImpl::Create(wxSocketBase& wxsocket) -{ - wxSocketManager * const manager = wxSocketManager::Get(); - return manager ? manager->CreateSocket(wxsocket) : NULL; -} - wxSocketImpl::wxSocketImpl(wxSocketBase& wxsocket) : m_wxsocket(&wxsocket) { diff --git a/src/msw/gsocket.cpp b/src/msw/gsocket.cpp index 0e8bbd39df..a74fb08bba 100644 --- a/src/msw/gsocket.cpp +++ b/src/msw/gsocket.cpp @@ -77,6 +77,12 @@ wxFORCE_LINK_MODULE(gsockmsw) #include "wx/private/socket.h" +/* static */ +wxSocketImpl *wxSocketImpl::Create(wxSocketBase& wxsocket) +{ + return new wxSocketImplMSW(wxsocket); +} + void wxSocketImplMSW::DoClose() { wxSocketManager::Get()-> diff --git a/src/unix/sockunix.cpp b/src/unix/sockunix.cpp index 3fd9875c8b..31c04877c3 100644 --- a/src/unix/sockunix.cpp +++ b/src/unix/sockunix.cpp @@ -431,6 +431,12 @@ struct servent *wxGetservbyname_r(const char *port, const char *protocol, # define SOCKET_DEBUG(args) #endif /* __GSOCKET_DEBUG__ */ +/* static */ +wxSocketImpl *wxSocketImpl::Create(wxSocketBase& wxsocket) +{ + return new wxSocketImplUnix(wxsocket); +} + /* * Disallow further read/write operations on this socket, close @@ -1680,4 +1686,5 @@ wxSocketError GAddress_UNIX_GetPath(GAddress *address, char *path, size_t sbuf) return wxSOCKET_NOERROR; } #endif /* !defined(__VISAGECPP__) */ + #endif /* wxUSE_SOCKETS */