tetengo 1.8.2
A multipurpose library set
Loading...
Searching...
No Matches
tetengo::text::encoding::utf8 Class Reference

A UTF-8 encoding. More...

#include <utf8.hpp>

+ Inheritance diagram for tetengo::text::encoding::utf8:
+ Collaboration diagram for tetengo::text::encoding::utf8:

Public Types

using string_type = std::string_view
 The string type.
 
using string_view_type = std::string_view
 The string view type.
 
using encoded_string_type = std::u8string_view
 The encoded string type.
 
using encoded_string_view_type = std::u8string_view
 The encoded string view type.
 

Public Member Functions

 ~utf8 ()
 Destroys the encoding.
 
encoded_string_type encode (const string_view_type &utf8) const
 Encodes a UTF-8 string to this encoding.
 
string_type decode (const encoded_string_view_type &string_) const
 Decodes a string in this encoding to UTF-8.
 

Static Public Member Functions

static const utf8instance ()
 Returns the instance.
 

Detailed Description

A UTF-8 encoding.

Member Function Documentation

◆ decode()

string_type tetengo::text::encoding::utf8::decode ( const encoded_string_view_type & string_) const
nodiscard

Decodes a string in this encoding to UTF-8.

Parameters
string_A string in this encoding.
Returns
A decoded string.

◆ encode()

encoded_string_type tetengo::text::encoding::utf8::encode ( const string_view_type & utf8) const
nodiscard

Encodes a UTF-8 string to this encoding.

Parameters
utf8A UTF-8 string.
Returns
An encoded string.

◆ instance()

static const utf8 & tetengo::text::encoding::utf8::instance ( )
staticnodiscard

Returns the instance.

Returns
The instance.

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