use_asio.hpp 998 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. #pragma once
  2. #if defined(ASIO_STANDALONE)
  3. //MSVC : define environment path 'ASIO_STANDALONE_INCLUDE', e.g. 'E:\bdlibs\asio-1.10.6\include'
  4. #include <asio.hpp>
  5. #ifdef CINATRA_ENABLE_SSL
  6. #include <asio/ssl.hpp>
  7. #endif
  8. #include <asio/steady_timer.hpp>
  9. #include <asio/detail/noncopyable.hpp>
  10. namespace boost
  11. {
  12. namespace asio
  13. {
  14. using namespace ::asio;
  15. }
  16. namespace system {
  17. using ::std::error_code;
  18. }
  19. }
  20. #else
  21. #include <boost/asio.hpp>
  22. #ifdef CINATRA_ENABLE_SSL
  23. #include <boost/asio/ssl.hpp>
  24. #endif
  25. #include <boost/asio/steady_timer.hpp>
  26. using namespace boost;
  27. using tcp_socket = boost::asio::ip::tcp::socket;
  28. #ifdef CINATRA_ENABLE_SSL
  29. using ssl_socket = boost::asio::ssl::stream<boost::asio::ip::tcp::socket>;
  30. #endif
  31. #endif
  32. #if __cplusplus > 201402L
  33. #include <string_view>
  34. using string_view = std::string_view;
  35. #else
  36. #ifdef ASIO_STANDALONE
  37. #include "string_view.hpp"
  38. using namespace nonstd;
  39. #else
  40. #include <boost/utility/string_view.hpp>
  41. using string_view = boost::string_view;
  42. #endif
  43. #endif