cppx-core
utf16-n_units_for.hpp
Go to the documentation of this file.
1 #pragma once // Source encoding: UTF-8 with BOM (π is a lowercase Greek "pi").
2 
6 
7 namespace cppx::utf16
8 {
9  CPPX_USE_STD( basic_string, basic_string_view );
10 
11  template< class Char >
12  inline auto n_units_for( const basic_string_view<Char>& sv ) noexcept
13  -> Size
14  {
16  it = Generator().utf16_from_bytes( CPPX_ITEMS_OF( sv ), it );
17  return it.count();
18  }
19 
21  //inline auto utf8::n_bytes_for( const basic_string_view<char>& sv ) noexcept
22  // -> Size
23  //{ return sv.size(); }
24 
25  // Callability.
26  template< class Char >
27  inline auto n_units_for( const P_<Char> s ) noexcept
28  -> Size
29  { return n_units_for( basic_string_view<Char>( s ) ); }
30 
31  template< class Char >
32  inline auto n_units_for( const basic_string<Char>& s ) noexcept
33  -> Size
34  { return n_units_for( basic_string_view<Char>( s ) ); }
35 
36 } // namespace cppx::utf16
auto n_units_for(const basic_string_view< Char > &sv) noexcept -> Size
Some_type * P_
Creates a raw pointer type.
Signed_< size_t > Size
A Signed_ equivalent of size_t.
CPPX_USE_STD(basic_string, basic_string_view, string, string_view, u16string, wstring, iterator_traits, move, next)
#define CPPX_ITEMS_OF(c)
$items_of(c) effectively expands to std::begin(c), std::end(c).
auto utf16_from_bytes(const Span_< In_iterator > bytes_range, const Out_iterator destination) -> Out_iterator
auto count() const noexcept -> Size
Macros for generating more concise and clear using statements, primarily $use_cppx and $use_std,...