async_mqtt 5.0.0
Loading...
Searching...
No Matches
utf8validate.hpp
1// Copyright Takatoshi Kondo 2023
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
7#if !defined(ASYNC_MQTT_UTIL_UTF8VALIDATE_HPP)
8#define ASYNC_MQTT_UTIL_UTF8VALIDATE_HPP
9
10#include <string_view>
11#include <boost/beast/websocket/detail/utf8_checker.hpp>
12
13namespace async_mqtt {
14
15inline bool utf8string_check(std::string_view buf) {
16 if (buf.empty()) return true;
17 return boost::beast::websocket::detail::check_utf8(buf.data(), buf.size());
18}
19
20} // namespace async_mqtt
21
22#endif // ASYNC_MQTT_UTIL_UTF8VALIDATE_HPP