Changed internal naming convention (local variables now start with a lower case character)

Removed the AudioResource class

git-svn-id: https://sfml.svn.sourceforge.net/svnroot/sfml/branches/sfml2@1166 4e206d99-4929-0410-ac5d-dfc041789085
This commit is contained in:
LaurentGom 2009-07-11 22:17:24 +00:00
parent 7cc00085d8
commit 45b150648d
245 changed files with 7865 additions and 8065 deletions

View file

@ -136,11 +136,11 @@ public :
////////////////////////////////////////////////////////////
/// Default constructor
///
/// \param Code : Response status code (InvalidResponse by default)
/// \param Message : Response message (empty by default)
/// \param code : Response status code (InvalidResponse by default)
/// \param message : Response message (empty by default)
///
////////////////////////////////////////////////////////////
Response(Status Code = InvalidResponse, const std::string& Message = "");
Response(Status code = InvalidResponse, const std::string& message = "");
////////////////////////////////////////////////////////////
/// Convenience function to check if the response status code
@ -186,10 +186,10 @@ public :
////////////////////////////////////////////////////////////
/// Default constructor
///
/// \param Resp : Source response
/// \param response : Source response
///
////////////////////////////////////////////////////////////
DirectoryResponse(Response Resp);
DirectoryResponse(Response response);
////////////////////////////////////////////////////////////
/// Get the directory returned in the response
@ -218,11 +218,11 @@ public :
////////////////////////////////////////////////////////////
/// Default constructor
///
/// \param Resp : Source response
/// \param Data : Data containing the raw listing
/// \param response : Source response
/// \param data : Data containing the raw listing
///
////////////////////////////////////////////////////////////
ListingResponse(Response Resp, const std::vector<char>& Data);
ListingResponse(Response response, const std::vector<char>& data);
////////////////////////////////////////////////////////////
/// Get the number of filenames in the listing
@ -235,12 +235,12 @@ public :
////////////////////////////////////////////////////////////
/// Get the Index-th filename in the directory
///
/// \param Index : Index of the filename to get
/// \param index : Index of the filename to get
///
/// \return Index-th filename
///
////////////////////////////////////////////////////////////
const std::string& GetFilename(std::size_t Index) const;
const std::string& GetFilename(std::size_t index) const;
private :
@ -260,14 +260,14 @@ public :
////////////////////////////////////////////////////////////
/// Connect to the specified FTP server
///
/// \param Server : FTP server to connect to
/// \param Port : Port used for connection (21 by default, standard FTP port)
/// \param Timeout : Maximum time to wait, in seconds (0 by default, means no timeout)
/// \param server : FTP server to connect to
/// \param port : Port used for connection (21 by default, standard FTP port)
/// \param timeout : Maximum time to wait, in seconds (0 by default, means no timeout)
///
/// \return Server response to the request
///
////////////////////////////////////////////////////////////
Response Connect(const IPAddress& Server, unsigned short Port = 21, float Timeout = 0.f);
Response Connect(const IPAddress& server, unsigned short port = 21, float timeout = 0.f);
////////////////////////////////////////////////////////////
/// Log in using anonymous account
@ -280,13 +280,13 @@ public :
////////////////////////////////////////////////////////////
/// Log in using a username and a password
///
/// \param UserName : User name
/// \param Password : Password
/// \param name : User name
/// \param password : Password
///
/// \return Server response to the request
///
////////////////////////////////////////////////////////////
Response Login(const std::string& UserName, const std::string& Password);
Response Login(const std::string& name, const std::string& password);
////////////////////////////////////////////////////////////
/// Close the connection with FTP server
@ -316,22 +316,22 @@ public :
/// Get the contents of the given directory
/// (subdirectories and files)
///
/// \param Directory : Directory to list ("" by default, the current one)
/// \param directory : Directory to list ("" by default, the current one)
///
/// \return Server response to the request
///
////////////////////////////////////////////////////////////
ListingResponse GetDirectoryListing(const std::string& Directory = "");
ListingResponse GetDirectoryListing(const std::string& directory = "");
////////////////////////////////////////////////////////////
/// Change the current working directory
///
/// \param Directory : New directory, relative to the current one
/// \param directory : New directory, relative to the current one
///
/// \return Server response to the request
///
////////////////////////////////////////////////////////////
Response ChangeDirectory(const std::string& Directory);
Response ChangeDirectory(const std::string& directory);
////////////////////////////////////////////////////////////
/// Go to the parent directory of the current one
@ -344,12 +344,12 @@ public :
////////////////////////////////////////////////////////////
/// Create a new directory
///
/// \param Name : Name of the directory to create
/// \param name : Name of the directory to create
///
/// \return Server response to the request
///
////////////////////////////////////////////////////////////
Response MakeDirectory(const std::string& Name);
Response MakeDirectory(const std::string& name);
////////////////////////////////////////////////////////////
/// Remove an existing directory
@ -359,65 +359,65 @@ public :
/// \return Server response to the request
///
////////////////////////////////////////////////////////////
Response DeleteDirectory(const std::string& Name);
Response DeleteDirectory(const std::string& name);
////////////////////////////////////////////////////////////
/// Rename a file
///
/// \param File : File to rename
/// \param NewName : New name
/// \param file : File to rename
/// \param newName : New name
///
/// \return Server response to the request
///
////////////////////////////////////////////////////////////
Response RenameFile(const std::string& File, const std::string& NewName);
Response RenameFile(const std::string& file, const std::string& newName);
////////////////////////////////////////////////////////////
/// Remove an existing file
///
/// \param Name : File to remove
/// \param name : File to remove
///
/// \return Server response to the request
///
////////////////////////////////////////////////////////////
Response DeleteFile(const std::string& Name);
Response DeleteFile(const std::string& name);
////////////////////////////////////////////////////////////
/// Download a file from the server
///
/// \param DistantFile : Path of the distant file to download
/// \param DestPath : Where to put to file on the local computer
/// \param Mode : Transfer mode (binary by default)
/// \param distantFile : Path of the distant file to download
/// \param destPath : Where to put to file on the local computer
/// \param mode : Transfer mode (binary by default)
///
/// \return Server response to the request
///
////////////////////////////////////////////////////////////
Response Download(const std::string& DistantFile, const std::string& DestPath, TransferMode Mode = Binary);
Response Download(const std::string& distantFile, const std::string& destPath, TransferMode mode = Binary);
////////////////////////////////////////////////////////////
/// Upload a file to the server
///
/// \param LocalFile : Path of the local file to upload
/// \param DestPath : Where to put to file on the server
/// \param Mode : Transfer mode (binary by default)
/// \param localFile : Path of the local file to upload
/// \param destPath : Where to put to file on the server
/// \param mode : Transfer mode (binary by default)
///
/// \return Server response to the request
///
////////////////////////////////////////////////////////////
Response Upload(const std::string& LocalFile, const std::string& DestPath, TransferMode Mode = Binary);
Response Upload(const std::string& localFile, const std::string& destPath, TransferMode mode = Binary);
private :
////////////////////////////////////////////////////////////
/// Send a command to the FTP server
///
/// \param Command : Command to send
/// \param Parameter : Command parameter ("" by default)
/// \param command : Command to send
/// \param parameter : Command parameter ("" by default)
///
/// \return Server response to the request
///
////////////////////////////////////////////////////////////
Response SendCommand(const std::string& Command, const std::string& Parameter = "");
Response SendCommand(const std::string& command, const std::string& parameter = "");
////////////////////////////////////////////////////////////
/// Receive a response from the server

