RESTinio
Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
restinio::utils::utf8_checker_t Class Reference

Helper class for checking UTF-8 byte sequence during parsing URI or incoming byte stream. More...

#include <utf8_checker.hpp>

Public Member Functions

 utf8_checker_t ()=default
 
RESTINIO_NODISCARD bool process_byte (std::uint8_t byte) noexcept
 
RESTINIO_NODISCARD bool finalized () const noexcept
 
void reset () noexcept
 
RESTINIO_NODISCARD std::uint32_t current_symbol () const noexcept
 

Private Types

enum class  state_t { valid , invalid , may_be_overlong , overlong }
 

Private Member Functions

void validate_current_symbol () noexcept
 
void check_overlong (std::uint8_t byte) noexcept
 

Private Attributes

std::uint32_t m_current_symbol = 0u
 
std::size_t m_current_symbol_rest_bytes = 0u
 
state_t m_state = state_t::valid
 

Detailed Description

Helper class for checking UTF-8 byte sequence during parsing URI or incoming byte stream.

Note: this class is moved to restinio::utils namespace in v.0.6.5.

Definition at line 34 of file utf8_checker.hpp.

Member Enumeration Documentation

◆ state_t

enum class restinio::utils::utf8_checker_t::state_t
strongprivate
Enumerator
valid 
invalid 
may_be_overlong 
overlong 

Definition at line 198 of file utf8_checker.hpp.

Constructor & Destructor Documentation

◆ utf8_checker_t()

restinio::utils::utf8_checker_t::utf8_checker_t ( )
default

Member Function Documentation

◆ check_overlong()

void restinio::utils::utf8_checker_t::check_overlong ( std::uint8_t  byte)
inlineprivatenoexcept

Definition at line 149 of file utf8_checker.hpp.

◆ current_symbol()

RESTINIO_NODISCARD std::uint32_t restinio::utils::utf8_checker_t::current_symbol ( ) const
inlinenoexcept

Definition at line 134 of file utf8_checker.hpp.

◆ finalized()

RESTINIO_NODISCARD bool restinio::utils::utf8_checker_t::finalized ( ) const
inlinenoexcept
Returns
true if the current sequence finalized.

Definition at line 120 of file utf8_checker.hpp.

◆ process_byte()

RESTINIO_NODISCARD bool restinio::utils::utf8_checker_t::process_byte ( std::uint8_t  byte)
inlinenoexcept

Definition at line 41 of file utf8_checker.hpp.

◆ reset()

void restinio::utils::utf8_checker_t::reset ( )
inlinenoexcept

Definition at line 126 of file utf8_checker.hpp.

◆ validate_current_symbol()

void restinio::utils::utf8_checker_t::validate_current_symbol ( )
inlineprivatenoexcept

Definition at line 139 of file utf8_checker.hpp.

Member Data Documentation

◆ m_current_symbol

std::uint32_t restinio::utils::utf8_checker_t::m_current_symbol = 0u
private

Definition at line 194 of file utf8_checker.hpp.

◆ m_current_symbol_rest_bytes

std::size_t restinio::utils::utf8_checker_t::m_current_symbol_rest_bytes = 0u
private

Definition at line 196 of file utf8_checker.hpp.

◆ m_state

state_t restinio::utils::utf8_checker_t::m_state = state_t::valid
private

Definition at line 206 of file utf8_checker.hpp.


The documentation for this class was generated from the following file: