sfIPAddress Class Reference

#include <IPAddress.hpp>

List of all members.

Public Member Functions

 sfIPAddress ()
 sfIPAddress (const std::string &Address)
 sfIPAddress (sfUint8 Byte0, sfUint8 Byte1, sfUint8 Byte2, sfUint8 Byte3)
bool IsValid () const
std::string ToString () const
bool operator== (const sfIPAddress &Other) const
bool operator!= (const sfIPAddress &Other) const
bool operator< (const sfIPAddress &Other) const
bool operator> (const sfIPAddress &Other) const
bool operator<= (const sfIPAddress &Other) const
bool operator>= (const sfIPAddress &Other) const

Static Public Member Functions

static sfIPAddress GetLocalAddress ()
static sfIPAddress GetPublicAddress ()

Static Public Attributes

static const sfIPAddress Broadcast
 Broadcast address (to send to everyone on a local network).
static const sfIPAddress LocalHost
 Local host address (to connect to the same computer).


Detailed Description

sfIPAddress provides easy manipulation of IP v4 addresses

Definition at line 40 of file IPAddress.hpp.


Constructor & Destructor Documentation

sfIPAddress::sfIPAddress (  ) 

Default constructor

Definition at line 42 of file IPAddress.cpp.

sfIPAddress::sfIPAddress ( const std::string &  Address  ) 

Construct the address from a string

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

Definition at line 52 of file IPAddress.cpp.

References IsValid().

sfIPAddress::sfIPAddress ( sfUint8  Byte0,
sfUint8  Byte1,
sfUint8  Byte2,
sfUint8  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 78 of file IPAddress.cpp.


Member Function Documentation

bool sfIPAddress::IsValid (  )  const

Tell if the address is a valid one

Returns:
True if address has a valid syntax Warning : broadcast address 255.255.255.255 is considered invalid

Definition at line 87 of file IPAddress.cpp.

Referenced by sfFTP::Connect(), and sfIPAddress().

std::string sfIPAddress::ToString (  )  const

Get a string representation of the address

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

Definition at line 96 of file IPAddress.cpp.

Referenced by sfSocketTCP::Connect(), GetPublicAddress(), and sfSocketUDP::Send().

sfIPAddress sfIPAddress::GetLocalAddress (  )  [static]

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

Returns:
Local IP address

Definition at line 108 of file IPAddress.cpp.

References myAddress.

sfIPAddress sfIPAddress::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 156 of file IPAddress.cpp.

References ToString().

bool sfIPAddress::operator== ( const sfIPAddress Other  )  const

Comparison operator ==

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

Definition at line 225 of file IPAddress.cpp.

References myAddress.

bool sfIPAddress::operator!= ( const sfIPAddress Other  )  const

Comparison operator !=

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

Definition at line 234 of file IPAddress.cpp.

References myAddress.

bool sfIPAddress::operator< ( const sfIPAddress Other  )  const

Comparison operator <

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

Definition at line 243 of file IPAddress.cpp.

References myAddress.

bool sfIPAddress::operator> ( const sfIPAddress Other  )  const

Comparison operator >

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

Definition at line 252 of file IPAddress.cpp.

References myAddress.

bool sfIPAddress::operator<= ( const sfIPAddress Other  )  const

Comparison operator <=

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

Definition at line 261 of file IPAddress.cpp.

References myAddress.

bool sfIPAddress::operator>= ( const sfIPAddress Other  )  const

Comparison operator >=

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

Definition at line 270 of file IPAddress.cpp.

References myAddress.


Member Data Documentation

const sfIPAddress sfIPAddress::Broadcast [static]

Broadcast address (to send to everyone on a local network).

Static member data

Definition at line 168 of file IPAddress.hpp.


The documentation for this class was generated from the following files:
Generated for SFML by  doxygen 1.5.2