View file

@ -68,30 +68,30 @@ public :
////////////////////////////////////////////////////////////
/// Default constructor
///
/// \param RequestMethod : Method to use for the request (Get by default)
/// \param URI : Target URI ("/" by default -- index page)
/// \param Body : Content of the request's body (empty by default)
/// \param method : Method to use for the request (Get by default)
/// \param URI : Target URI ("/" by default -- index page)
/// \param body : Content of the request's body (empty by default)
///
////////////////////////////////////////////////////////////
Request(Method RequestMethod = Get, const std::string& URI = "/", const std::string& Body = "");
Request(Method method = Get, const std::string& URI = "/", const std::string& body = "");
////////////////////////////////////////////////////////////
/// Set the value of a field; the field is added if it doesn't exist
///
/// \param Field : Name of the field to set (case-insensitive)
/// \param Value : Value of the field
/// \param field : Name of the field to set (case-insensitive)
/// \param value : Value of the field
///
////////////////////////////////////////////////////////////
void SetField(const std::string& Field, const std::string& Value);
void SetField(const std::string& field, const std::string& value);
////////////////////////////////////////////////////////////
/// Set the request method.
/// This parameter is Http::Request::Get by default
///
/// \param RequestMethod : Method to use for the request
/// \param method : Method to use for the request
///
////////////////////////////////////////////////////////////
void SetMethod(Method RequestMethod);
void SetMethod(Method method);
////////////////////////////////////////////////////////////
/// Set the target URI of the request.
@ -106,21 +106,21 @@ public :
/// Set the HTTP version of the request.
/// This parameter is 1.0 by default
///
/// \param Major : Major version number
/// \param Minor : Minor version number
/// \param major : Major version number
/// \param minor : Minor version number
///
////////////////////////////////////////////////////////////
void SetHttpVersion(unsigned int Major, unsigned int Minor);
void SetHttpVersion(unsigned int major, unsigned int minor);
////////////////////////////////////////////////////////////
/// Set the body of the request. This parameter is optional and
/// makes sense only for POST requests.
/// This parameter is empty by default
///
/// \param Body : Content of the request body
/// \param body : Content of the request body
///
////////////////////////////////////////////////////////////
void SetBody(const std::string& Body);
void SetBody(const std::string& body);
private :
@ -137,12 +137,12 @@ public :
////////////////////////////////////////////////////////////
/// Check if the given field has been defined
///
/// \param Field : Name of the field to check (case-insensitive)
/// \param field : Name of the field to check (case-insensitive)
///
/// \return True if the field exists
///
////////////////////////////////////////////////////////////
bool HasField(const std::string& Field) const;
bool HasField(const std::string& field) const;
////////////////////////////////////////////////////////////
// Types
@ -213,12 +213,12 @@ public :
////////////////////////////////////////////////////////////
/// Get the value of a field
///
/// \param Field : Name of the field to get (case-insensitive)
/// \param field : Name of the field to get (case-insensitive)
///
/// \return Value of the field, or empty string if not found
///
////////////////////////////////////////////////////////////
const std::string& GetField(const std::string& Field) const;
const std::string& GetField(const std::string& field) const;
////////////////////////////////////////////////////////////
/// Get the header's status code
@ -263,10 +263,10 @@ public :
////////////////////////////////////////////////////////////
/// Construct the header from a response string
///
/// \param Data : Content of the response's header to parse
/// \param data : Content of the response's header to parse
///
////////////////////////////////////////////////////////////
void FromString(const std::string& Data);
void FromString(const std::string& data);
////////////////////////////////////////////////////////////
// Types
@ -292,20 +292,20 @@ public :
////////////////////////////////////////////////////////////
/// Construct the Http instance with the target host
///
/// \param Host : Web server to connect to
/// \param Port : Port to use for connection (0 by default -- use the standard port of the protocol used)
/// \param host : Web server to connect to
/// \param port : Port to use for connection (0 by default -- use the standard port of the protocol used)
///
////////////////////////////////////////////////////////////
Http(const std::string& Host, unsigned short Port = 0);
Http(const std::string& host, unsigned short port = 0);
////////////////////////////////////////////////////////////
/// Set the target host
///
/// \param Host : Web server to connect to
/// \param Port : Port to use for connection (0 by default -- use the standard port of the protocol used)
/// \param host : Web server to connect to
/// \param port : Port to use for connection (0 by default -- use the standard port of the protocol used)
///
////////////////////////////////////////////////////////////
void SetHost(const std::string& Host, unsigned short Port = 0);
void SetHost(const std::string& host, unsigned short port = 0);
////////////////////////////////////////////////////////////
/// Send a HTTP request and return the server's response.
@ -315,13 +315,13 @@ public :
/// not return instantly; use a thread if you don't want to block your
/// application.
///
/// \param Req : Request to send
/// \param Timeout : Maximum time to wait, in seconds (0 by default, means no timeout)
/// \param request : Request to send
/// \param timeout : Maximum time to wait, in seconds (0 by default, means no timeout)
///
/// \return Server's response
///
////////////////////////////////////////////////////////////
Response SendRequest(const Request& Req, float Timeout = 0.f);
Response SendRequest(const Request& request, float timeout = 0.f);
private :

View file

@ -52,38 +52,38 @@ public :
////////////////////////////////////////////////////////////
/// Construct the address from a string
///
/// \param Address : IP address ("xxx.xxx.xxx.xxx") or network name
/// \param address : IP address ("xxx.xxx.xxx.xxx") or network name
///
////////////////////////////////////////////////////////////
IPAddress(const std::string& Address);
IPAddress(const std::string& address);
////////////////////////////////////////////////////////////
/// Construct the address from a C-style string ;
/// Needed for implicit conversions from literal strings to IPAddress to work
///
/// \param Address : IP address ("xxx.xxx.xxx.xxx") or network name
/// \param address : IP address ("xxx.xxx.xxx.xxx") or network name
///
////////////////////////////////////////////////////////////
IPAddress(const char* Address);
IPAddress(const char* address);
////////////////////////////////////////////////////////////
/// Construct the address from 4 bytes
///
/// \param Byte0 : First byte of the address
/// \param Byte1 : Second byte of the address
/// \param Byte2 : Third byte of the address
/// \param Byte3 : Fourth byte of the address
/// \param byte0 : First byte of the address
/// \param byte1 : Second byte of the address
/// \param byte2 : Third byte of the address
/// \param byte3 : Fourth byte of the address
///
////////////////////////////////////////////////////////////
IPAddress(Uint8 Byte0, Uint8 Byte1, Uint8 Byte2, Uint8 Byte3);
IPAddress(Uint8 byte0, Uint8 byte1, Uint8 byte2, Uint8 byte3);
////////////////////////////////////////////////////////////
/// Construct the address from a 32-bits integer
///
/// \param Address : 4 bytes of the address packed into a 32-bits integer
/// \param address : 4 bytes of the address packed into a 32-bits integer
///
////////////////////////////////////////////////////////////
IPAddress(Uint32 Address);
IPAddress(Uint32 address);
////////////////////////////////////////////////////////////
/// Tell if the address is a valid one
@ -123,72 +123,72 @@ public :
/// distant website ; as a consequence, this function may be
/// very slow -- use it as few as possible !
///
/// \param Timeout : Maximum time to wait, in seconds (0 by default : no timeout)
/// \param timeout : Maximum time to wait, in seconds (0 by default : no timeout)
///
/// \return Public IP address
///
////////////////////////////////////////////////////////////
static IPAddress GetPublicAddress(float Timeout = 0.f);
static IPAddress GetPublicAddress(float timeout = 0.f);
////////////////////////////////////////////////////////////
/// Comparison operator ==
///
/// \param Other : Address to compare
/// \param other : Address to compare
///
/// \return True if *this == Other
/// \return True if *this == other
///
////////////////////////////////////////////////////////////
bool operator ==(const IPAddress& Other) const;
bool operator ==(const IPAddress& other) const;
////////////////////////////////////////////////////////////
/// Comparison operator !=
///
/// \param Other : Address to compare
/// \param other : Address to compare
///
/// \return True if *this != Other
/// \return True if *this != other
///
////////////////////////////////////////////////////////////
bool operator !=(const IPAddress& Other) const;
bool operator !=(const IPAddress& other) const;
////////////////////////////////////////////////////////////
/// Comparison operator <
///
/// \param Other : Address to compare
/// \param other : Address to compare
///
/// \return True if *this < Other
/// \return True if *this < other
///
////////////////////////////////////////////////////////////
bool operator <(const IPAddress& Other) const;
bool operator <(const IPAddress& other) const;
////////////////////////////////////////////////////////////
/// Comparison operator >
///
/// \param Other : Address to compare
/// \param other : Address to compare
///
/// \return True if *this > Other
/// \return True if *this > other
///
////////////////////////////////////////////////////////////
bool operator >(const IPAddress& Other) const;
bool operator >(const IPAddress& other) const;
////////////////////////////////////////////////////////////
/// Comparison operator <=
///
/// \param Other : Address to compare
/// \param other : Address to compare
///
/// \return True if *this <= Other
/// \return True if *this <= other
///
////////////////////////////////////////////////////////////
bool operator <=(const IPAddress& Other) const;
bool operator <=(const IPAddress& other) const;
////////////////////////////////////////////////////////////
/// Comparison operator >=
///
/// \param Other : Address to compare
/// \param other : Address to compare
///
/// \return True if *this >= Other
/// \return True if *this >= other
///
////////////////////////////////////////////////////////////
bool operator >=(const IPAddress& Other) const;
bool operator >=(const IPAddress& other) const;
////////////////////////////////////////////////////////////
// Static member data
@ -212,7 +212,7 @@ private :
/// \return Reference to the input stream
///
////////////////////////////////////////////////////////////
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
@ -223,7 +223,7 @@ SFML_API std::istream& operator >>(std::istream& Stream, IPAddress& Address);
/// \return Reference to the output stream
///
////////////////////////////////////////////////////////////
SFML_API std::ostream& operator <<(std::ostream& Stream, const IPAddress& Address);
SFML_API std::ostream& operator <<(std::ostream& stream, const IPAddress& address);
} // namespace sf

