take const address objects in wxSocketClient::Connect() and wxSocketBase::SetLocal()

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@54504 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2008-07-06 02:21:39 +00:00
parent 4f6c80fecd
commit 72ac4e888a
3 changed files with 20 additions and 14 deletions

View File

@@ -124,7 +124,7 @@ public:
// addresses // addresses
virtual bool GetLocal(wxSockAddress& addr_man) const; virtual bool GetLocal(wxSockAddress& addr_man) const;
virtual bool GetPeer(wxSockAddress& addr_man) const; virtual bool GetPeer(wxSockAddress& addr_man) const;
virtual bool SetLocal(wxIPV4address& local); virtual bool SetLocal(const wxIPV4address& local);
// base IO // base IO
virtual bool Close(); virtual bool Close();
@@ -258,8 +258,9 @@ public:
wxSocketClient(wxSocketFlags flags = wxSOCKET_NONE); wxSocketClient(wxSocketFlags flags = wxSOCKET_NONE);
virtual ~wxSocketClient(); virtual ~wxSocketClient();
virtual bool Connect(wxSockAddress& addr, bool wait = true); virtual bool Connect(const wxSockAddress& addr, bool wait = true);
bool Connect(wxSockAddress& addr, wxSockAddress& local, bool wait = true); bool Connect(const wxSockAddress& addr, const wxSockAddress& local,
bool wait = true);
bool WaitOnConnect(long seconds = -1, long milliseconds = 0); bool WaitOnConnect(long seconds = -1, long milliseconds = 0);
@@ -272,8 +273,9 @@ public:
} }
private: private:
virtual bool virtual bool DoConnect(const wxSockAddress& addr,
DoConnect(wxSockAddress& addr, wxSockAddress* local, bool wait = true); const wxSockAddress* local,
bool wait = true);
// buffer sizes, -1 if unset and defaults should be used // buffer sizes, -1 if unset and defaults should be used
int m_initialRecvBufferSize; int m_initialRecvBufferSize;

View File

@@ -272,8 +272,8 @@ public:
@see WaitOnConnect(), wxSocketBase::SetNotify, @see WaitOnConnect(), wxSocketBase::SetNotify,
wxSocketBase::Notify wxSocketBase::Notify
*/ */
bool Connect(wxSockAddress& address, bool wait = true); bool Connect(const wxSockAddress& address, bool wait = true);
bool Connect(wxSockAddress& address, wxSockAddress& local, bool Connect(const wxSockAddress& address, const wxSockAddress& local,
bool wait = true); bool wait = true);
//@} //@}
@@ -813,7 +813,7 @@ public:
a local port is set for a wxSocketClient, a local port is set for a wxSocketClient,
@b bind will be called before @b connect. @b bind will be called before @b connect.
*/ */
bool SetLocal(wxIPV4address& local); bool SetLocal(const wxIPV4address& local);
/** /**
SetNotify specifies which socket events are to be sent to the event handler. SetNotify specifies which socket events are to be sent to the event handler.

View File

@@ -1234,7 +1234,7 @@ bool wxSocketBase::SetOption(int level, int optname, const void *optval,
return true; return true;
} }
bool wxSocketBase::SetLocal(wxIPV4address& local) bool wxSocketBase::SetLocal(const wxIPV4address& local)
{ {
GAddress* la = local.GetAddress(); GAddress* la = local.GetAddress();
@@ -1272,7 +1272,9 @@ wxSocketClient::~wxSocketClient()
// Connect // Connect
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
bool wxSocketClient::DoConnect(wxSockAddress& addr_man, wxSockAddress* local, bool wait) bool wxSocketClient::DoConnect(const wxSockAddress& addr_man,
const wxSockAddress* local,
bool wait)
{ {
GSocketError err; GSocketError err;
@@ -1356,14 +1358,16 @@ bool wxSocketClient::DoConnect(wxSockAddress& addr_man, wxSockAddress* local, bo
return true; return true;
} }
bool wxSocketClient::Connect(wxSockAddress& addr_man, bool wait) bool wxSocketClient::Connect(const wxSockAddress& addr_man, bool wait)
{ {
return (DoConnect(addr_man, NULL, wait)); return DoConnect(addr_man, NULL, wait);
} }
bool wxSocketClient::Connect(wxSockAddress& addr_man, wxSockAddress& local, bool wait) bool wxSocketClient::Connect(const wxSockAddress& addr_man,
const wxSockAddress& local,
bool wait)
{ {
return (DoConnect(addr_man, &local, wait)); return DoConnect(addr_man, &local, wait);
} }
bool wxSocketClient::WaitOnConnect(long seconds, long milliseconds) bool wxSocketClient::WaitOnConnect(long seconds, long milliseconds)