Added the sf::Time class

This commit is contained in:
Laurent Gomila 2012-01-19 23:51:06 +01:00
parent e775bd0169
commit 4116ad033c
58 changed files with 880 additions and 227 deletions

View file

@ -29,6 +29,7 @@
// Headers
////////////////////////////////////////////////////////////
#include <SFML/System/NonCopyable.hpp>
#include <SFML/System/Time.hpp>
#include <SFML/Network/TcpSocket.hpp>
#include <string>
#include <vector>
@ -264,19 +265,19 @@ public :
/// This function tries to connect to the server so it may take
/// a while to complete, especially if the server is not
/// reachable. To avoid blocking your application for too long,
/// you can use a timeout. The default value, 0, means that the
/// you can use a timeout. The default value, Time::Zero, means that the
/// system timeout will be used (which is usually pretty long).
///
/// \param server Name or address of the FTP server to connect to
/// \param port Port used for the connection
/// \param timeout Maximum time to wait, in milliseconds
/// \param timeout Maximum time to wait
///
/// \return Server response to the request
///
/// \see Disconnect
///
////////////////////////////////////////////////////////////
Response Connect(const IpAddress& server, unsigned short port = 21, Uint32 timeout = 0);
Response Connect(const IpAddress& server, unsigned short port = 21, Time timeout = Time::Zero);
////////////////////////////////////////////////////////////
/// \brief Close the connection with the server

View file

@ -29,6 +29,7 @@
// Headers
////////////////////////////////////////////////////////////
#include <SFML/System/NonCopyable.hpp>
#include <SFML/System/Time.hpp>
#include <SFML/Network/IpAddress.hpp>
#include <SFML/Network/TcpSocket.hpp>
#include <map>
@ -377,16 +378,16 @@ public :
/// Warning: this function waits for the server's response and may
/// not return instantly; use a thread if you don't want to block your
/// application, or use a timeout to limit the time to wait. A value
/// of 0 means that the client will use the system defaut timeout
/// of Time::Zero means that the client will use the system defaut timeout
/// (which is usually pretty long).
///
/// \param request Request to send
/// \param timeout Maximum time to wait, in milliseconds
/// \param timeout Maximum time to wait
///
/// \return Server's response
///
////////////////////////////////////////////////////////////
Response SendRequest(const Request& request, Uint32 timeout = 0);
Response SendRequest(const Request& request, Time timeout = Time::Zero);
private :

View file

@ -29,6 +29,7 @@
// Headers
////////////////////////////////////////////////////////////
#include <SFML/Config.hpp>
#include <SFML/System/Time.hpp>
#include <istream>
#include <ostream>
#include <string>
@ -168,14 +169,14 @@ public :
/// to be possibly stuck waiting in case there is a problem; this
/// limit is deactivated by default.
///
/// \param timeout Maximum time to wait, in milliseconds
/// \param timeout Maximum time to wait
///
/// \return Public IP address of the computer
///
/// \see GetLocalAddress
///
////////////////////////////////////////////////////////////
static IpAddress GetPublicAddress(Uint32 timeout = 0);
static IpAddress GetPublicAddress(Time timeout = Time::Zero);
////////////////////////////////////////////////////////////
// Static member data

View file

@ -29,6 +29,7 @@
// Headers
////////////////////////////////////////////////////////////
#include <SFML/Config.hpp>
#include <SFML/System/Time.hpp>
namespace sf
@ -111,14 +112,14 @@ public :
/// If you use a timeout and no socket is ready before the timeout
/// is over, the function returns false.
///
/// \param timeout Maximum time to wait, in milliseconds (use 0 for infinity)
/// \param timeout Maximum time to wait, (use Time::Zero for infinity)
///
/// \return True if there are sockets ready, false otherwise
///
/// \see IsReady
///
////////////////////////////////////////////////////////////
bool Wait(Uint32 timeout = 0);
bool Wait(Time timeout = Time::Zero);
////////////////////////////////////////////////////////////
/// \brief Test a socket to know if it is ready to receive data

View file

@ -29,6 +29,7 @@
// Headers
////////////////////////////////////////////////////////////
#include <SFML/Network/Socket.hpp>
#include <SFML/System/Time.hpp>
namespace sf
@ -99,14 +100,14 @@ public :
///
/// \param remoteAddress Address of the remote peer
/// \param remotePort Port of the remote peer
/// \param timeout Optional maximum time to wait, in milliseconds
/// \param timeout Optional maximum time to wait
///
/// \return Status code
///
/// \see Disconnect
///
////////////////////////////////////////////////////////////
Status Connect(const IpAddress& remoteAddress, unsigned short remotePort, Uint32 timeout = 0);
Status Connect(const IpAddress& remoteAddress, unsigned short remotePort, Time timeout = Time::Zero);
////////////////////////////////////////////////////////////
/// \brief Disconnect the socket from its remote peer