sf::IPAddress Class Reference

IPAddress provides easy manipulation of IP v4 addresses. More...

#include <IPAddress.hpp>

List of all members.


Public Member Functions

 IPAddress ()
 Default constructor.
 IPAddress (const std::string &Address)
 Construct the address from a string.
 IPAddress (Uint8 Byte0, Uint8 Byte1, Uint8 Byte2, Uint8 Byte3)
 Construct the address from 4 bytes.
bool IsValid () const
 Tell if the address is a valid one.
std::string ToString () const
 Get a string representation of the address.
bool operator== (const IPAddress &Other) const
 Comparison operator ==.
bool operator!= (const IPAddress &Other) const
 Comparison operator !=.
bool operator< (const IPAddress &Other) const
 Comparison operator <.
bool operator> (const IPAddress &Other) const
 Comparison operator >.
bool operator<= (const IPAddress &Other) const
 Comparison operator <=.
bool operator>= (const IPAddress &Other) const
 Comparison operator >=.

Static Public Member Functions

static IPAddress GetLocalAddress ()
 Get the computer's local IP address (from the LAN point of view).
static IPAddress GetPublicAddress ()
 Get the computer's public IP address (from the web point of view).

Static Public Attributes

static const IPAddress LocalHost
 Static member data.

Detailed Description

IPAddress provides easy manipulation of IP v4 addresses.

Definition at line 42 of file IPAddress.hpp.


Constructor & Destructor Documentation

sf::IPAddress::IPAddress (  ) 

Default constructor.

Definition at line 43 of file IPAddress.cpp.

sf::IPAddress::IPAddress ( const std::string &  Address  ) 

Construct the address from a string.

Parameters:
Address : IP address ("xxx.xxx.xxx.xxx") or network name

Definition at line 53 of file IPAddress.cpp.

sf::IPAddress::IPAddress ( Uint8  Byte0,
Uint8  Byte1,
Uint8  Byte2,
Uint8  Byte3 
)

Construct the address from 4 bytes.

Parameters:
Byte0 : First byte of the address
Byte1 : Second byte of the address
Byte2 : Third byte of the address
Byte3 : Fourth byte of the address

Definition at line 79 of file IPAddress.cpp.


Member Function Documentation

bool sf::IPAddress::IsValid (  )  const

Tell if the address is a valid one.

Returns:
True if address has a valid syntax

Definition at line 88 of file IPAddress.cpp.

std::string sf::IPAddress::ToString (  )  const

Get a string representation of the address.

Returns:
String representation of the IP address ("xxx.xxx.xxx.xxx")

Definition at line 97 of file IPAddress.cpp.

IPAddress sf::IPAddress::GetLocalAddress (  )  [static]

Get the computer's local IP address (from the LAN point of view).

Returns:
Local IP address

Definition at line 109 of file IPAddress.cpp.

IPAddress sf::IPAddress::GetPublicAddress (  )  [static]

Get the computer's public IP address (from the web point of view).

The only way to get a public address is to ask it to a distant website ; as a consequence, this function may be very slow -- use it as few as possible !

Returns:
Public IP address

Definition at line 157 of file IPAddress.cpp.

bool sf::IPAddress::operator== ( const IPAddress Other  )  const

Comparison operator ==.

Parameters:
Other : Address to compare
Returns:
True if *this == Other

Definition at line 224 of file IPAddress.cpp.

bool sf::IPAddress::operator!= ( const IPAddress Other  )  const

Comparison operator !=.

Parameters:
Other : Address to compare
Returns:
True if *this != Other

Definition at line 233 of file IPAddress.cpp.

bool sf::IPAddress::operator< ( const IPAddress Other  )  const

Comparison operator <.

Parameters:
Other : Address to compare
Returns:
True if *this < Other

Definition at line 242 of file IPAddress.cpp.

bool sf::IPAddress::operator> ( const IPAddress Other  )  const

Comparison operator >.

Parameters:
Other : Address to compare
Returns:
True if *this > Other

Definition at line 251 of file IPAddress.cpp.

bool sf::IPAddress::operator<= ( const IPAddress Other  )  const

Comparison operator <=.

Parameters:
Other : Address to compare
Returns:
True if *this <= Other

Definition at line 260 of file IPAddress.cpp.

bool sf::IPAddress::operator>= ( const IPAddress Other  )  const

Comparison operator >=.

Parameters:
Other : Address to compare
Returns:
True if *this >= Other

Definition at line 269 of file IPAddress.cpp.


Member Data Documentation

const IPAddress sf::IPAddress::LocalHost [static]

Static member data.

Definition at line 169 of file IPAddress.hpp.


The documentation for this class was generated from the following files: