PageRenderTime 25ms CodeModel.GetById 19ms RepoModel.GetById 0ms app.codeStats 1ms

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

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