Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-09-17 08:38:22

0001 //
0002 // Copyright (c) 2023-2025 Ivica Siladic, Bruno Iljazovic, Korina Simicevic
0003 //
0004 // Distributed under the Boost Software License, Version 1.0.
0005 // (See accompanying file LICENSE or copy at http://www.boost.org/LICENSE_1_0.txt)
0006 //
0007 
0008 #ifndef BOOST_MQTT5_LOGGER_TRAITS_HPP
0009 #define BOOST_MQTT5_LOGGER_TRAITS_HPP
0010 
0011 #include <boost/mqtt5/property_types.hpp>
0012 #include <boost/mqtt5/reason_codes.hpp>
0013 #include <boost/mqtt5/types.hpp>
0014 
0015 #include <boost/asio/ip/tcp.hpp>
0016 #include <boost/system/error_code.hpp>
0017 #include <boost/type_traits/is_detected.hpp>
0018 
0019 #include <iostream>
0020 #include <string_view>
0021 #include <type_traits>
0022 
0023 namespace boost::mqtt5 {
0024 
0025 namespace asio = boost::asio;
0026 using boost::system::error_code;
0027 
0028 // NOOP Logger
0029 class noop_logger {};
0030 
0031 // at_resolve
0032 
0033 template <typename T>
0034 using at_resolve_sig = decltype(
0035     std::declval<T&>().at_resolve(
0036         std::declval<error_code>(),
0037         std::declval<std::string_view>(), std::declval<std::string_view>(),
0038         std::declval<const asio::ip::tcp::resolver::results_type&>()
0039     )
0040 );
0041 template <typename T>
0042 constexpr bool has_at_resolve = boost::is_detected<at_resolve_sig, T>::value;
0043 
0044 // at_tcp_connect
0045 
0046 template <typename T>
0047 using at_tcp_connect_sig = decltype(
0048     std::declval<T&>().at_tcp_connect(
0049         std::declval<error_code>(), std::declval<asio::ip::tcp::endpoint>()
0050     )
0051 );
0052 template <typename T>
0053 constexpr bool has_at_tcp_connect = boost::is_detected<at_tcp_connect_sig, T>::value;
0054 
0055 // at_tls_handshake
0056 
0057 template <typename T>
0058 using at_tls_handshake_sig = decltype(
0059     std::declval<T&>().at_tls_handshake(
0060         std::declval<error_code>(), std::declval<asio::ip::tcp::endpoint>()
0061     )
0062 );
0063 template <typename T>
0064 constexpr bool has_at_tls_handshake = boost::is_detected<at_tls_handshake_sig, T>::value;
0065 
0066 // at_ws_handshake
0067 
0068 template <typename T>
0069 using at_ws_handshake_sig = decltype(
0070     std::declval<T&>().at_ws_handshake(
0071         std::declval<error_code>(), std::declval<asio::ip::tcp::endpoint>()
0072     )
0073 );
0074 template <typename T>
0075 constexpr bool has_at_ws_handshake = boost::is_detected<at_ws_handshake_sig, T>::value;
0076 
0077 // at_connack
0078 
0079 template <typename T>
0080 using at_connack_sig = decltype(
0081     std::declval<T&>().at_connack(
0082         std::declval<reason_code>(),
0083         std::declval<bool>(), std::declval<const connack_props&>()
0084     )
0085 );
0086 template <typename T>
0087 constexpr bool has_at_connack = boost::is_detected<at_connack_sig, T>::value;
0088 
0089 // at_disconnect
0090 
0091 template <typename T>
0092 using at_disconnect_sig = decltype(
0093     std::declval<T&>().at_disconnect(
0094         std::declval<reason_code>(), std::declval<const disconnect_props&>()
0095     )
0096 );
0097 template <typename T>
0098 constexpr bool has_at_disconnect = boost::is_detected<at_disconnect_sig, T>::value;
0099 
0100 } // end namespace boost::mqtt5
0101 
0102 
0103 #endif // !BOOST_MQTT5_LOGGER_TRAITS_HPP