Documentation of SFML 1.6

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-2009 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/Config.hpp>
32 #include <istream>
33 #include <ostream>
34 #include <string>
35 
36 
37 namespace sf
38 {
42 class SFML_API IPAddress
43 {
44 public :
45 
50  IPAddress();
51 
58  IPAddress(const std::string& Address);
59 
67  IPAddress(const char* Address);
68 
78  IPAddress(Uint8 Byte0, Uint8 Byte1, Uint8 Byte2, Uint8 Byte3);
79 
86  IPAddress(Uint32 Address);
87 
94  bool IsValid() const;
95 
102  std::string ToString() const;
103 
110  Uint32 ToInteger() const;
111 
118  static IPAddress GetLocalAddress();
119 
131  static IPAddress GetPublicAddress(float Timeout = 0.f);
132 
141  bool operator ==(const IPAddress& Other) const;
142 
151  bool operator !=(const IPAddress& Other) const;
152 
161  bool operator <(const IPAddress& Other) const;
162 
171  bool operator >(const IPAddress& Other) const;
172 
181  bool operator <=(const IPAddress& Other) const;
182 
191  bool operator >=(const IPAddress& Other) const;
192 
194  // Static member data
196  static const IPAddress LocalHost;
197 
198 private :
199 
201  // Member data
203  Uint32 myAddress;
204 };
205 
215 SFML_API std::istream& operator >>(std::istream& Stream, IPAddress& Address);
216 
226 SFML_API std::ostream& operator <<(std::ostream& Stream, const IPAddress& Address);
227 
228 } // namespace sf
229 
230 
231 #endif // SFML_IPADDRESS_HPP