Statistics
| Revision:

root / tmp / org.txm.statsengine.r.core.win32 / res / win32 / library / BH / include / boost / asio / ip / resolver_query_base.hpp @ 2486

History | View | Annotate | Download (3.7 kB)

1
//
2
// ip/resolver_query_base.hpp
3
// ~~~~~~~~~~~~~~~~~~~~~~~~~~
4
//
5
// Copyright (c) 2003-2015 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 BOOST_ASIO_IP_RESOLVER_QUERY_BASE_HPP
12
#define BOOST_ASIO_IP_RESOLVER_QUERY_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 <boost/asio/detail/config.hpp>
19
#include <boost/asio/detail/socket_types.hpp>
20

    
21
#include <boost/asio/detail/push_options.hpp>
22

    
23
namespace boost {
24
namespace asio {
25
namespace ip {
26

    
27
/// The resolver_query_base class is used as a base for the
28
/// basic_resolver_query class templates to provide a common place to define
29
/// the flag constants.
30
class resolver_query_base
31
{
32
public:
33
#if defined(GENERATING_DOCUMENTATION)
34
  /// A bitmask type (C++ Std [lib.bitmask.types]).
35
  typedef unspecified flags;
36

    
37
  /// Determine the canonical name of the host specified in the query.
38
  static const flags canonical_name = implementation_defined;
39

    
40
  /// Indicate that returned endpoint is intended for use as a locally bound
41
  /// socket endpoint.
42
  static const flags passive = implementation_defined;
43

    
44
  /// Host name should be treated as a numeric string defining an IPv4 or IPv6
45
  /// address and no name resolution should be attempted.
46
  static const flags numeric_host = implementation_defined;
47

    
48
  /// Service name should be treated as a numeric string defining a port number
49
  /// and no name resolution should be attempted.
50
  static const flags numeric_service = implementation_defined;
51

    
52
  /// If the query protocol family is specified as IPv6, return IPv4-mapped
53
  /// IPv6 addresses on finding no IPv6 addresses.
54
  static const flags v4_mapped = implementation_defined;
55

    
56
  /// If used with v4_mapped, return all matching IPv6 and IPv4 addresses.
57
  static const flags all_matching = implementation_defined;
58

    
59
  /// Only return IPv4 addresses if a non-loopback IPv4 address is configured
60
  /// for the system. Only return IPv6 addresses if a non-loopback IPv6 address
61
  /// is configured for the system.
62
  static const flags address_configured = implementation_defined;
63
#else
64
  enum flags
65
  {
66
    canonical_name = BOOST_ASIO_OS_DEF(AI_CANONNAME),
67
    passive = BOOST_ASIO_OS_DEF(AI_PASSIVE),
68
    numeric_host = BOOST_ASIO_OS_DEF(AI_NUMERICHOST),
69
    numeric_service = BOOST_ASIO_OS_DEF(AI_NUMERICSERV),
70
    v4_mapped = BOOST_ASIO_OS_DEF(AI_V4MAPPED),
71
    all_matching = BOOST_ASIO_OS_DEF(AI_ALL),
72
    address_configured = BOOST_ASIO_OS_DEF(AI_ADDRCONFIG)
73
  };
74

    
75
  // Implement bitmask operations as shown in C++ Std [lib.bitmask.types].
76

    
77
  friend flags operator&(flags x, flags y)
78
  {
79
    return static_cast<flags>(
80
        static_cast<unsigned int>(x) & static_cast<unsigned int>(y));
81
  }
82

    
83
  friend flags operator|(flags x, flags y)
84
  {
85
    return static_cast<flags>(
86
        static_cast<unsigned int>(x) | static_cast<unsigned int>(y));
87
  }
88

    
89
  friend flags operator^(flags x, flags y)
90
  {
91
    return static_cast<flags>(
92
        static_cast<unsigned int>(x) ^ static_cast<unsigned int>(y));
93
  }
94

    
95
  friend flags operator~(flags x)
96
  {
97
    return static_cast<flags>(~static_cast<unsigned int>(x));
98
  }
99

    
100
  friend flags& operator&=(flags& x, flags y)
101
  {
102
    x = x & y;
103
    return x;
104
  }
105

    
106
  friend flags& operator|=(flags& x, flags y)
107
  {
108
    x = x | y;
109
    return x;
110
  }
111

    
112
  friend flags& operator^=(flags& x, flags y)
113
  {
114
    x = x ^ y;
115
    return x;
116
  }
117
#endif
118

    
119
protected:
120
  /// Protected destructor to prevent deletion through this type.
121
  ~resolver_query_base()
122
  {
123
  }
124
};
125

    
126
} // namespace ip
127
} // namespace asio
128
} // namespace boost
129

    
130
#include <boost/asio/detail/pop_options.hpp>
131

    
132
#endif // BOOST_ASIO_IP_RESOLVER_QUERY_BASE_HPP