X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Flib%2Fplatform%2Fsockets%2Fsocket.h;h=e894172b0873f7eb52029c325ccf77109018fad1;hb=2b44051cbfa70deafc30d9767323214debbc1a75;hp=f56d515c5e76676f95573555db07ad41523fe887;hpb=ebefc26c10d68ba9ced2a30c896dccc81c6c2eeb;p=deb_libcec.git diff --git a/src/lib/platform/sockets/socket.h b/src/lib/platform/sockets/socket.h index f56d515..e894172 100644 --- a/src/lib/platform/sockets/socket.h +++ b/src/lib/platform/sockets/socket.h @@ -31,15 +31,16 @@ * http://www.pulse-eight.net/ */ -#include "../threads/mutex.h" -#include "../util/StdString.h" +#include "lib/platform/threads/mutex.h" #if defined(__WINDOWS__) -#include "../windows/os-socket.h" +#include "lib/platform/windows/os-socket.h" #else -#include "../posix/os-socket.h" +#include "lib/platform/posix/os-socket.h" #endif +#include + // Common socket operations namespace PLATFORM @@ -56,26 +57,26 @@ namespace PLATFORM virtual bool IsOpen(void) = 0; virtual ssize_t Write(void* data, size_t len) = 0; virtual ssize_t Read(void* data, size_t len, uint64_t iTimeoutMs = 0) = 0; - virtual CStdString GetError(void) = 0; + virtual std::string GetError(void) = 0; virtual int GetErrorNumber(void) = 0; - virtual CStdString GetName(void) = 0; + virtual std::string GetName(void) = 0; }; template class CCommonSocket : public ISocket { public: - CCommonSocket(_SType initialSocketValue, const CStdString &strName) : + CCommonSocket(_SType initialSocketValue, const std::string &strName) : m_socket(initialSocketValue), m_strName(strName), m_iError(0) {} virtual ~CCommonSocket(void) {} - virtual CStdString GetError(void) + virtual std::string GetError(void) { - CStdString strError; - strError = m_strError.IsEmpty() && m_iError != 0 ? strerror(m_iError) : m_strError; + std::string strError; + strError = m_strError.empty() && m_iError != 0 ? strerror(m_iError) : m_strError; return strError; } @@ -84,17 +85,17 @@ namespace PLATFORM return m_iError; } - virtual CStdString GetName(void) + virtual std::string GetName(void) { - CStdString strName; + std::string strName; strName = m_strName; return strName; } protected: _SType m_socket; - CStdString m_strError; - CStdString m_strName; + std::string m_strError; + std::string m_strName; int m_iError; CMutex m_mutex; }; @@ -182,9 +183,9 @@ namespace PLATFORM return iReturn; } - virtual CStdString GetError(void) + virtual std::string GetError(void) { - CStdString strError; + std::string strError; CLockObject lock(m_mutex); strError = m_socket ? m_socket->GetError() : ""; return strError; @@ -196,9 +197,9 @@ namespace PLATFORM return m_socket ? m_socket->GetErrorNumber() : -EINVAL; } - virtual CStdString GetName(void) + virtual std::string GetName(void) { - CStdString strName; + std::string strName; CLockObject lock(m_mutex); strName = m_socket ? m_socket->GetName() : ""; return strName;