Clementine
resolver_base.hpp
1 //
2 // ip/resolver_base.hpp
3 // ~~~~~~~~~~~~~~~~~~~~
4 //
5 // Copyright (c) 2003-2020 Christopher M. Kohlhoff (chris at kohlhoff dot com)
6 //
7 // Distributed under the Boost Software License, Version 1.0. (See accompanying
8 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
9 //
10 
11 #ifndef ASIO_IP_RESOLVER_BASE_HPP
12 #define ASIO_IP_RESOLVER_BASE_HPP
13 
14 #if defined(_MSC_VER) && (_MSC_VER >= 1200)
15 # pragma once
16 #endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
17 
18 #include "asio/detail/config.hpp"
19 #include "asio/detail/socket_types.hpp"
20 
21 #include "asio/detail/push_options.hpp"
22 
23 namespace asio {
24 namespace ip {
25 
29 {
30 public:
31 #if defined(GENERATING_DOCUMENTATION)
32  typedef unspecified flags;
34 
36  static const flags canonical_name = implementation_defined;
37 
40  static const flags passive = implementation_defined;
41 
44  static const flags numeric_host = implementation_defined;
45 
48  static const flags numeric_service = implementation_defined;
49 
52  static const flags v4_mapped = implementation_defined;
53 
55  static const flags all_matching = implementation_defined;
56 
60  static const flags address_configured = implementation_defined;
61 #else
62  enum flags
63  {
64  canonical_name = ASIO_OS_DEF(AI_CANONNAME),
65  passive = ASIO_OS_DEF(AI_PASSIVE),
66  numeric_host = ASIO_OS_DEF(AI_NUMERICHOST),
67  numeric_service = ASIO_OS_DEF(AI_NUMERICSERV),
68  v4_mapped = ASIO_OS_DEF(AI_V4MAPPED),
69  all_matching = ASIO_OS_DEF(AI_ALL),
70  address_configured = ASIO_OS_DEF(AI_ADDRCONFIG)
71  };
72 
73  // Implement bitmask operations as shown in C++ Std [lib.bitmask.types].
74 
75  friend flags operator&(flags x, flags y)
76  {
77  return static_cast<flags>(
78  static_cast<unsigned int>(x) & static_cast<unsigned int>(y));
79  }
80 
81  friend flags operator|(flags x, flags y)
82  {
83  return static_cast<flags>(
84  static_cast<unsigned int>(x) | static_cast<unsigned int>(y));
85  }
86 
87  friend flags operator^(flags x, flags y)
88  {
89  return static_cast<flags>(
90  static_cast<unsigned int>(x) ^ static_cast<unsigned int>(y));
91  }
92 
93  friend flags operator~(flags x)
94  {
95  return static_cast<flags>(~static_cast<unsigned int>(x));
96  }
97 
98  friend flags& operator&=(flags& x, flags y)
99  {
100  x = x & y;
101  return x;
102  }
103 
104  friend flags& operator|=(flags& x, flags y)
105  {
106  x = x | y;
107  return x;
108  }
109 
110  friend flags& operator^=(flags& x, flags y)
111  {
112  x = x ^ y;
113  return x;
114  }
115 #endif
116 
117 protected:
120  {
121  }
122 };
123 
124 } // namespace ip
125 } // namespace asio
126 
127 #include "asio/detail/pop_options.hpp"
128 
129 #endif // ASIO_IP_RESOLVER_BASE_HPP
~resolver_base()
Protected destructor to prevent deletion through this type.
Definition: resolver_base.hpp:119
The resolver_base class is used as a base for the basic_resolver class templates to provide a common ...
Definition: resolver_base.hpp:28
Definition: any_io_executor.hpp:28