PageRenderTime 26ms CodeModel.GetById 17ms app.highlight 6ms RepoModel.GetById 1ms app.codeStats 0ms

/Src/Dependencies/Boost/boost/asio/ip/resolver_query_base.hpp

http://hadesmem.googlecode.com/
C++ Header | 157 lines | 100 code | 26 blank | 31 comment | 8 complexity | db21d9290090427418bca309dfa07769 MD5 | raw file
  1//
  2// ip/resolver_query_base.hpp
  3// ~~~~~~~~~~~~~~~~~~~~~~~~~~
  4//
  5// Copyright (c) 2003-2011 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/detail/workaround.hpp>
 20#include <boost/asio/detail/socket_types.hpp>
 21
 22#include <boost/asio/detail/push_options.hpp>
 23
 24namespace boost {
 25namespace asio {
 26namespace ip {
 27
 28/// The resolver_query_base class is used as a base for the
 29/// basic_resolver_query class templates to provide a common place to define
 30/// the flag constants.
 31class resolver_query_base
 32{
 33public:
 34#if defined(GENERATING_DOCUMENTATION)
 35  /// A bitmask type (C++ Std [lib.bitmask.types]).
 36  typedef unspecified flags;
 37
 38  /// Determine the canonical name of the host specified in the query.
 39  static const flags canonical_name = implementation_defined;
 40
 41  /// Indicate that returned endpoint is intended for use as a locally bound
 42  /// socket endpoint.
 43  static const flags passive = implementation_defined;
 44
 45  /// Host name should be treated as a numeric string defining an IPv4 or IPv6
 46  /// address and no name resolution should be attempted.
 47  static const flags numeric_host = implementation_defined;
 48
 49  /// Service name should be treated as a numeric string defining a port number
 50  /// and no name resolution should be attempted.
 51  static const flags numeric_service = implementation_defined;
 52
 53  /// If the query protocol family is specified as IPv6, return IPv4-mapped
 54  /// IPv6 addresses on finding no IPv6 addresses.
 55  static const flags v4_mapped = implementation_defined;
 56
 57  /// If used with v4_mapped, return all matching IPv6 and IPv4 addresses.
 58  static const flags all_matching = implementation_defined;
 59
 60  /// Only return IPv4 addresses if a non-loopback IPv4 address is configured
 61  /// for the system. Only return IPv6 addresses if a non-loopback IPv6 address
 62  /// is configured for the system.
 63  static const flags address_configured = implementation_defined;
 64#else
 65  enum flags
 66  {
 67    canonical_name = AI_CANONNAME,
 68    passive = AI_PASSIVE,
 69    numeric_host = AI_NUMERICHOST,
 70# if defined(AI_NUMERICSERV)
 71    numeric_service = AI_NUMERICSERV,
 72# else
 73    numeric_service = 0,
 74# endif
 75    // Note: QNX Neutrino 6.3 defines AI_V4MAPPED, AI_ALL and AI_ADDRCONFIG but
 76    // does not implement them. Therefore they are specifically excluded here.
 77# if defined(AI_V4MAPPED) && !defined(__QNXNTO__)
 78    v4_mapped = AI_V4MAPPED,
 79# else
 80    v4_mapped = 0,
 81# endif
 82# if defined(AI_ALL) && !defined(__QNXNTO__)
 83    all_matching = AI_ALL,
 84# else
 85    all_matching = 0,
 86# endif
 87# if defined(AI_ADDRCONFIG) && !defined(__QNXNTO__)
 88    address_configured = AI_ADDRCONFIG
 89# else
 90    address_configured = 0
 91# endif
 92  };
 93
 94  // Implement bitmask operations as shown in C++ Std [lib.bitmask.types].
 95
 96  friend flags operator&(flags x, flags y)
 97  {
 98    return static_cast<flags>(
 99        static_cast<unsigned int>(x) & static_cast<unsigned int>(y));
100  }
101
102  friend flags operator|(flags x, flags y)
103  {
104    return static_cast<flags>(
105        static_cast<unsigned int>(x) | static_cast<unsigned int>(y));
106  }
107
108  friend flags operator^(flags x, flags y)
109  {
110    return static_cast<flags>(
111        static_cast<unsigned int>(x) ^ static_cast<unsigned int>(y));
112  }
113
114  friend flags operator~(flags x)
115  {
116    return static_cast<flags>(static_cast<unsigned int>(~x));
117  }
118
119  friend flags& operator&=(flags& x, flags y)
120  {
121    x = x & y;
122    return x;
123  }
124
125  friend flags& operator|=(flags& x, flags y)
126  {
127    x = x | y;
128    return x;
129  }
130
131  friend flags& operator^=(flags& x, flags y)
132  {
133    x = x ^ y;
134    return x;
135  }
136#endif
137
138protected:
139  /// Protected destructor to prevent deletion through this type.
140  ~resolver_query_base()
141  {
142  }
143
144#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
145private:
146  // Workaround to enable the empty base optimisation with Borland C++.
147  char dummy_;
148#endif
149};
150
151} // namespace ip
152} // namespace asio
153} // namespace boost
154
155#include <boost/asio/detail/pop_options.hpp>
156
157#endif // BOOST_ASIO_IP_RESOLVER_QUERY_BASE_HPP