📄 ip_address.cpp
字号:
/* $Id: ip_address.cpp,v 1.8 2003/07/20 22:34:40 grumbel Exp $
**
** ClanLib Game SDK
** Copyright (C) 2003 The ClanLib Team
** For a total list of contributers see the file CREDITS.
**
** This library is free software; you can redistribute it and/or
** modify it under the terms of the GNU Lesser General Public
** License as published by the Free Software Foundation; either
** version 2.1 of the License, or (at your option) any later version.
**
** This library is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
** Lesser General Public License for more details.
**
** You should have received a copy of the GNU Lesser General Public
** License along with this library; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
**
*/
#ifdef USE_GETADDR
#include "ip_address_getaddr.h"
#define CL_IPAddress_Platform CL_IPAddress_GetAddr
#else
#include "ip_address_getsock.h"
#define CL_IPAddress_Platform CL_IPAddress_GetSock
#endif
CL_IPAddress::CL_IPAddress()
{
impl = new CL_IPAddress_Platform;
}
CL_IPAddress::CL_IPAddress(const std::string &port)
{
impl = new CL_IPAddress_Platform(port);
}
CL_IPAddress::CL_IPAddress(const std::string &hostname, const std::string &port)
{
impl = new CL_IPAddress_Platform(hostname, port);
}
CL_IPAddress::CL_IPAddress(const CL_IPAddress ©)
{
impl = new CL_IPAddress_Platform(copy);
}
void CL_IPAddress::get_addrinfo(int type, sockaddr &addr, int &len, int domain) const
{
impl->get_addrinfo(type, addr, len, domain);
}
std::string CL_IPAddress::get_address() const
{
return impl->get_address();
}
std::string CL_IPAddress::get_port() const
{
return impl->get_port();
}
bool CL_IPAddress::operator == (const CL_IPAddress &other_instance) const
{
return impl->operator ==(other_instance);
}
bool CL_IPAddress::operator < (const CL_IPAddress &other_instance) const
{
return impl->operator <(other_instance);
}
bool CL_IPAddress::operator > (const CL_IPAddress &other_instance) const
{
return impl->operator >(other_instance);
}
void CL_IPAddress::set_address(const std::string &hostname, const std::string &port)
{
impl->set_address(hostname, port);
}
void CL_IPAddress::set_port(const std::string &new_port)
{
impl->set_port(new_port);
}
std::string CL_IPAddress::dns_lookup() const
{
return impl->dns_lookup();
}
bool CL_IPAddress::is_ipv4() const
{
return impl->is_ipv4();
}
bool CL_IPAddress::is_ipv6() const
{
return impl->is_ipv6();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -