Documentation of SFML 2.0

Warning: this page refers to an old version of SFML. Click here to switch to the latest version.
IpAddress.hpp
1 
2 //
3 // SFML - Simple and Fast Multimedia Library
4 // Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com)
5 //
6 // This software is provided 'as-is', without any express or implied warranty.
7 // In no event will the authors be held liable for any damages arising from the use of this software.
8 //
9 // Permission is granted to anyone to use this software for any purpose,
10 // including commercial applications, and to alter it and redistribute it freely,
11 // subject to the following restrictions:
12 //
13 // 1. The origin of this software must not be misrepresented;
14 // you must not claim that you wrote the original software.
15 // If you use this software in a product, an acknowledgment
16 // in the product documentation would be appreciated but is not required.
17 //
18 // 2. Altered source versions must be plainly marked as such,
19 // and must not be misrepresented as being the original software.
20 //
21 // 3. This notice may not be removed or altered from any source distribution.
22 //
24 
25 #ifndef SFML_IPADDRESS_HPP
26 #define SFML_IPADDRESS_HPP
27 
29 // Headers
31 #include <SFML/Network/Export.hpp>
32 #include <SFML/System/Time.hpp>
33 #include <istream>
34 #include <ostream>
35 #include <string>
36 
37 
38 namespace sf
39 {
44 class SFML_NETWORK_API IpAddress
45 {
46 public :
47 
54  IpAddress();
55 
65  IpAddress(const std::string& address);
66 
79  IpAddress(const char* address);
80 
94  IpAddress(Uint8 byte0, Uint8 byte1, Uint8 byte2, Uint8 byte3);
95 
109  explicit IpAddress(Uint32 address);
110 
123  std::string toString() const;
124 
139  Uint32 toInteger() const;
140 
155  static IpAddress getLocalAddress();
156 
179  static IpAddress getPublicAddress(Time timeout = Time::Zero);
180 
182  // Static member data
184  static const IpAddress None;
185  static const IpAddress LocalHost;
186  static const IpAddress Broadcast;
187 
188 private :
189 
191  // Member data
193  Uint32 m_address;
194 };
195 
205 SFML_NETWORK_API bool operator ==(const IpAddress& left, const IpAddress& right);
206 
216 SFML_NETWORK_API bool operator !=(const IpAddress& left, const IpAddress& right);
217 
227 SFML_NETWORK_API bool operator <(const IpAddress& left, const IpAddress& right);
228 
238 SFML_NETWORK_API bool operator >(const IpAddress& left, const IpAddress& right);
239 
249 SFML_NETWORK_API bool operator <=(const IpAddress& left, const IpAddress& right);
250 
260 SFML_NETWORK_API bool operator >=(const IpAddress& left, const IpAddress& right);
261 
271 SFML_NETWORK_API std::istream& operator >>(std::istream& stream, IpAddress& address);
272 
282 SFML_NETWORK_API std::ostream& operator <<(std::ostream& stream, const IpAddress& address);
283 
284 } // namespace sf
285 
286 
287 #endif // SFML_IPADDRESS_HPP
288 
289