View file

@ -57,11 +57,11 @@ public :
////////////////////////////////////////////////////////////
/// Append data to the end of the packet
///
/// \param Data : Pointer to the bytes to append
/// \param SizeInBytes : Number of bytes to append
/// \param data : Pointer to the bytes to append
/// \param sizeInBytes : Number of bytes to append
///
////////////////////////////////////////////////////////////
void Append(const void* Data, std::size_t SizeInBytes);
void Append(const void* data, std::size_t sizeInBytes);
////////////////////////////////////////////////////////////
/// Clear the packet data
@ -107,37 +107,37 @@ public :
/// Operator >> overloads to extract data from the packet
///
////////////////////////////////////////////////////////////
Packet& operator >>(bool& Data);
Packet& operator >>(Int8& Data);
Packet& operator >>(Uint8& Data);
Packet& operator >>(Int16& Data);
Packet& operator >>(Uint16& Data);
Packet& operator >>(Int32& Data);
Packet& operator >>(Uint32& Data);
Packet& operator >>(float& Data);
Packet& operator >>(double& Data);
Packet& operator >>(char* Data);
Packet& operator >>(std::string& Data);
Packet& operator >>(wchar_t* Data);
Packet& operator >>(std::wstring& Data);
Packet& operator >>(bool& data);
Packet& operator >>(Int8& data);
Packet& operator >>(Uint8& data);
Packet& operator >>(Int16& data);
Packet& operator >>(Uint16& data);
Packet& operator >>(Int32& data);
Packet& operator >>(Uint32& data);
Packet& operator >>(float& data);
Packet& operator >>(double& data);
Packet& operator >>(char* data);
Packet& operator >>(std::string& data);
Packet& operator >>(wchar_t* data);
Packet& operator >>(std::wstring& data);
////////////////////////////////////////////////////////////
/// Operator << overloads to put data into the packet
///
////////////////////////////////////////////////////////////
Packet& operator <<(bool Data);
Packet& operator <<(Int8 Data);
Packet& operator <<(Uint8 Data);
Packet& operator <<(Int16 Data);
Packet& operator <<(Uint16 Data);
Packet& operator <<(Int32 Data);
Packet& operator <<(Uint32 Data);
Packet& operator <<(float Data);
Packet& operator <<(double Data);
Packet& operator <<(const char* Data);
Packet& operator <<(const std::string& Data);
Packet& operator <<(const wchar_t* Data);
Packet& operator <<(const std::wstring& Data);
Packet& operator <<(bool data);
Packet& operator <<(Int8 data);
Packet& operator <<(Uint8 data);
Packet& operator <<(Int16 data);
Packet& operator <<(Uint16 data);
Packet& operator <<(Int32 data);
Packet& operator <<(Uint32 data);
Packet& operator <<(float data);
Packet& operator <<(double data);
Packet& operator <<(const char* data);
Packet& operator <<(const std::string& data);
Packet& operator <<(const wchar_t* data);
Packet& operator <<(const std::wstring& data);
private :
@ -147,31 +147,31 @@ private :
////////////////////////////////////////////////////////////
/// Check if the packet can extract a given size of bytes
///
/// \param Size : Size to check
/// \param size : Size to check
///
/// \return True if Size bytes can be read from the packet's data
///
////////////////////////////////////////////////////////////
bool CheckSize(std::size_t Size);
bool CheckSize(std::size_t size);
////////////////////////////////////////////////////////////
/// Called before the packet is sent to the network
///
/// \param DataSize : Variable to fill with the size of data to send
/// \param dataSize : Variable to fill with the size of data to send
///
/// \return Pointer to the array of bytes to send
///
////////////////////////////////////////////////////////////
virtual const char* OnSend(std::size_t& DataSize);
virtual const char* OnSend(std::size_t& dataSize);
////////////////////////////////////////////////////////////
/// Called after the packet has been received from the network
///
/// \param Data : Pointer to the array of received bytes
/// \param DataSize : Size of the array of bytes
/// \param data : Pointer to the array of received bytes
/// \param dataSize : Size of the array of bytes
///
////////////////////////////////////////////////////////////
virtual void OnReceive(const char* Data, std::size_t DataSize);
virtual void OnReceive(const char* data, std::size_t dataSize);
////////////////////////////////////////////////////////////
// Member data

View file

@ -48,18 +48,18 @@ public :
////////////////////////////////////////////////////////////
/// Add a socket to watch
///
/// \param Socket : Socket to add
/// \param socket : Socket to add
///
////////////////////////////////////////////////////////////
void Add(Type Socket);
void Add(Type socket);
////////////////////////////////////////////////////////////
/// Remove a socket
///
/// \param Socket : Socket to remove
/// \param socket : Socket to remove
///
////////////////////////////////////////////////////////////
void Remove(Type Socket);
void Remove(Type socket);
////////////////////////////////////////////////////////////
/// Remove all sockets
@ -72,24 +72,24 @@ public :
/// This functions will return either when at least one socket
/// is ready, or when the given time is out
///
/// \param Timeout : Timeout, in seconds (0 by default : no timeout)
/// \param timeout : Timeout, in seconds (0 by default : no timeout)
///
/// \return Number of sockets ready to be read
///
////////////////////////////////////////////////////////////
unsigned int Wait(float Timeout = 0.f);
unsigned int Wait(float timeout = 0.f);
////////////////////////////////////////////////////////////
/// After a call to Wait(), get the Index-th socket which is
/// ready for reading. The total number of sockets ready
/// is the integer returned by the previous call to Wait()
///
/// \param Index : Index of the socket to get
/// \param index : Index of the socket to get
///
/// \return The Index-th socket
/// \return The index-th socket
///
////////////////////////////////////////////////////////////
Type GetSocketReady(unsigned int Index);
Type GetSocketReady(unsigned int index);
private :

View file

@ -27,12 +27,12 @@
/// Add a socket to watch
////////////////////////////////////////////////////////////
template <typename Type>
void Selector<Type>::Add(Type Socket)
void Selector<Type>::Add(Type socket)
{
if (Socket.IsValid())
if (socket.IsValid())
{
SelectorBase::Add(Socket.mySocket);
mySockets[Socket.mySocket] = Socket;
SelectorBase::Add(socket.mySocket);
mySockets[socket.mySocket] = socket;
}
}
@ -41,13 +41,13 @@ void Selector<Type>::Add(Type Socket)
/// Remove a socket
////////////////////////////////////////////////////////////
template <typename Type>
void Selector<Type>::Remove(Type Socket)
void Selector<Type>::Remove(Type socket)
{
typename SocketTable::iterator It = mySockets.find(Socket.mySocket);
if (It != mySockets.end())
typename SocketTable::iterator it = mySockets.find(socket.mySocket);
if (it != mySockets.end())
{
SelectorBase::Remove(Socket.mySocket);
mySockets.erase(It);
SelectorBase::Remove(socket.mySocket);
mySockets.erase(it);
}
}
@ -69,13 +69,13 @@ void Selector<Type>::Clear()
/// is ready, or when the given time is out
////////////////////////////////////////////////////////////
template <typename Type>
unsigned int Selector<Type>::Wait(float Timeout)
unsigned int Selector<Type>::Wait(float timeout)
{
// No socket in the selector : return 0
if (mySockets.empty())
return 0;
return SelectorBase::Wait(Timeout);
return SelectorBase::Wait(timeout);
}
@ -85,13 +85,13 @@ unsigned int Selector<Type>::Wait(float Timeout)
/// is the integer returned by the previous call to Wait()
////////////////////////////////////////////////////////////
template <typename Type>
Type Selector<Type>::GetSocketReady(unsigned int Index)
Type Selector<Type>::GetSocketReady(unsigned int index)
{
SocketHelper::SocketType Socket = SelectorBase::GetSocketReady(Index);
SocketHelper::SocketType socket = SelectorBase::GetSocketReady(index);
typename SocketTable::const_iterator It = mySockets.find(Socket);
if (It != mySockets.end())
return It->second;
typename SocketTable::const_iterator it = mySockets.find(socket);
if (it != mySockets.end())
return it->second;
else
return Type(Socket);
return Type(socket);
}

