Made sf::IPAddress comparison operators non-member

Minor fix in sf::Clock API documentation

git-svn-id: https://sfml.svn.sourceforge.net/svnroot/sfml/branches/sfml2@1447 4e206d99-4929-0410-ac5d-dfc041789085
This commit is contained in:
LaurentGom 2010-03-11 14:27:57 +00:00
parent 64fb9a139a
commit 72b49a3592
3 changed files with 85 additions and 95 deletions

View file

@ -36,7 +36,7 @@ namespace sf
////////////////////////////////////////////////////////////
/// Static member data
////////////////////////////////////////////////////////////
const IPAddress IPAddress::LocalHost("127.0.0.1");
const IPAddress IPAddress::LocalHost(127, 0, 0, 1);
////////////////////////////////////////////////////////////
@ -221,61 +221,47 @@ IPAddress IPAddress::GetPublicAddress(float timeout)
////////////////////////////////////////////////////////////
/// Comparison operator ==
////////////////////////////////////////////////////////////
bool IPAddress::operator ==(const IPAddress& other) const
bool operator ==(const IPAddress& left, const IPAddress& right)
{
return myAddress == other.myAddress;
return left.ToInteger() == right.ToInteger();
}
////////////////////////////////////////////////////////////
/// Comparison operator !=
////////////////////////////////////////////////////////////
bool IPAddress::operator !=(const IPAddress& other) const
bool operator !=(const IPAddress& left, const IPAddress& right)
{
return myAddress != other.myAddress;
return !(left == right);
}
////////////////////////////////////////////////////////////
/// Comparison operator <
////////////////////////////////////////////////////////////
bool IPAddress::operator <(const IPAddress& other) const
bool operator <(const IPAddress& left, const IPAddress& right)
{
return myAddress < other.myAddress;
return left.ToInteger() < right.ToInteger();
}
////////////////////////////////////////////////////////////
/// Comparison operator >
////////////////////////////////////////////////////////////
bool IPAddress::operator >(const IPAddress& other) const
bool operator >(const IPAddress& left, const IPAddress& right)
{
return myAddress > other.myAddress;
return right < left;
}
////////////////////////////////////////////////////////////
/// Comparison operator <=
////////////////////////////////////////////////////////////
bool IPAddress::operator <=(const IPAddress& other) const
bool operator <=(const IPAddress& left, const IPAddress& right)
{
return myAddress <= other.myAddress;
return !(right < left);
}
////////////////////////////////////////////////////////////
/// Comparison operator >=
////////////////////////////////////////////////////////////
bool IPAddress::operator >=(const IPAddress& other) const
bool operator >=(const IPAddress& left, const IPAddress& right)
{
return myAddress >= other.myAddress;
return !(left < right);
}
////////////////////////////////////////////////////////////
/// Operator >> overload to extract an address from an input stream
////////////////////////////////////////////////////////////
std::istream& operator >>(std::istream& stream, IPAddress& address)
{
@ -287,8 +273,6 @@ std::istream& operator >>(std::istream& stream, IPAddress& address)
}
////////////////////////////////////////////////////////////
/// Operator << overload to print an address to an output stream
////////////////////////////////////////////////////////////
std::ostream& operator <<(std::ostream& stream, const IPAddress& address)
{