added some convenience functions to QSE::LinkedList, QSE::HashTable, and QSE::HashList

This commit is contained in:
2017-09-04 12:32:48 +00:00
parent 3cd745c181
commit 8b40ed630c
8 changed files with 85 additions and 98 deletions

View File

@ -27,6 +27,7 @@
#include <qse/cmn/hwad.h>
#include <qse/cmn/chr.h>
#include <qse/cmn/fmt.h>
#include <qse/cmn/str.h>
int qse_mbstoethwad (const qse_mchar_t* mbs, qse_ethwad_t* hwaddr)
{

View File

@ -25,22 +25,43 @@
*/
#include <qse/si/Socket.hpp>
#include <sys/socket.h>
/////////////////////////////////
QSE_BEGIN_NAMESPACE(QSE)
/////////////////////////////////
Socket::Socket (): handle(QSE_INVALID_SCKHND)
Socket::Socket () QSE_CPP_NOEXCEPT: handle(QSE_INVALID_SCKHND)
{
}
Socket::~Socket ()
Socket::~Socket () QSE_CPP_NOEXCEPT
{
this->close ();
}
#if 0
int Socket::fdopen (int handle) QSE_CPP_NOEXCEPT
{
this->handle = handle;
}
#endif
void Socket::close ()
int Socket::open (int domain, int type, int protocol) QSE_CPP_NOEXCEPT
{
int x;
x = ::socket (domain, type, protocol);
if (x != -1)
{
this->close ();
this->handle = x;
}
return x;
}
void Socket::close () QSE_CPP_NOEXCEPT
{
if (this->handle != QSE_INVALID_SCKHND)
{
@ -49,20 +70,17 @@ void Socket::close ()
}
}
//int Socket::open (int domain, int type, int protocol)
//{
//}
int Socket::connect (const SocketAddress& target)
int Socket::connect (const SocketAddress& target) QSE_CPP_NOEXCEPT
{
if (this->handle == QSE_INVALID_SCKHND)
{
//::socket (target.getFamily(), this->type, 0);
}
//if (this->handle == QSE_INVALID_SCKHND)
//{
//
//}
return -1;
}
int Socket::beginConnect (const SocketAddress &target)
int Socket::beginConnect (const SocketAddress &target) QSE_CPP_NOEXCEPT
{
}