View file

@ -53,18 +53,18 @@ public :
////////////////////////////////////////////////////////////
/// Add a socket to watch
///
/// \param Socket : Socket to add
/// \param socket : Socket to add
///
////////////////////////////////////////////////////////////
void Add(SocketHelper::SocketType Socket);
void Add(SocketHelper::SocketType socket);
////////////////////////////////////////////////////////////
/// Remove a socket
///
/// \param Socket : Socket to remove
/// \param socket : Socket to remove
///
////////////////////////////////////////////////////////////
void Remove(SocketHelper::SocketType Socket);
void Remove(SocketHelper::SocketType socket);
////////////////////////////////////////////////////////////
/// Remove all sockets
@ -77,24 +77,24 @@ public :
/// This functions will return either when at least one socket
/// is ready, or when the given time is out
///
/// \param Timeout : Timeout, in seconds (0 by default : no timeout)
/// \param timeout : Timeout, in seconds (0 by default : no timeout)
///
/// \return Number of sockets ready to be read
///
////////////////////////////////////////////////////////////
unsigned int Wait(float Timeout = 0.f);
unsigned int Wait(float timeout = 0.f);
////////////////////////////////////////////////////////////
/// After a call to Wait(), get the Index-th socket which is
/// ready for reading. The total number of sockets ready
/// is the integer returned by the previous call to Wait()
///
/// \param Index : Index of the socket to get
/// \param index : Index of the socket to get
///
/// \return The Index-th socket
/// \return The index-th socket
///
////////////////////////////////////////////////////////////
SocketHelper::SocketType GetSocketReady(unsigned int Index);
SocketHelper::SocketType GetSocketReady(unsigned int index);
private :

View file

