SFML logo
  • Main Page
  • Modules
  • Classes
  • Files
  • File List

IpAddress.hpp

00001 
00002 //
00003 // SFML - Simple and Fast Multimedia Library
00004 // Copyright (C) 2007-2009 Laurent Gomila (laurent.gom@gmail.com)
00005 //
00006 // This software is provided 'as-is', without any express or implied warranty.
00007 // In no event will the authors be held liable for any damages arising from the use of this software.
00008 //
00009 // Permission is granted to anyone to use this software for any purpose,
00010 // including commercial applications, and to alter it and redistribute it freely,
00011 // subject to the following restrictions:
00012 //
00013 // 1. The origin of this software must not be misrepresented;
00014 //    you must not claim that you wrote the original software.
00015 //    If you use this software in a product, an acknowledgment
00016 //    in the product documentation would be appreciated but is not required.
00017 //
00018 // 2. Altered source versions must be plainly marked as such,
00019 //    and must not be misrepresented as being the original software.
00020 //
00021 // 3. This notice may not be removed or altered from any source distribution.
00022 //
00024 
00025 #ifndef SFML_IPADDRESS_HPP
00026 #define SFML_IPADDRESS_HPP
00027 
00029 // Headers
00031 #include <SFML/Config.hpp>
00032 #include <istream>
00033 #include <ostream>
00034 #include <string>
00035 
00036 
00037 namespace sf
00038 {
00043 class SFML_API IpAddress
00044 {
00045 public :
00046 
00053     IpAddress();
00054 
00064     IpAddress(const std::string& address);
00065 
00078     IpAddress(const char* address);
00079 
00093     IpAddress(Uint8 byte0, Uint8 byte1, Uint8 byte2, Uint8 byte3);
00094 
00108     explicit IpAddress(Uint32 address);
00109 
00122     std::string ToString() const;
00123 
00138     Uint32 ToInteger() const;
00139 
00154     static IpAddress GetLocalAddress();
00155 
00178     static IpAddress GetPublicAddress(Uint32 timeout = 0);
00179 
00181     // Static member data
00183     static const IpAddress None;      
00184     static const IpAddress LocalHost; 
00185 
00186 private :
00187 
00189     // Member data
00191     Uint32 myAddress; 
00192 };
00193 
00203 SFML_API bool operator ==(const IpAddress& left, const IpAddress& right);
00204 
00214 SFML_API bool operator !=(const IpAddress& left, const IpAddress& right);
00215 
00225 SFML_API bool operator <(const IpAddress& left, const IpAddress& right);
00226 
00236 SFML_API bool operator >(const IpAddress& left, const IpAddress& right);
00237 
00247 SFML_API bool operator <=(const IpAddress& left, const IpAddress& right);
00248 
00258 SFML_API bool operator >=(const IpAddress& left, const IpAddress& right);
00259 
00269 SFML_API std::istream& operator >>(std::istream& stream, IpAddress& address);
00270 
00280 SFML_API std::ostream& operator <<(std::ostream& stream, const IpAddress& address);
00281 
00282 } // namespace sf
00283 
00284 
00285 #endif // SFML_IPADDRESS_HPP
00286 
00287 

 ::  Copyright © 2007-2008 Laurent Gomila, all rights reserved  ::  Documentation generated by doxygen 1.5.2  ::