File indexing completed on 2025-01-18 09:29:00
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012 #ifndef BOOST_ASIO_LOCAL_BASIC_ENDPOINT_HPP
0013 #define BOOST_ASIO_LOCAL_BASIC_ENDPOINT_HPP
0014
0015 #if defined(_MSC_VER) && (_MSC_VER >= 1200)
0016 # pragma once
0017 #endif
0018
0019 #include <boost/asio/detail/config.hpp>
0020
0021 #if defined(BOOST_ASIO_HAS_LOCAL_SOCKETS) \
0022 || defined(GENERATING_DOCUMENTATION)
0023
0024 #include <boost/asio/local/detail/endpoint.hpp>
0025
0026 #if !defined(BOOST_ASIO_NO_IOSTREAM)
0027 # include <iosfwd>
0028 #endif
0029
0030 #include <boost/asio/detail/push_options.hpp>
0031
0032 namespace boost {
0033 namespace asio {
0034 namespace local {
0035
0036
0037
0038
0039
0040
0041
0042
0043
0044
0045
0046
0047
0048 template <typename Protocol>
0049 class basic_endpoint
0050 {
0051 public:
0052
0053 typedef Protocol protocol_type;
0054
0055
0056
0057 #if defined(GENERATING_DOCUMENTATION)
0058 typedef implementation_defined data_type;
0059 #else
0060 typedef boost::asio::detail::socket_addr_type data_type;
0061 #endif
0062
0063
0064 basic_endpoint() noexcept
0065 {
0066 }
0067
0068
0069 basic_endpoint(const char* path_name)
0070 : impl_(path_name)
0071 {
0072 }
0073
0074
0075 basic_endpoint(const std::string& path_name)
0076 : impl_(path_name)
0077 {
0078 }
0079
0080 #if defined(BOOST_ASIO_HAS_STRING_VIEW)
0081
0082 basic_endpoint(string_view path_name)
0083 : impl_(path_name)
0084 {
0085 }
0086 #endif
0087
0088
0089 basic_endpoint(const basic_endpoint& other)
0090 : impl_(other.impl_)
0091 {
0092 }
0093
0094
0095 basic_endpoint(basic_endpoint&& other)
0096 : impl_(other.impl_)
0097 {
0098 }
0099
0100
0101 basic_endpoint& operator=(const basic_endpoint& other)
0102 {
0103 impl_ = other.impl_;
0104 return *this;
0105 }
0106
0107
0108 basic_endpoint& operator=(basic_endpoint&& other)
0109 {
0110 impl_ = other.impl_;
0111 return *this;
0112 }
0113
0114
0115 protocol_type protocol() const
0116 {
0117 return protocol_type();
0118 }
0119
0120
0121 data_type* data()
0122 {
0123 return impl_.data();
0124 }
0125
0126
0127 const data_type* data() const
0128 {
0129 return impl_.data();
0130 }
0131
0132
0133 std::size_t size() const
0134 {
0135 return impl_.size();
0136 }
0137
0138
0139 void resize(std::size_t new_size)
0140 {
0141 impl_.resize(new_size);
0142 }
0143
0144
0145 std::size_t capacity() const
0146 {
0147 return impl_.capacity();
0148 }
0149
0150
0151 std::string path() const
0152 {
0153 return impl_.path();
0154 }
0155
0156
0157 void path(const char* p)
0158 {
0159 impl_.path(p);
0160 }
0161
0162
0163 void path(const std::string& p)
0164 {
0165 impl_.path(p);
0166 }
0167
0168
0169 friend bool operator==(const basic_endpoint<Protocol>& e1,
0170 const basic_endpoint<Protocol>& e2)
0171 {
0172 return e1.impl_ == e2.impl_;
0173 }
0174
0175
0176 friend bool operator!=(const basic_endpoint<Protocol>& e1,
0177 const basic_endpoint<Protocol>& e2)
0178 {
0179 return !(e1.impl_ == e2.impl_);
0180 }
0181
0182
0183 friend bool operator<(const basic_endpoint<Protocol>& e1,
0184 const basic_endpoint<Protocol>& e2)
0185 {
0186 return e1.impl_ < e2.impl_;
0187 }
0188
0189
0190 friend bool operator>(const basic_endpoint<Protocol>& e1,
0191 const basic_endpoint<Protocol>& e2)
0192 {
0193 return e2.impl_ < e1.impl_;
0194 }
0195
0196
0197 friend bool operator<=(const basic_endpoint<Protocol>& e1,
0198 const basic_endpoint<Protocol>& e2)
0199 {
0200 return !(e2 < e1);
0201 }
0202
0203
0204 friend bool operator>=(const basic_endpoint<Protocol>& e1,
0205 const basic_endpoint<Protocol>& e2)
0206 {
0207 return !(e1 < e2);
0208 }
0209
0210 private:
0211
0212 boost::asio::local::detail::endpoint impl_;
0213 };
0214
0215
0216
0217
0218
0219
0220
0221
0222
0223
0224
0225
0226
0227 template <typename Elem, typename Traits, typename Protocol>
0228 std::basic_ostream<Elem, Traits>& operator<<(
0229 std::basic_ostream<Elem, Traits>& os,
0230 const basic_endpoint<Protocol>& endpoint)
0231 {
0232 os << endpoint.path();
0233 return os;
0234 }
0235
0236 }
0237 }
0238 }
0239
0240 #include <boost/asio/detail/pop_options.hpp>
0241
0242 #endif
0243
0244
0245 #endif