@ -56,89 +56,89 @@ public :
/// Change the blocking state of the socket.
/// The default behaviour of a socket is blocking
///
/// \param Blocking : Pass true to set the socket as blocking, or false for non-blocking
/// \param blocking : Pass true to set the socket as blocking, or false for non-blocking
///
////////////////////////////////////////////////////////////
void SetBlocking(bool Blocking);
void SetBlocking(bool blocking);
////////////////////////////////////////////////////////////
/// Connect to another computer on a specified port
///
/// \param Port : Port to use for transfers (warning : ports < 1024 are reserved)
/// \param HostAddress : IP Address of the host to connect to
/// \param Timeout : Maximum time to wait, in seconds (0 by default : no timeout) (this parameter is ignored for non-blocking sockets)
/// \param port : Port to use for transfers (warning : ports < 1024 are reserved)
/// \param host : IP Address of the host to connect to
/// \param timeout : Maximum time to wait, in seconds (0 by default : no timeout) (this parameter is ignored for non-blocking sockets)
///
/// \return True if operation has been successful
///
////////////////////////////////////////////////////////////
Socket::Status Connect(unsigned short Port, const IPAddress& HostAddress, float Timeout = 0.f);
Socket::Status Connect(unsigned short port, const IPAddress& host, float timeout = 0.f);
////////////////////////////////////////////////////////////
/// Listen to a specified port for incoming data or connections
///
/// \param Port : Port to listen to
/// \param port : Port to listen to
///
/// \return True if operation has been successful
///
////////////////////////////////////////////////////////////
bool Listen(unsigned short Port);
bool Listen(unsigned short port);
////////////////////////////////////////////////////////////
/// Wait for a connection (must be listening to a port).
/// This function will block if the socket is blocking
///
/// \param Connected : Socket containing the connection with the connected client
/// \param Address : Pointer to an address to fill with client infos (NULL by default)
/// \param connected : Socket containing the connection with the connected client
/// \param address : Pointer to an address to fill with client infos (NULL by default)
///
/// \return Status code
///
////////////////////////////////////////////////////////////
Socket::Status Accept(SocketTCP& Connected, IPAddress* Address = NULL);
Socket::Status Accept(SocketTCP& connected, IPAddress* address = NULL);
////////////////////////////////////////////////////////////
/// Send an array of bytes to the host (must be connected first)
///
/// \param Data : Pointer to the bytes to send
/// \param Size : Number of bytes to send
/// \param data : Pointer to the bytes to send
/// \param size : Number of bytes to send
///
/// \return Status code
///
////////////////////////////////////////////////////////////
Socket::Status Send(const char* Data, std::size_t Size);
Socket::Status Send(const char* data, std::size_t size);
////////////////////////////////////////////////////////////
/// Receive an array of bytes from the host (must be connected first).
/// This function will block if the socket is blocking
///
/// \param Data : Pointer to a byte array to fill (make sure it is big enough)
/// \param MaxSize : Maximum number of bytes to read
/// \param SizeReceived : Number of bytes received
/// \param data : Pointer to a byte array to fill (make sure it is big enough)
/// \param maxSize : Maximum number of bytes to read
/// \param sizeReceived : Number of bytes received
///
/// \return Status code
///
////////////////////////////////////////////////////////////
Socket::Status Receive(char* Data, std::size_t MaxSize, std::size_t& SizeReceived);
Socket::Status Receive(char* data, std::size_t maxSize, std::size_t& sizeReceived);
////////////////////////////////////////////////////////////
/// Send a packet of data to the host (must be connected first)
///
/// \param PacketToSend : Packet to send
/// \param packet : Packet to send
///
/// \return Status code
///
////////////////////////////////////////////////////////////
Socket::Status Send(Packet& PacketToSend);
Socket::Status Send(Packet& packet);
////////////////////////////////////////////////////////////
/// Receive a packet from the host (must be connected first).
/// This function will block if the socket is blocking
///
/// \param PacketToReceive : Packet to fill with received data
/// \param packet : Packet to fill with received data
///
/// \return Status code
///
////////////////////////////////////////////////////////////
Socket::Status Receive(Packet& PacketToReceive);
Socket::Status Receive(Packet& packet);
////////////////////////////////////////////////////////////
/// Close the socket
@ -160,34 +160,34 @@ public :
////////////////////////////////////////////////////////////
/// Comparison operator ==
///
/// \param Other : Socket to compare
/// \param other : Socket to compare
///
/// \return True if *this == Other
/// \return True if *this == other
///
////////////////////////////////////////////////////////////
bool operator ==(const SocketTCP& Other) const;
bool operator ==(const SocketTCP& other) const;
////////////////////////////////////////////////////////////
/// Comparison operator !=
///
/// \param Other : Socket to compare
/// \param other : Socket to compare
///
/// \return True if *this != Other
/// \return True if *this != other
///
////////////////////////////////////////////////////////////
bool operator !=(const SocketTCP& Other) const;
bool operator !=(const SocketTCP& other) const;
////////////////////////////////////////////////////////////
/// Comparison operator <.
/// Provided for compatibility with standard containers, as
/// comparing two sockets doesn't make much sense...
///
/// \param Other : Socket to compare
/// \param other : Socket to compare
///
/// \return True if *this < Other
/// \return True if *this < other
///
////////////////////////////////////////////////////////////
bool operator <(const SocketTCP& Other) const;
bool operator <(const SocketTCP& other) const;
private :
@ -197,18 +197,18 @@ private :
/// Construct the socket from a socket descriptor
/// (for internal use only)
///
/// \param Descriptor : Socket descriptor
/// \param descriptor : Socket descriptor
///
////////////////////////////////////////////////////////////
SocketTCP(SocketHelper::SocketType Descriptor);
SocketTCP(SocketHelper::SocketType descriptor);
////////////////////////////////////////////////////////////
/// Create the socket
///
/// \param Descriptor : System socket descriptor to use (0 by default -- create a new socket)
/// \param descriptor : System socket descriptor to use (0 by default -- create a new socket)
///
////////////////////////////////////////////////////////////
void Create(SocketHelper::SocketType Descriptor = 0);
void Create(SocketHelper::SocketType descriptor = 0);
////////////////////////////////////////////////////////////
// Member data

View file

