xtd - Reference Guide  0.2.0
Modern c++17/20 framework to create console, GUI and unit test applications on Windows, macOS, Linux, iOS and android.
ip_end_point.h
Go to the documentation of this file.
1 #pragma once
5 
6 #include "end_point.h"
7 #include "ip_address.h"
8 
10 namespace xtd {
12  namespace net {
20  class core_export_ ip_end_point : public xtd::net::end_point {
21  public:
23  static constexpr const uint16_t min_port = 0x0000;
25  static constexpr const uint16_t max_port = 0xFFFF;
26 
30  ip_end_point(uint32_t address, uint16_t port);
31 
35  ip_end_point(const xtd::net::ip_address& address, uint16_t port);
36 
38  ip_end_point() = default;
39  ip_end_point(ip_end_point&&) = default;
40  ip_end_point(const ip_end_point&) = default;
41  ip_end_point& operator=(const ip_end_point&) = default;
42  friend std::ostream& operator <<(std::ostream& os, const ip_end_point& end_point) noexcept {return os << end_point.to_string();}
44 
47  const xtd::net::ip_address& address() const noexcept;
51  ip_end_point& address(const xtd::net::ip_address& value);
52 
55  uint16_t port() const noexcept;
58  ip_end_point& port(uint16_t value);
59 
64  std::unique_ptr<end_point> create(const xtd::net::socket_address& socket_address) const override;
65 
68  xtd::net::socket_address serialize() const override;
69 
72  xtd::ustring to_string() const noexcept override;
73 
74  private:
75  xtd::net::ip_address address_;
76  uint16_t port_ = 0;
77  };
78  }
79 }
Provides an Internet Protocol (IP) address.
Definition: ip_address.h:30
Identifies a network address. This is an abstract class.
Definition: end_point.h:24
The xtd namespace contains all fundamental classes to access Hardware, Os, System, and more.
Definition: system_report.h:17
Represents a network endpoint as an IP address and a port number.
Definition: ip_end_point.h:20
Contains xtd::net::end_point class.
Represents text as a sequence of UTF-8 code units.
Definition: ustring.h:48
Stores serialized information from end_point derived classes.
Definition: socket_address.h:28
Contains xtd::net::ip_address class.
ustring to_string() const noexcept override
Returns a string that represents the current object.
std::string to_string(const value_t &value, const std::string &fmt, const std::locale &loc)
Convert a specified value into a string with specified format and locale.
Definition: to_string.h:37