const_buffer_util.hpp 641 B

123456789101112131415161718192021222324252627
  1. // Copyright Takatoshi Kondo 2018
  2. //
  3. // Distributed under the Boost Software License, Version 1.0.
  4. // (See accompanying file LICENSE_1_0.txt or copy at
  5. // http://www.boost.org/LICENSE_1_0.txt)
  6. #if !defined(MQTT_CONST_BUFFER_UTIL_HPP)
  7. #define MQTT_CONST_BUFFER_UTIL_HPP
  8. #include <boost/asio/buffer.hpp>
  9. #include <mqtt/namespace.hpp>
  10. namespace MQTT_NS {
  11. namespace as = boost::asio;
  12. inline char const* get_pointer(as::const_buffer const& cb) {
  13. return static_cast<char const*>(cb.data());
  14. }
  15. inline std::size_t get_size(as::const_buffer const& cb) {
  16. return cb.size();
  17. }
  18. } // namespace MQTT_NS
  19. #endif // MQTT_CONST_BUFFER_UTIL_HPP