@ -56,20 +56,20 @@ public :
/// Change the blocking state of the socket.
/// The default behaviour of a socket is blocking
///
/// \param Blocking : Pass true to set the socket as blocking, or false for non-blocking
/// \param blocking : Pass true to set the socket as blocking, or false for non-blocking
///
////////////////////////////////////////////////////////////
void SetBlocking(bool Blocking);
void SetBlocking(bool blocking);
////////////////////////////////////////////////////////////
/// Bind the socket to a specific port
///
/// \param Port : Port to bind the socket to
/// \param port : Port to bind the socket to
///
/// \return True if operation has been successful
///
////////////////////////////////////////////////////////////
bool Bind(unsigned short Port);
bool Bind(unsigned short port);
////////////////////////////////////////////////////////////
/// Unbind the socket from its previous port, if any
@ -82,55 +82,55 @@ public :
////////////////////////////////////////////////////////////
/// Send an array of bytes
///
/// \param Data : Pointer to the bytes to send
/// \param Size : Number of bytes to send
/// \param Address : Address of the computer to send the packet to
/// \param Port : Port to send the data to
/// \param data : Pointer to the bytes to send
/// \param size : Number of bytes to send
/// \param address : Address of the computer to send the packet to
/// \param port : Port to send the data to
///
/// \return Status code
///
////////////////////////////////////////////////////////////
Socket::Status Send(const char* Data, std::size_t Size, const IPAddress& Address, unsigned short Port);
Socket::Status Send(const char* data, std::size_t size, const IPAddress& address, unsigned short port);
////////////////////////////////////////////////////////////
/// Receive an array of bytes.
/// This function will block if the socket is blocking
///
/// \param Data : Pointer to a byte array to fill (make sure it is big enough)
/// \param MaxSize : Maximum number of bytes to read
/// \param SizeReceived : Number of bytes received
/// \param Address : Address of the computer which sent the data
/// \param Port : Port on which the remote computer sent the data
/// \param data : Pointer to a byte array to fill (make sure it is big enough)
/// \param maxSize : Maximum number of bytes to read
/// \param sizeReceived : Number of bytes received
/// \param address : Address of the computer which sent the data
/// \param port : Port on which the remote computer sent the data
///
/// \return Status code
///
////////////////////////////////////////////////////////////
Socket::Status Receive(char* Data, std::size_t MaxSize, std::size_t& SizeReceived, IPAddress& Address, unsigned short& Port);
Socket::Status Receive(char* data, std::size_t maxSize, std::size_t& sizeReceived, IPAddress& address, unsigned short& port);
////////////////////////////////////////////////////////////
/// Send a packet of data
///
/// \param PacketToSend : Packet to send
/// \param Address : Address of the computer to send the packet to
/// \param Port : Port to send the data to
/// \param packet : Packet to send
/// \param address : Address of the computer to send the packet to
/// \param port : Port to send the data to
///
/// \return Status code
///
////////////////////////////////////////////////////////////
Socket::Status Send(Packet& PacketToSend, const IPAddress& Address, unsigned short Port);
Socket::Status Send(Packet& packet, const IPAddress& address, unsigned short port);
////////////////////////////////////////////////////////////
/// Receive a packet.
/// This function will block if the socket is blocking
///
/// \param PacketToReceive : Packet to fill with received data
/// \param Address : Address of the computer which sent the packet
/// \param Port : Port on which the remote computer sent the data
/// \param packet : Packet to fill with received data
/// \param Address : Address of the computer which sent the packet
/// \param Port : Port on which the remote computer sent the data
///
/// \return Status code
///
////////////////////////////////////////////////////////////
Socket::Status Receive(Packet& PacketToReceive, IPAddress& Address, unsigned short& Port);
Socket::Status Receive(Packet& packet, IPAddress& address, unsigned short& port);
////////////////////////////////////////////////////////////
/// Close the socket
@ -160,34 +160,34 @@ public :
////////////////////////////////////////////////////////////
/// Comparison operator ==
///
/// \param Other : Socket to compare
/// \param other : Socket to compare
///
/// \return True if *this == Other
/// \return True if *this == other
///
////////////////////////////////////////////////////////////
bool operator ==(const SocketUDP& Other) const;
bool operator ==(const SocketUDP& other) const;
////////////////////////////////////////////////////////////
/// Comparison operator !=
///
/// \param Other : Socket to compare
/// \param other : Socket to compare
///
/// \return True if *this != Other
/// \return True if *this != other
///
////////////////////////////////////////////////////////////
bool operator !=(const SocketUDP& Other) const;
bool operator !=(const SocketUDP& other) const;
////////////////////////////////////////////////////////////
/// Comparison operator <.
/// Provided for compatibility with standard containers, as
/// comparing two sockets doesn't make much sense...
///
/// \param Other : Socket to compare
/// \param other : Socket to compare
///
/// \return True if *this < Other
/// \return True if *this < other
///
////////////////////////////////////////////////////////////
bool operator <(const SocketUDP& Other) const;
bool operator <(const SocketUDP& other) const;
private :
@ -197,18 +197,18 @@ private :
/// Construct the socket from a socket descriptor
/// (for internal use only)
///
/// \param Descriptor : Socket descriptor
/// \param descriptor : Socket descriptor
///
////////////////////////////////////////////////////////////
SocketUDP(SocketHelper::SocketType Descriptor);
SocketUDP(SocketHelper::SocketType descriptor);
////////////////////////////////////////////////////////////
/// Create the socket
///
/// \param Descriptor : System socket descriptor to use (0 by default -- create a new socket)
/// \param descriptor : System socket descriptor to use (0 by default -- create a new socket)
///
////////////////////////////////////////////////////////////
void Create(SocketHelper::SocketType Descriptor = 0);
void Create(SocketHelper::SocketType descriptor = 0);
////////////////////////////////////////////////////////////
// Member data

View file

@ -59,21 +59,21 @@ public :
////////////////////////////////////////////////////////////
/// Close / destroy a socket
///
/// \param Socket : Socket to close
/// \param socket : Socket to close
///
/// \return True on success
///
////////////////////////////////////////////////////////////
static bool Close(SocketType Socket);
static bool Close(SocketType socket);
////////////////////////////////////////////////////////////
/// Set a socket as blocking or non-blocking
///
/// \param Socket : Socket to modify
/// \param Block : New blocking state of the socket
/// \param socket : Socket to modify
/// \param block : New blocking state of the socket
///
////////////////////////////////////////////////////////////
static void SetBlocking(SocketType Socket, bool Block);
static void SetBlocking(SocketType socket, bool block);
////////////////////////////////////////////////////////////
/// Get the last socket error status