1 #pragma once // Source encoding: UTF-8 with BOM (π is a lowercase Greek "pi"). 15 #include <string_view> 23 {
return (
Byte( ch ) & 0x80) == 0x00; }
34 return (
Byte( ch ) & 0xC0) == 0x80;
46 return (
Byte( ch ) & 0xC0) == 0xC0;
55 return (0xC2 <=
Byte( ch ) and
Byte( ch ) <= 0xF4);
63 for(
auto bits =
Byte( lead_byte ), mask =
Byte( 0x80 ); (bits & mask) != 0; mask >>= 1 )
122 for(
auto _ :
up_to( -distance ) )
auto n_code_points_in(const string_view &view) -> Size
Some_type * P_
Creates a raw pointer type.
auto is_continuation_byte(const char ch) -> Truth
auto prev(P_< const char > p) -> P_< const char >
auto is_lead_byte(const char ch) -> Truth
A drop-in replacement for bool without implicit conversion from/to types other than bool.
CPPX_USE_STD(basic_string, basic_string_view, iterator_traits, move, next, string, string_view)
void advance(P_< const char > &p, const Size distance)
void move_to_prev(P_< const char > &p)
auto is_single_byte(const char ch) -> Truth
Truth is a drop-in replacement for bool without implicit conversion from/to types other than bool.
auto is_valid_continuation_byte(const char ch) -> Truth
auto p_first_of(const basic_string_view< Char > &view) noexcept -> C_str_< Char >
auto group_size_for_lead_byte(const char lead_byte) -> int
void move_to_next(P_< const char > &p)
Simple type builders Type_, P_, R_, Raw_array_ and Raw_array_of_.
auto is_empty(const Collection &c) -> Truth
auto next(P_< const char > p) -> P_< const char >
constexpr auto up_to(const Integer n) noexcept -> Range_< Integer >
unsigned char Byte
Default choice of byte type.
Signed_< size_t > Size
A Signed_ equivalent of size_t.
auto is_valid_single_byte(const char ch) -> Truth
auto to_prev_code_point(P_< const char > p, const P_< const char > p_first) -> P_< const char >
Byte and Signed_byte, + std::byte support definitions as_number and as_std_byte.
auto is_valid_lead_byte(const char ch) -> Truth
Signed Size and Index, plus unsigned equivalents Unsigned_size and Unsigned_index.
auto p_beyond_of(const basic_string_view< Char > &view) noexcept -> C_str_< Char >