1 #pragma once // Source encoding: UTF-8 with BOM (π is a lowercase Greek "pi"). 8 CPPX_USE_STD( basic_string, basic_string_view, iterator_traits, move,
next,
string );
13 using Bytes_count_iterator = Count_iterator_<char>;
17 template<
class Value >
18 auto output_utf8(
const uint32_t code,
const Bytes_count_iterator initial_count )
19 -> Bytes_count_iterator
21 Bytes_count_iterator counter = initial_count;
22 if( code <= 0x7F ) { ++counter; }
23 else if( code <= 0x7FF ) { counter += 2; }
24 else if( code <= 0xFFFF ) { counter += 3; }
25 else { counter += 4; }
32 template<
class Char >
33 inline auto n_bytes_for(
const basic_string_view<Char>& sv ) noexcept
36 impl::Bytes_count_iterator it;
42 inline auto n_bytes_for(
const basic_string_view<char>& sv ) noexcept
47 template<
class Char >
50 {
return n_bytes_for( basic_string_view<Char>( s ) ); }
52 template<
class Char >
53 inline auto n_bytes_for(
const basic_string<Char>& s ) noexcept
55 {
return n_bytes_for( basic_string_view<Char>( s ) ); }
Some_type * P_
Creates a raw pointer type.
CPPX_USE_STD(basic_string, basic_string_view, iterator_traits, move, next, string, string_view)
auto utf8_from_codes(const Span_< In_iterator > range, const Out_iterator destination) -> Out_iterator
auto next(P_< const char > p) -> P_< const char >
Signed_< size_t > Size
A Signed_ equivalent of size_t.
#define CPPX_ITEMS_OF(c)
$items_of(c) effectively expands to std::begin(c), std::end(c).
auto n_bytes_for(const basic_string_view< Char > &sv) noexcept -> Size