Encoding Schemeļ
The encoding_scheme
template turns any encoding into a byte-based encoding capable of reading and writing those bytes into and out of byte-value_type
ranges. It prevents duplicating effort to read encodings as little endian or big endian, allowing composition for any desired encoding to interface with e.g. a UTF-16 Big Endian blob of data coming over a network or shared pipe.
Aliasesļ
-
template<typename _Byte>
using ztd::text::basic_utf16_le = encoding_scheme<utf16_t, endian::little, _Byte>ļ A UTF-16 encoding, in Little Endian format, with inputs as a sequence of bytes.
- Template Parameters:
_Byte ā The byte type to use. Typically, this is
std::byte
oruchar.
-
using ztd::text::utf16_le_t = basic_utf16_le<::std::byte>ļ
A UTF-16 encoding, in Little Endian format, with inputs as a sequence of bytes.
-
template<typename _Byte>
using ztd::text::basic_utf16_be = encoding_scheme<utf16_t, endian::big, _Byte>ļ A UTF-16 encoding, in Big Endian format, with inputs as a sequence of bytes.
- Template Parameters:
_Byte ā The byte type to use. Typically, this is
std::byte
orunsigned char
.
-
using ztd::text::utf16_be_t = basic_utf16_be<::std::byte>ļ
A UTF-16 encoding, in Big Endian format, with inputs as a sequence of bytes.
-
template<typename _Byte>
using ztd::text::basic_utf16_ne = encoding_scheme<utf16_t, endian::native, _Byte>ļ A UTF-16 encoding, in Native Endian format, with inputs as a sequence of bytes.
- Template Parameters:
_Byte ā The byte type to use. Typically, this is
std::byte
orunsigned char
.
-
using ztd::text::utf16_ne_t = basic_utf16_ne<::std::byte>ļ
A UTF-16 encoding, in Native Endian format, with inputs as a sequence of bytes.
-
template<typename _Byte>
using ztd::text::basic_utf32_le = encoding_scheme<utf32_t, endian::little, _Byte>ļ A UTF-32 encoding, in Little Endian format, with inputs as a sequence of bytes.
- Template Parameters:
_Byte ā The byte type to use. Typically, this is
std::byte
orunsigned char
.
-
using ztd::text::utf32_le_t = basic_utf32_le<::std::byte>ļ
A UTF-32 encoding, in Little Endian format, with inputs as a sequence of bytes.
-
template<typename _Byte>
using ztd::text::basic_utf32_be = encoding_scheme<utf32_t, endian::big, _Byte>ļ A UTF-32 encoding, in Big Endian format, with inputs as a sequence of bytes.
- Template Parameters:
_Byte ā The byte type to use. Typically, this is
std::byte
orunsigned char
.
-
using ztd::text::utf32_be_t = basic_utf32_be<::std::byte>ļ
A UTF-32 encoding, in Big Endian format, with inputs as a sequence of bytes.
-
template<typename _Byte>
using ztd::text::basic_utf32_ne = encoding_scheme<utf32_t, endian::native, _Byte>ļ A UTF-32 encoding, in Native Endian format, with inputs as a sequence of bytes.
- Template Parameters:
_Byte ā The byte type to use. Typically, this is
std::byte
orunsigned char
.
-
using ztd::text::utf32_ne_t = basic_utf32_ne<::std::byte>ļ
A UTF-32 encoding, in Big Endian format, with inputs as a sequence of bytes.
Base Templateļ
-
template<typename _Encoding, endian _Endian = endian::native, typename _Byte = ::std::byte>
class encoding_scheme : public __txt_detail::__is_unicode_encoding_es<encoding_scheme<_Encoding, endian::native, ::std::byte>, unwrap_remove_cvref_t<_Encoding>>, private ebco<_Encoding>ļ - #include <basic_encoding_scheme.hpp>
Decomposes the provided Encoding type into a specific endianness (big, little, or native) to allow for a single encoding type to be viewed in different ways.
Remark
For example, this can be used to construct a Big Endian UTF-16 by using
encoding_scheme<ztd::text::utf16_t, ztd::endian::big>
. It can be made interopable withunsigned char
buffers rather thanstd::byte
buffers by doing:ztd::text::encoding_scheme<ztd::text::utf32_t, ztd::endian::native, unsigned char>
.- Template Parameters:
_Encoding ā The encoding type.
_Endian ā The endianess to use. Defaults to ztd::endian::native.
_Byte ā The byte type to use. Defaults to
std::byte
.