RESTinio
utf8.hpp
Go to the documentation of this file.
1
5#pragma once
6
7#include <iostream> // std::cout, debug
8
11
12namespace restinio
13{
14
15namespace websocket
16{
17
18namespace basic
19{
20
21namespace impl
22{
23
24//
25// check_utf8_is_correct
26//
27
28inline bool
30{
32
33 for( const auto & ch : sv )
34 {
35 if( !checker.process_byte( static_cast<std::uint8_t>(ch) ) )
36 {
37 return false;
38 }
39 }
40
41 return checker.finalized();
42}
43
44} /* namespace impl */
45
46} /* namespace basic */
47
48} /* namespace websocket */
49
50} /* namespace restinio */
Helper class for checking UTF-8 byte sequence during parsing URI or incoming byte stream.
RESTINIO_NODISCARD bool finalized() const noexcept
RESTINIO_NODISCARD bool process_byte(std::uint8_t byte) noexcept
bool check_utf8_is_correct(string_view_t sv) noexcept
Definition: utf8.hpp:29
nonstd::string_view string_view_t
Definition: string_view.hpp:19
An implementation of checker for UTF-8 sequences.