Streamline wxSocket code: wxSocketBase now uses wxSocketImpl (previously known

as GSocket) which is a base class with various wxSocketImplXXX implementations
provided by different wxSocketManagers.

Share more code between ports (still not finished).

Refactor some code inside wxSocketImpl itself to be less redundant and fixed a
couple of minor bugs in the process.


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@56994 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2008-11-28 12:47:07 +00:00
parent 29dbfacee2
commit 51fe4b60ab
27 changed files with 1551 additions and 2029 deletions

View File

@@ -20,28 +20,28 @@
extern "C" {
static void _GSocket_Motif_Input(XtPointer data, int *WXUNUSED(fid),
static void wxSocket_Motif_Input(XtPointer data, int *WXUNUSED(fid),
XtInputId *WXUNUSED(id))
{
GSocket *socket = (GSocket *)data;
wxSocketImpl * const socket = static_cast<wxSocketImpl *>(data);
socket->Detected_Read();
}
static void _GSocket_Motif_Output(XtPointer data, int *WXUNUSED(fid),
static void wxSocket_Motif_Output(XtPointer data, int *WXUNUSED(fid),
XtInputId *WXUNUSED(id))
{
GSocket *socket = (GSocket *)data;
wxSocketImpl * const socket = static_cast<wxSocketImpl *>(data);
socket->Detected_Write();
}
}
class MotifSocketManager : public GSocketInputBasedManager
class MotifSocketManager : public wxSocketInputBasedManager
{
public:
virtual int AddInput(GSocket *socket, SocketDir d)
virtual int AddInput(wxSocketImpl *socket, SocketDir d)
{
return XtAppAddInput
(
@@ -49,8 +49,8 @@ public:
socket->m_fd,
(XtPointer)(d == FD_OUTPUT ? XtInputWriteMask
: XtInputReadMask),
d == FD_OUTPUT ? _GSocket_Motif_Output
: _GSocket_Motif_Input,
d == FD_OUTPUT ? wxSocket_Motif_Output
: wxSocket_Motif_Input,
socket
);
}
@@ -61,7 +61,7 @@ public:
}
};
GSocketManager *wxGUIAppTraits::GetSocketManager()
wxSocketManager *wxGUIAppTraits::GetSocketManager()
{
static MotifSocketManager s_manager;
return &s_manager;