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:
parent
64fb9a139a
commit
72b49a3592
@ -130,66 +130,6 @@ public :
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
static IPAddress GetPublicAddress(float timeout = 0.f);
|
static IPAddress GetPublicAddress(float timeout = 0.f);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// Comparison operator ==
|
|
||||||
///
|
|
||||||
/// \param other : Address to compare
|
|
||||||
///
|
|
||||||
/// \return True if *this == other
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
bool operator ==(const IPAddress& other) const;
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// Comparison operator !=
|
|
||||||
///
|
|
||||||
/// \param other : Address to compare
|
|
||||||
///
|
|
||||||
/// \return True if *this != other
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
bool operator !=(const IPAddress& other) const;
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// Comparison operator <
|
|
||||||
///
|
|
||||||
/// \param other : Address to compare
|
|
||||||
///
|
|
||||||
/// \return True if *this < other
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
bool operator <(const IPAddress& other) const;
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// Comparison operator >
|
|
||||||
///
|
|
||||||
/// \param other : Address to compare
|
|
||||||
///
|
|
||||||
/// \return True if *this > other
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
bool operator >(const IPAddress& other) const;
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// Comparison operator <=
|
|
||||||
///
|
|
||||||
/// \param other : Address to compare
|
|
||||||
///
|
|
||||||
/// \return True if *this <= other
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
bool operator <=(const IPAddress& other) const;
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// Comparison operator >=
|
|
||||||
///
|
|
||||||
/// \param other : Address to compare
|
|
||||||
///
|
|
||||||
/// \return True if *this >= other
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
bool operator >=(const IPAddress& other) const;
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
// Static member data
|
// Static member data
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
@ -204,10 +144,76 @@ private :
|
|||||||
};
|
};
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Operator >> overload to extract an address from an input stream
|
/// \brief Overload of == operator to compare two host addresses
|
||||||
|
///
|
||||||
|
/// \param left Left operand (a host address)
|
||||||
|
/// \param right Right operand (a host address)
|
||||||
|
///
|
||||||
|
/// \return True if both hosts are equal
|
||||||
|
///
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
SFML_API bool operator ==(const IPAddress& left, const IPAddress& right);
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
/// \brief Overload of != operator to compare two host addresses
|
||||||
|
///
|
||||||
|
/// \param left Left operand (a host address)
|
||||||
|
/// \param right Right operand (a host address)
|
||||||
|
///
|
||||||
|
/// \return True if both hosts are different
|
||||||
|
///
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
SFML_API bool operator !=(const IPAddress& left, const IPAddress& right);
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
/// \brief Overload of < operator to compare two host addresses
|
||||||
|
///
|
||||||
|
/// \param left Left operand (a host address)
|
||||||
|
/// \param right Right operand (a host address)
|
||||||
|
///
|
||||||
|
/// \return True if \a left is lesser than \a right
|
||||||
|
///
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
SFML_API bool operator <(const IPAddress& left, const IPAddress& right);
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
/// \brief Overload of > operator to compare two host addresses
|
||||||
|
///
|
||||||
|
/// \param left Left operand (a host address)
|
||||||
|
/// \param right Right operand (a host address)
|
||||||
|
///
|
||||||
|
/// \return True if \a left is greater than \a right
|
||||||
|
///
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
SFML_API bool operator >(const IPAddress& left, const IPAddress& right);
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
/// \brief Overload of <= operator to compare two host addresses
|
||||||
|
///
|
||||||
|
/// \param left Left operand (a host address)
|
||||||
|
/// \param right Right operand (a host address)
|
||||||
|
///
|
||||||
|
/// \return True if \a left is lesser or equal than \a right
|
||||||
|
///
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
SFML_API bool operator <=(const IPAddress& left, const IPAddress& right);
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
/// \brief Overload of >= operator to compare two host addresses
|
||||||
|
///
|
||||||
|
/// \param left Left operand (a host address)
|
||||||
|
/// \param right Right operand (a host address)
|
||||||
|
///
|
||||||
|
/// \return True if \a left is greater or equal than \a right
|
||||||
|
///
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
SFML_API bool operator >=(const IPAddress& left, const IPAddress& right);
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
/// Operator >> overload to extract an host address from an input stream
|
||||||
///
|
///
|
||||||
/// \param Stream : Input stream
|
/// \param Stream : Input stream
|
||||||
/// \param Address : Address to extract
|
/// \param Address : Host address to extract
|
||||||
///
|
///
|
||||||
/// \return Reference to the input stream
|
/// \return Reference to the input stream
|
||||||
///
|
///
|
||||||
@ -215,10 +221,10 @@ private :
|
|||||||
SFML_API std::istream& operator >>(std::istream& stream, IPAddress& address);
|
SFML_API std::istream& operator >>(std::istream& stream, IPAddress& address);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Operator << overload to print an address to an output stream
|
/// Operator << overload to print an host address to an output stream
|
||||||
///
|
///
|
||||||
/// \param Stream : Output stream
|
/// \param Stream : Output stream
|
||||||
/// \param Address : Address to print
|
/// \param Address : Host address to print
|
||||||
///
|
///
|
||||||
/// \return Reference to the output stream
|
/// \return Reference to the output stream
|
||||||
///
|
///
|
||||||
|
@ -87,8 +87,8 @@ private :
|
|||||||
/// \class sf::Clock
|
/// \class sf::Clock
|
||||||
///
|
///
|
||||||
/// sf::Clock is a lightweight class for measuring time.
|
/// sf::Clock is a lightweight class for measuring time.
|
||||||
/// Its accuray depends on the underlying OS, but you can generally
|
/// Its resolution depends on the underlying OS, but you can generally
|
||||||
/// expect a 1 ms precision.
|
/// expect a 1 ms resolution.
|
||||||
///
|
///
|
||||||
/// Usage example:
|
/// Usage example:
|
||||||
/// \code
|
/// \code
|
||||||
|
@ -36,7 +36,7 @@ namespace sf
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Static member data
|
/// 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 operator ==(const IPAddress& left, const IPAddress& right)
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
bool IPAddress::operator ==(const IPAddress& other) const
|
|
||||||
{
|
{
|
||||||
return myAddress == other.myAddress;
|
return left.ToInteger() == right.ToInteger();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Comparison operator !=
|
bool operator !=(const IPAddress& left, const IPAddress& right)
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
bool IPAddress::operator !=(const IPAddress& other) const
|
|
||||||
{
|
{
|
||||||
return myAddress != other.myAddress;
|
return !(left == right);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Comparison operator <
|
bool operator <(const IPAddress& left, const IPAddress& right)
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
bool IPAddress::operator <(const IPAddress& other) const
|
|
||||||
{
|
{
|
||||||
return myAddress < other.myAddress;
|
return left.ToInteger() < right.ToInteger();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Comparison operator >
|
bool operator >(const IPAddress& left, const IPAddress& right)
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
bool IPAddress::operator >(const IPAddress& other) const
|
|
||||||
{
|
{
|
||||||
return myAddress > other.myAddress;
|
return right < left;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Comparison operator <=
|
bool operator <=(const IPAddress& left, const IPAddress& right)
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
bool IPAddress::operator <=(const IPAddress& other) const
|
|
||||||
{
|
{
|
||||||
return myAddress <= other.myAddress;
|
return !(right < left);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Comparison operator >=
|
bool operator >=(const IPAddress& left, const IPAddress& right)
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
bool IPAddress::operator >=(const IPAddress& other) const
|
|
||||||
{
|
{
|
||||||
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)
|
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)
|
std::ostream& operator <<(std::ostream& stream, const IPAddress& address)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user