MT Core (C++)
Core library for replacing C++ standard in project usage
|
Group related to unicode encodings (including UTF8, UTF16, UTF32 ane endianness) More...
Classes | |
struct | mtcore::EndianSlice< T, Endian > |
A Slice with Endian-aware data which is just a pointer + length + endian direction Accessing elements through the array operator will do bounds checks and will convert to native endian by default (this can be overridden with access methods) Accessing out of bounds will terminate the program instead of throw Can also get sub slices. More... | |
struct | mtcore::RuneIterator< char16_t > |
Iterates over runes of utf16 sequences Also handles flipping endianness to native endian. More... | |
Typedefs | |
using | mtcore::SliceU16Native = EndianSlice<char16_t, std::endian::native> |
Slice type representing native UTF-16 string *. | |
using | mtcore::SliceU16Le = EndianSlice<char16_t, std::endian::little> |
Slice type representing little endian UTF-16 string *. | |
using | mtcore::SliceU16Be = EndianSlice<char16_t, std::endian::big> |
Slice type representing big endian UTF-16 string *. | |
using | mtcore::SliceConstU16Native = EndianSlice<const char16_t, std::endian::native> |
Slice type representing const native UTF-16 string *. | |
using | mtcore::SliceConstU16Le = EndianSlice<const char16_t, std::endian::little> |
Slice type representing const little endian UTF-16 string *. | |
using | mtcore::SliceConstU16Be = EndianSlice<const char16_t, std::endian::big> |
Slice type representing const big endian UTF-16 string *. | |
using | mtcore::SliceU32Native = EndianSlice<char32_t, std::endian::native> |
Slice type representing native UTF-32 string *. | |
using | mtcore::SliceU32Le = EndianSlice<char32_t, std::endian::little> |
Slice type representing little endian UTF-32 string *. | |
using | mtcore::SliceU32Be = EndianSlice<char32_t, std::endian::big> |
Slice type representing big endian UTF-32 string. | |
using | mtcore::SliceConstU32Native = EndianSlice<const char32_t, std::endian::native> |
Slice type representing const native UTF-32 string. | |
using | mtcore::SliceConstU32Le = EndianSlice<const char32_t, std::endian::little> |
Slice type representing const little endian UTF-32 string. | |
using | mtcore::SliceConstU32Be = EndianSlice<const char32_t, std::endian::big> |
Slice type representing const big endian UTF-32 string. | |
Functions | |
constexpr auto | mtcore::is_bom (const char32_t ch) |
Checks if a character is a BOM in native ordering. | |
constexpr auto | mtcore::is_bom_rev_16_bit (const char16_t ch) |
Checks if a 16-bit character is a BOM in reverse ordering. | |
constexpr auto | mtcore::is_bom_rev_32_bit (const char32_t ch) |
Checks if a 32-bit character is a BOM in reverse ordering. | |
Optional< std::endian > | mtcore::u16_detect_endian (const char16_t ch) |
Tries to detect the endian encoding based on a possible BOM mark. | |
Optional< std::endian > | mtcore::u32_detect_endian (const char32_t ch) |
Tries to detect the endian encoding based on a possible BOM mark. | |
constexpr bool | mtcore::is_surrogate (char16_t ch) |
Checks if UTF-16 character is a surrogate. | |
constexpr bool | mtcore::is_high_surrogate (char16_t ch) |
Checks if UTF-16 character is a high surrogate *. | |
constexpr bool | mtcore::is_low_surrogate (char16_t ch) |
Checks if UTF-16 character is a low surrogate *. | |
SliceU16Native | mtcore::endian_from_native_slice (Slice< char16_t > s) |
Gets a UTF-16 endian slice from a slice which is assumed ot be native endian. | |
SliceU32Native | mtcore::endian_from_native_slice (Slice< char32_t > s) |
Gets a UTF-32 endian slice from a slice which is assumed ot be native endian. | |
SliceU16Le | mtcore::endian_from_le_slice (Slice< char16_t > s) |
Gets a UTF-16 endian slice from a slice which is assumed ot be little endian. | |
SliceU32Le | mtcore::endian_from_le_slice (Slice< char32_t > s) |
Gets a UTF-32 endian slice from a slice which is assumed ot be little endian. | |
SliceU16Be | mtcore::endian_from_be_slice (Slice< char16_t > s) |
Gets a UTF-16 endian slice from a slice which is assumed ot be big endian. | |
SliceU32Be | mtcore::endian_from_be_slice (Slice< char32_t > s) |
Gets a UTF-32 endian slice from a slice which is assumed ot be big endian. | |
std::variant< SliceU16Le, SliceU16Be > | mtcore::endian_from_slice (Slice< char16_t > s) |
Gets a UTF-16 endian slice from an input slice Will try to use the first character of the slice as a BOM to detect endianness If endian detection fails, will assume native endian Since endian slices are distinct types, this will return a variant (typed union) If there is a BOM, will drop it. | |
std::variant< SliceU32Le, SliceU32Be > | mtcore::endian_from_slice (Slice< char32_t > s) |
Gets a UTF-32 endian slice from an input slice Will try to use the first character of the slice as a BOM to detect endianness If endian detection fails, will assume native endian Since endian slices are distinct types, this will return a variant (typed union) If there is a BOM, will drop it. | |
Slice< char16_t > | mtcore::slice_from_native_endian (SliceU16Native s) |
Gets a normal slice from a native endian slice. | |
Slice< const char16_t > | mtcore::slice_from_native_endian (SliceConstU16Native s) |
Gets a normal slice from a native endian slice. | |
Slice< char32_t > | mtcore::slice_from_native_endian (SliceU32Native s) |
Gets a normal slice from a native endian slice. | |
Slice< const char32_t > | mtcore::slice_from_native_endian (SliceConstU32Native s) |
Gets a normal slice from a native endian slice. | |
Slice< char16_t > | mtcore::slice_from_le_endian (SliceU16Native s) |
Gets a normal slice from a little endian slice. | |
Slice< const char16_t > | mtcore::slice_from_le_endian (SliceConstU16Native s) |
Gets a normal slice from a little endian slice. | |
Slice< char32_t > | mtcore::slice_from_le_endian (SliceU32Native s) |
Gets a normal slice from a little endian slice. | |
Slice< const char32_t > | mtcore::slice_from_le_endian (SliceConstU32Native s) |
Gets a normal slice from a little endian slice. | |
Slice< char16_t > | mtcore::slice_from_be_endian (SliceU16Native s) |
Gets a normal slice from a big endian slice. | |
Slice< const char16_t > | mtcore::slice_from_be_endian (SliceConstU16Native s) |
Gets a normal slice from a big endian slice. | |
Slice< char32_t > | mtcore::slice_from_be_endian (SliceU32Native s) |
Gets a normal slice from a big endian slice. | |
Slice< const char32_t > | mtcore::slice_from_be_endian (SliceConstU32Native s) |
Gets a normal slice from a big endian slice. | |
CharSeq | mtcore::rune_to_str (Rune rune) |
Converts a UTF-32 Rune to a sequence of char. | |
U8Seq | mtcore::rune_to_utf8 (Rune rune) |
Converts a UTF-32 Rune to a utf-8 sequence. | |
U16Seq | mtcore::rune_to_utf16 (Rune rune) |
Converts a UTF-32 Rune to a utf-16 sequence. | |
RuneIterator< char > | mtcore::str_rune_iterator (const Slice< const char > &s) |
Rune iterator for a slice of characters. | |
RuneIterator< char8_t > | mtcore::utf8_rune_iterator (const Slice< const char8_t > &s) |
Rune iterator for a UTF8 sequence. | |
RuneIterator< char16_t > | mtcore::utf16_rune_iterator (const Slice< const char16_t > &s) |
Rune iterator for a UTF16 sequence. | |
RuneIterator< char16_t > | mtcore::utf16_rune_iterator (const SliceConstU16Le &s) |
Rune iterator for a little endian UTF16 sequence. | |
RuneIterator< char16_t > | mtcore::utf16_rune_iterator (const SliceConstU16Be &s) |
Rune iterator for a big endian UTF16 sequence. | |
RuneIterator< char16_t > | mtcore::utf16_rune_iterator (const SliceU16Le &s) |
Rune iterator for a little endian UTF16 sequence. | |
RuneIterator< char16_t > | mtcore::utf16_rune_iterator (const SliceU16Be &s) |
Rune iterator for a big endian UTF16 sequence. | |
RuneIterator< char32_t > | mtcore::utf32_rune_iterator (const Slice< const char32_t > &s) |
Rune iterator for a UTF32 sequence. | |
RuneIterator< char32_t > | mtcore::utf32_rune_iterator (const SliceConstU32Le &s) |
Rune iterator for a little endian UTF32 sequence. | |
RuneIterator< char32_t > | mtcore::utf32_rune_iterator (const SliceConstU32Be &s) |
Rune iterator for a big endian UTF32 sequence. | |
RuneIterator< char32_t > | mtcore::utf32_rune_iterator (const SliceU32Le &s) |
Rune iterator for a little endian UTF32 sequence. | |
RuneIterator< char32_t > | mtcore::utf32_rune_iterator (const SliceU32Be &s) |
Rune iterator for a big endian UTF32 sequence. | |
template<WriterImpl WI> | |
auto | mtcore::utf32_to_utf16 (io::Writer< WI > &writer, const SliceConstU32Be &str, bool writeBom=false) -> Result< size_t, typename io::Writer< WI >::ErrType > |
Will convert a UTF-32 string to UTF-16 string Can optionally write a BOM to the prefix. | |
template<WriterImpl WI> | |
auto | mtcore::utf32_to_utf16 (io::Writer< WI > &writer, const SliceConstU32Le &str, bool writeBom=false) -> Result< size_t, typename io::Writer< WI >::ErrType > |
Will convert a UTF-32 string to UTF-16 string Can optionally write a BOM to the prefix. | |
template<WriterImpl WI> | |
auto | mtcore::utf32_to_utf16 (io::Writer< WI > &writer, const Slice< const char32_t > &str, bool writeBom=false) -> Result< size_t, typename io::Writer< WI >::ErrType > |
Will convert a UTF-32 string to UTF-16 string Can optionally write a BOM to the prefix. | |
template<WriterImpl WI> | |
auto | mtcore::utf32_to_utf8 (io::Writer< WI > &writer, const SliceConstU32Be &str) -> Result< size_t, typename io::Writer< WI >::ErrType > |
Will convert a UTF-32 string to UTF-8 string. | |
template<WriterImpl WI> | |
auto | mtcore::utf32_to_utf8 (io::Writer< WI > &writer, const SliceConstU32Le &str) -> Result< size_t, typename io::Writer< WI >::ErrType > |
Will convert a UTF-32 string to UTF-8 string. | |
template<WriterImpl WI> | |
auto | mtcore::utf32_to_utf8 (io::Writer< WI > &writer, const Slice< const char32_t > &str) -> Result< size_t, typename io::Writer< WI >::ErrType > |
Will convert a UTF-32 string to UTF-8 string. | |
template<WriterImpl WI> | |
auto | mtcore::utf32_to_str (io::Writer< WI > &writer, const SliceConstU32Be &str) -> Result< size_t, typename io::Writer< WI >::ErrType > |
Will convert a UTF-32 string to character sequence (UTF-8 encoded chars) | |
template<WriterImpl WI> | |
auto | mtcore::utf32_to_str (io::Writer< WI > &writer, const SliceConstU32Le &str) -> Result< size_t, typename io::Writer< WI >::ErrType > |
Will convert a UTF-32 string to character sequence (UTF-8 encoded chars) | |
template<WriterImpl WI> | |
auto | mtcore::utf32_to_str (io::Writer< WI > &writer, const Slice< const char32_t > &str) -> Result< size_t, typename io::Writer< WI >::ErrType > |
Will convert a UTF-32 string to character sequence (UTF-8 encoded chars) | |
template<WriterImpl WI> | |
auto | mtcore::utf8_to_utf32 (io::Writer< WI > &writer, const Slice< const char8_t > &str, bool writeBom=false) -> Result< size_t, typename io::Writer< WI >::ErrType > |
Will convert a UTF-8 string to UTF-32. | |
template<WriterImpl WI> | |
auto | mtcore::str_to_utf32 (io::Writer< WI > &writer, const Slice< const char > &str, bool writeBom=false) -> Result< size_t, typename io::Writer< WI >::ErrType > |
Will convert a UTF-8 string to UTF-32. | |
template<WriterImpl WI> | |
auto | mtcore::utf16_to_utf8 (io::Writer< WI > &writer, const SliceConstU16Be &str) -> Result< size_t, typename io::Writer< WI >::ErrType > |
Will convert a UTF-16 string to UTF-8. | |
template<WriterImpl WI> | |
auto | mtcore::utf16_to_utf32 (io::Writer< WI > &writer, const SliceConstU16Le &str, bool writeBom=false) -> Result< size_t, typename io::Writer< WI >::ErrType > |
Will convert a UTF-16 string to UTF-32. | |
template<WriterImpl WI> | |
auto | mtcore::utf16_to_utf32 (io::Writer< WI > &writer, const SliceConstU16Be &str, bool writeBom=false) -> Result< size_t, typename io::Writer< WI >::ErrType > |
Will convert a UTF-16 string to UTF-32. | |
template<WriterImpl WI> | |
auto | mtcore::utf16_to_utf32 (io::Writer< WI > &writer, const Slice< const char16_t > &str, bool writeBom=false) -> Result< size_t, typename io::Writer< WI >::ErrType > |
Will convert a UTF-16 string to UTF-32. | |
template<WriterImpl WI> | |
auto | mtcore::utf16_to_utf8 (io::Writer< WI > &writer, const SliceConstU16Le &str) -> Result< size_t, typename io::Writer< WI >::ErrType > |
Will convert a UTF-16 string to UTF-8. | |
template<WriterImpl WI> | |
auto | mtcore::utf16_to_str (io::Writer< WI > &writer, const SliceConstU16Be &str) -> Result< size_t, typename io::Writer< WI >::ErrType > |
Will convert a UTF-16 string to UTF-8. | |
template<WriterImpl WI> | |
auto | mtcore::utf16_to_str (io::Writer< WI > &writer, const SliceConstU16Le &str) -> Result< size_t, typename io::Writer< WI >::ErrType > |
Will convert a UTF-16 string to UTF-8. | |
template<WriterImpl WI> | |
auto | mtcore::utf16_to_utf8 (io::Writer< WI > &writer, const Slice< const char16_t > &str) -> Result< size_t, typename io::Writer< WI >::ErrType > |
Will convert a UTF-16 string to UTF-8. | |
template<WriterImpl WI> | |
auto | mtcore::utf16_to_str (io::Writer< WI > &writer, const Slice< const char16_t > &str) -> Result< size_t, typename io::Writer< WI >::ErrType > |
Will convert a UTF-16 string to UTF-8. | |
template<WriterImpl WI> | |
auto | mtcore::utf8_to_utf16 (io::Writer< WI > &writer, const Slice< const char8_t > &str, bool writeBom=false) -> Result< size_t, typename io::Writer< WI >::ErrType > |
Will convert a UTF-8 string to UTF-16. | |
template<WriterImpl WI> | |
auto | mtcore::str_to_utf16 (io::Writer< WI > &writer, const Slice< const char > &str, bool writeBom=false) -> Result< size_t, typename io::Writer< WI >::ErrType > |
Will convert a UTF-8 string to UTF-16. | |
template<WriterImpl WI> | |
auto | mtcore::utf8_to_str (io::Writer< WI > &writer, const Slice< const char8_t > &str) -> Result< size_t, typename io::Writer< WI >::ErrType > |
Will convert a UTF-8 string to character sequence. | |
template<WriterImpl WI> | |
auto | mtcore::str_to_utf8 (io::Writer< WI > &writer, const Slice< const char > &str) -> Result< size_t, typename io::Writer< WI >::ErrType > |
Will convert a character sequence to UTF-8 string. | |
template<WriterImpl WI> | |
auto | mtcore::utf16_to_utf16le (io::Writer< WI > &writer, const SliceConstU16Native &str, bool writeBom=false) -> Result< size_t, typename io::Writer< WI >::ErrType > |
Converts native UTF-16 to UTF-16 Little Endian. | |
template<WriterImpl WI> | |
auto | mtcore::utf16_to_utf16le (io::Writer< WI > &writer, const Slice< const char16_t > &str, bool writeBom=false) -> Result< size_t, typename io::Writer< WI >::ErrType > |
Converts native UTF-16 to UTF-16 Little Endian. | |
template<WriterImpl WI> | |
auto | mtcore::utf16_to_utf16be (io::Writer< WI > &writer, const SliceConstU16Native &str, bool writeBom=false) -> Result< size_t, typename io::Writer< WI >::ErrType > |
Converts native UTF-16 to UTF-16 Big Endian. | |
template<WriterImpl WI> | |
auto | mtcore::utf16_to_utf16be (io::Writer< WI > &writer, const Slice< const char16_t > &str, bool writeBom=false) -> Result< size_t, typename io::Writer< WI >::ErrType > |
Converts native UTF-16 to UTF-16 Big Endian. | |
template<WriterImpl WI> | |
auto | mtcore::utf16le_to_utf16be (io::Writer< WI > &writer, const SliceConstU16Le &str, bool writeBom=false) -> Result< size_t, typename io::Writer< WI >::ErrType > |
Converts UTF-16 Little Endian to UTF-16 Big Endian. | |
template<WriterImpl WI> | |
auto | mtcore::utf16be_to_utf16le (io::Writer< WI > &writer, const SliceConstU16Be &str, bool writeBom=false) -> Result< size_t, typename io::Writer< WI >::ErrType > |
Converts UTF-16 Big Endian to UTF-16 Little Endian. | |
template<WriterImpl WI> | |
auto | mtcore::utf16le_to_utf16 (io::Writer< WI > &writer, const SliceConstU16Le &str, bool writeBom=false) -> Result< size_t, typename io::Writer< WI >::ErrType > |
Converts UTF-16 Little Endian to Native UTF-16. | |
template<WriterImpl WI> | |
auto | mtcore::utf16be_to_utf16 (io::Writer< WI > &writer, const SliceConstU16Be &str, bool writeBom=false) -> Result< size_t, typename io::Writer< WI >::ErrType > |
Converts UTF-16 Big Endian to Native UTF-16. | |
template<WriterImpl WI> | |
auto | mtcore::utf32_to_utf32le (io::Writer< WI > &writer, const SliceConstU32Native &str, bool writeBom=false) -> Result< size_t, typename io::Writer< WI >::ErrType > |
Converts UTF-32 Native Endian to UTF-32 Little Endian. | |
template<WriterImpl WI> | |
auto | mtcore::utf32_to_utf32le (io::Writer< WI > &writer, const Slice< const char32_t > &str, bool writeBom=false) -> Result< size_t, typename io::Writer< WI >::ErrType > |
Converts UTF-32 Native Endian to UTF-32 Little Endian. | |
template<WriterImpl WI> | |
auto | mtcore::utf32_to_utf32be (io::Writer< WI > &writer, const SliceConstU32Native &str, bool writeBom=false) -> Result< size_t, typename io::Writer< WI >::ErrType > |
Converts UTF-32 Native Endian to UTF-32 Big Endian. | |
template<WriterImpl WI> | |
auto | mtcore::utf32_to_utf32be (io::Writer< WI > &writer, const Slice< const char32_t > &str, bool writeBom=false) -> Result< size_t, typename io::Writer< WI >::ErrType > |
Converts UTF-32 Native Endian to UTF-32 Big Endian. | |
template<WriterImpl WI> | |
auto | mtcore::utf32le_to_utf32be (io::Writer< WI > &writer, const SliceConstU32Le &str, bool writeBom=false) -> Result< size_t, typename io::Writer< WI >::ErrType > |
Converts UTF-32 Little Endian to UTF-32 Big Endian. | |
template<WriterImpl WI> | |
auto | mtcore::utf32be_to_utf32le (io::Writer< WI > &writer, const SliceConstU32Be &str, bool writeBom=false) -> Result< size_t, typename io::Writer< WI >::ErrType > |
Converts UTF-32 Big Endian to UTF-32 Little Endian. | |
template<WriterImpl WI> | |
auto | mtcore::utf32le_to_utf32 (io::Writer< WI > &writer, const SliceConstU32Le &str, bool writeBom=false) -> Result< size_t, typename io::Writer< WI >::ErrType > |
Converts UTF-32 Little Endian to UTF-32 Native Endian. | |
template<WriterImpl WI> | |
auto | mtcore::utf32be_to_utf32 (io::Writer< WI > &writer, const SliceConstU32Be &str, bool writeBom=false) -> Result< size_t, typename io::Writer< WI >::ErrType > |
Converts UTF-32 Big Endian to UTF-32 Native Endian. | |
Variables | |
constexpr char32_t | mtcore::bom = 0xFEFF |
Native representation of Byte Order Mark (BOM) | |
template<std::endian E = std::endian::native> | |
constexpr auto | mtcore::oppositeEndian = E == std::endian::big ? std::endian::little : std::endian::big |
Returns the opposite endianness of a given endian (default is opposite of the native endian) | |
Group related to unicode encodings (including UTF8, UTF16, UTF32 ane endianness)
using mtcore::SliceConstU16Be = EndianSlice<const char16_t, std::endian::big> |
Slice type representing const big endian UTF-16 string *.
Definition at line 523 of file byte_endian.hpp.
using mtcore::SliceConstU16Le = EndianSlice<const char16_t, std::endian::little> |
Slice type representing const little endian UTF-16 string *.
Definition at line 519 of file byte_endian.hpp.
using mtcore::SliceConstU16Native = EndianSlice<const char16_t, std::endian::native> |
Slice type representing const native UTF-16 string *.
Definition at line 515 of file byte_endian.hpp.
using mtcore::SliceConstU32Be = EndianSlice<const char32_t, std::endian::big> |
Slice type representing const big endian UTF-32 string.
Definition at line 552 of file byte_endian.hpp.
using mtcore::SliceConstU32Le = EndianSlice<const char32_t, std::endian::little> |
Slice type representing const little endian UTF-32 string.
Definition at line 547 of file byte_endian.hpp.
using mtcore::SliceConstU32Native = EndianSlice<const char32_t, std::endian::native> |
Slice type representing const native UTF-32 string.
Definition at line 542 of file byte_endian.hpp.
using mtcore::SliceU16Be = EndianSlice<char16_t, std::endian::big> |
Slice type representing big endian UTF-16 string *.
Definition at line 511 of file byte_endian.hpp.
using mtcore::SliceU16Le = EndianSlice<char16_t, std::endian::little> |
Slice type representing little endian UTF-16 string *.
Definition at line 507 of file byte_endian.hpp.
using mtcore::SliceU16Native = EndianSlice<char16_t, std::endian::native> |
Slice type representing native UTF-16 string *.
Definition at line 503 of file byte_endian.hpp.
using mtcore::SliceU32Be = EndianSlice<char32_t, std::endian::big> |
Slice type representing big endian UTF-32 string.
Definition at line 537 of file byte_endian.hpp.
using mtcore::SliceU32Le = EndianSlice<char32_t, std::endian::little> |
Slice type representing little endian UTF-32 string *.
Definition at line 532 of file byte_endian.hpp.
using mtcore::SliceU32Native = EndianSlice<char32_t, std::endian::native> |
Slice type representing native UTF-32 string *.
Definition at line 528 of file byte_endian.hpp.
|
inline |
Gets a UTF-16 endian slice from a slice which is assumed ot be big endian.
Gets a const UTF-16 endian slice from a slice which is assumed ot be big endian ingroup unicode_enc.
Definition at line 580 of file byte_endian.hpp.
|
inline |
Gets a UTF-32 endian slice from a slice which is assumed ot be big endian.
Gets a const UTF-32 endian slice from a slice which is assumed ot be big endian ingroup unicode_enc.
Definition at line 585 of file byte_endian.hpp.
|
inline |
Gets a UTF-16 endian slice from a slice which is assumed ot be little endian.
Gets a const UTF-16 endian slice from a slice which is assumed ot be little endian.
Definition at line 569 of file byte_endian.hpp.
|
inline |
Gets a UTF-32 endian slice from a slice which is assumed ot be little endian.
Gets a const UTF-32 endian slice from a slice which is assumed ot be little endian.
Definition at line 574 of file byte_endian.hpp.
|
inline |
Gets a UTF-16 endian slice from a slice which is assumed ot be native endian.
Gets a const UTF-16 endian slice from a slice which is assumed ot be native endian.
Definition at line 558 of file byte_endian.hpp.
|
inline |
Gets a UTF-32 endian slice from a slice which is assumed ot be native endian.
Definition at line 563 of file byte_endian.hpp.
|
inline |
Gets a UTF-16 endian slice from an input slice Will try to use the first character of the slice as a BOM to detect endianness If endian detection fails, will assume native endian Since endian slices are distinct types, this will return a variant (typed union) If there is a BOM, will drop it.
Gets a const UTF-16 endian slice from an input slice Will try to use the first character of the slice as a BOM to detect endianness If endian detection fails, will assume native endian Since endian slices are distinct types, this will return a variant (typed union) If there is a BOM, will drop it.
Definition at line 632 of file byte_endian.hpp.
|
inline |
Gets a UTF-32 endian slice from an input slice Will try to use the first character of the slice as a BOM to detect endianness If endian detection fails, will assume native endian Since endian slices are distinct types, this will return a variant (typed union) If there is a BOM, will drop it.
Gets a const UTF-32 endian slice from an input slice Will try to use the first character of the slice as a BOM to detect endianness If endian detection fails, will assume native endian Since endian slices are distinct types, this will return a variant (typed union) If there is a BOM, will drop it.
Definition at line 655 of file byte_endian.hpp.
|
constexpr |
Checks if a character is a BOM in native ordering.
Definition at line 45 of file byte_endian.hpp.
|
constexpr |
Checks if a 16-bit character is a BOM in reverse ordering.
Definition at line 50 of file byte_endian.hpp.
|
constexpr |
Checks if a 32-bit character is a BOM in reverse ordering.
Definition at line 55 of file byte_endian.hpp.
|
constexpr |
Checks if UTF-16 character is a high surrogate *.
Definition at line 147 of file byte_endian.hpp.
|
constexpr |
Checks if UTF-16 character is a low surrogate *.
Definition at line 151 of file byte_endian.hpp.
|
constexpr |
Checks if UTF-16 character is a surrogate.
Definition at line 143 of file byte_endian.hpp.
|
inline |
Gets a normal slice from a big endian slice.
Does NOT flip endianness of data or add BOM
Definition at line 771 of file byte_endian.hpp.
|
inline |
Gets a normal slice from a big endian slice.
Does NOT flip endianness of data or add BOM
Definition at line 781 of file byte_endian.hpp.
|
inline |
Gets a normal slice from a big endian slice.
Does NOT flip endianness of data or add BOM
Definition at line 766 of file byte_endian.hpp.
|
inline |
Gets a normal slice from a big endian slice.
Does NOT flip endianness of data or add BOM
Definition at line 776 of file byte_endian.hpp.
|
inline |
Gets a normal slice from a little endian slice.
Does NOT flip endianness of data or add BOM
Definition at line 750 of file byte_endian.hpp.
|
inline |
Gets a normal slice from a little endian slice.
Does NOT flip endianness of data or add BOM
Definition at line 760 of file byte_endian.hpp.
|
inline |
Gets a normal slice from a little endian slice.
Does NOT flip endianness of data or add BOM
Definition at line 745 of file byte_endian.hpp.
|
inline |
Gets a normal slice from a little endian slice.
Does NOT flip endianness of data or add BOM
Definition at line 755 of file byte_endian.hpp.
|
inline |
Gets a normal slice from a native endian slice.
Does NOT flip endianness of data or add BOM
Definition at line 725 of file byte_endian.hpp.
|
inline |
Gets a normal slice from a native endian slice.
Does NOT flip endianness of data or add BOM
Definition at line 737 of file byte_endian.hpp.
|
inline |
Gets a normal slice from a native endian slice.
Does NOT flip endianness of data or add BOM
Definition at line 720 of file byte_endian.hpp.
|
inline |
Gets a normal slice from a native endian slice.
Does NOT flip endianness of data or add BOM
Definition at line 732 of file byte_endian.hpp.
|
inline |
Rune iterator for a slice of characters.
Definition at line 991 of file byte_endian.hpp.
auto mtcore::str_to_utf16 | ( | io::Writer< WI > & | writer, |
const Slice< const char > & | str, | ||
bool | writeBom = false ) -> Result<size_t, typename io::Writer<WI>::ErrType> |
Will convert a UTF-8 string to UTF-16.
WI | Writer type |
writer | Writer to write output to (should take char as input) |
str | UTF-8 string to write |
writeBom | If it should write a BOM |
Definition at line 1652 of file byte_endian.hpp.
auto mtcore::str_to_utf32 | ( | io::Writer< WI > & | writer, |
const Slice< const char > & | str, | ||
bool | writeBom = false ) -> Result<size_t, typename io::Writer<WI>::ErrType> |
Will convert a UTF-8 string to UTF-32.
WI | Writer type |
writer | Writer to write output to (should take char as input) |
str | UTF-8 string to write |
writeBom | If it should write a BOM |
Definition at line 1367 of file byte_endian.hpp.
auto mtcore::str_to_utf8 | ( | io::Writer< WI > & | writer, |
const Slice< const char > & | str ) -> Result<size_t, typename io::Writer<WI>::ErrType> |
Will convert a character sequence to UTF-8 string.
WI | Writer type |
writer | Writer to write output to (should take char as input) |
str | UTF-8 string to write |
Definition at line 1716 of file byte_endian.hpp.
|
inline |
Tries to detect the endian encoding based on a possible BOM mark.
ch | Character to detect ordering from (should be a BOM or reverse BOM) |
Definition at line 66 of file byte_endian.hpp.
|
inline |
Tries to detect the endian encoding based on a possible BOM mark.
ch | Character to detect ordering from (should be a BOM or reverse BOM) |
Definition at line 84 of file byte_endian.hpp.
|
inline |
Rune iterator for a UTF16 sequence.
Will try to auto detect endianness from BOM. Will drop BOM if present
Definition at line 1003 of file byte_endian.hpp.
|
inline |
Rune iterator for a big endian UTF16 sequence.
Definition at line 1025 of file byte_endian.hpp.
|
inline |
Rune iterator for a little endian UTF16 sequence.
Definition at line 1016 of file byte_endian.hpp.
|
inline |
Rune iterator for a big endian UTF16 sequence.
Definition at line 1043 of file byte_endian.hpp.
|
inline |
Rune iterator for a little endian UTF16 sequence.
Definition at line 1034 of file byte_endian.hpp.
auto mtcore::utf16_to_str | ( | io::Writer< WI > & | writer, |
const Slice< const char16_t > & | str ) -> Result<size_t, typename io::Writer<WI>::ErrType> |
Will convert a UTF-16 string to UTF-8.
WI | Writer type |
writer | Writer to write output to (should take char as input) |
str | UTF-16 string to write (native endian) |
Definition at line 1600 of file byte_endian.hpp.
auto mtcore::utf16_to_str | ( | io::Writer< WI > & | writer, |
const SliceConstU16Be & | str ) -> Result<size_t, typename io::Writer<WI>::ErrType> |
Will convert a UTF-16 string to UTF-8.
WI | Writer type |
writer | Writer to write output to (should take char as input) |
str | UTF-16 string to write (big endian) |
Definition at line 1532 of file byte_endian.hpp.
auto mtcore::utf16_to_str | ( | io::Writer< WI > & | writer, |
const SliceConstU16Le & | str ) -> Result<size_t, typename io::Writer<WI>::ErrType> |
Will convert a UTF-16 string to UTF-8.
WI | Writer type |
writer | Writer to write output to (should take char as input) |
str | UTF-16 string to write (little endian) |
Definition at line 1559 of file byte_endian.hpp.
auto mtcore::utf16_to_utf16be | ( | io::Writer< WI > & | writer, |
const Slice< const char16_t > & | str, | ||
bool | writeBom = false ) -> Result<size_t, typename io::Writer<WI>::ErrType> |
Converts native UTF-16 to UTF-16 Big Endian.
WI | Writer Type |
writer | Writer |
str | UTF-16 (native) to write |
writeBom | If it should write BOM |
Definition at line 1839 of file byte_endian.hpp.
auto mtcore::utf16_to_utf16be | ( | io::Writer< WI > & | writer, |
const SliceConstU16Native & | str, | ||
bool | writeBom = false ) -> Result<size_t, typename io::Writer<WI>::ErrType> |
Converts native UTF-16 to UTF-16 Big Endian.
WI | Writer Type |
writer | Writer |
str | UTF-16 (native) to write |
writeBom | If it should write BOM |
Definition at line 1799 of file byte_endian.hpp.
auto mtcore::utf16_to_utf16le | ( | io::Writer< WI > & | writer, |
const Slice< const char16_t > & | str, | ||
bool | writeBom = false ) -> Result<size_t, typename io::Writer<WI>::ErrType> |
Converts native UTF-16 to UTF-16 Little Endian.
WI | Writer Type |
writer | Writer |
str | UTF-16 (native) to write |
writeBom | If it should write BOM |
Definition at line 1784 of file byte_endian.hpp.
auto mtcore::utf16_to_utf16le | ( | io::Writer< WI > & | writer, |
const SliceConstU16Native & | str, | ||
bool | writeBom = false ) -> Result<size_t, typename io::Writer<WI>::ErrType> |
Converts native UTF-16 to UTF-16 Little Endian.
WI | Writer Type |
writer | Writer |
str | UTF-16 (native) to write |
writeBom | If it should write BOM |
Definition at line 1744 of file byte_endian.hpp.
auto mtcore::utf16_to_utf32 | ( | io::Writer< WI > & | writer, |
const Slice< const char16_t > & | str, | ||
bool | writeBom = false ) -> Result<size_t, typename io::Writer<WI>::ErrType> |
Will convert a UTF-16 string to UTF-32.
WI | Writer type |
writer | Writer to write output to (should take char as input) |
str | UTF-16 string to write (native endian) |
writeBom | If it should write a BOM |
Definition at line 1491 of file byte_endian.hpp.
auto mtcore::utf16_to_utf32 | ( | io::Writer< WI > & | writer, |
const SliceConstU16Be & | str, | ||
bool | writeBom = false ) -> Result<size_t, typename io::Writer<WI>::ErrType> |
Will convert a UTF-16 string to UTF-32.
WI | Writer type |
writer | Writer to write output to (should take char as input) |
str | UTF-16 string to write (big endian) |
writeBom | If it should write a BOM |
Definition at line 1459 of file byte_endian.hpp.
auto mtcore::utf16_to_utf32 | ( | io::Writer< WI > & | writer, |
const SliceConstU16Le & | str, | ||
bool | writeBom = false ) -> Result<size_t, typename io::Writer<WI>::ErrType> |
Will convert a UTF-16 string to UTF-32.
WI | Writer type |
writer | Writer to write output to (should take char as input) |
str | UTF-16 string to write (little endian) |
writeBom | If it should write a BOM |
Definition at line 1427 of file byte_endian.hpp.
auto mtcore::utf16_to_utf8 | ( | io::Writer< WI > & | writer, |
const Slice< const char16_t > & | str ) -> Result<size_t, typename io::Writer<WI>::ErrType> |
Will convert a UTF-16 string to UTF-8.
WI | Writer type |
writer | Writer to write output to (should take char as input) |
str | UTF-16 string to write (native endian) |
Definition at line 1586 of file byte_endian.hpp.
auto mtcore::utf16_to_utf8 | ( | io::Writer< WI > & | writer, |
const SliceConstU16Be & | str ) -> Result<size_t, typename io::Writer<WI>::ErrType> |
Will convert a UTF-16 string to UTF-8.
WI | Writer type |
writer | Writer to write output to (should take char as input) |
str | UTF-16 string to write (little endian) |
Definition at line 1398 of file byte_endian.hpp.
auto mtcore::utf16_to_utf8 | ( | io::Writer< WI > & | writer, |
const SliceConstU16Le & | str ) -> Result<size_t, typename io::Writer<WI>::ErrType> |
Will convert a UTF-16 string to UTF-8.
WI | Writer type |
writer | Writer to write output to (should take char as input) |
str | UTF-16 string to write (little endian) |
Definition at line 1505 of file byte_endian.hpp.
auto mtcore::utf16be_to_utf16 | ( | io::Writer< WI > & | writer, |
const SliceConstU16Be & | str, | ||
bool | writeBom = false ) -> Result<size_t, typename io::Writer<WI>::ErrType> |
Converts UTF-16 Big Endian to Native UTF-16.
WI | Writer Type |
writer | Writer |
str | UTF-16 (big endian) to write |
writeBom | If it should write BOM |
Definition at line 1971 of file byte_endian.hpp.
auto mtcore::utf16be_to_utf16le | ( | io::Writer< WI > & | writer, |
const SliceConstU16Be & | str, | ||
bool | writeBom = false ) -> Result<size_t, typename io::Writer<WI>::ErrType> |
Converts UTF-16 Big Endian to UTF-16 Little Endian.
WI | Writer Type |
writer | Writer |
str | UTF-16 (little endian) to write |
writeBom | If it should write BOM |
Definition at line 1894 of file byte_endian.hpp.
auto mtcore::utf16le_to_utf16 | ( | io::Writer< WI > & | writer, |
const SliceConstU16Le & | str, | ||
bool | writeBom = false ) -> Result<size_t, typename io::Writer<WI>::ErrType> |
Converts UTF-16 Little Endian to Native UTF-16.
WI | Writer Type |
writer | Writer |
str | UTF-16 (little endian) to write |
writeBom | If it should write BOM |
Definition at line 1934 of file byte_endian.hpp.
auto mtcore::utf16le_to_utf16be | ( | io::Writer< WI > & | writer, |
const SliceConstU16Le & | str, | ||
bool | writeBom = false ) -> Result<size_t, typename io::Writer<WI>::ErrType> |
Converts UTF-16 Little Endian to UTF-16 Big Endian.
WI | Writer Type |
writer | Writer |
str | UTF-16 (little endian) to write |
writeBom | If it should write BOM |
Definition at line 1854 of file byte_endian.hpp.
|
inline |
Rune iterator for a UTF32 sequence.
Will try to auto detect endian from BO. Will drop BOM if presentM
Definition at line 1052 of file byte_endian.hpp.
|
inline |
Rune iterator for a big endian UTF32 sequence.
Definition at line 1074 of file byte_endian.hpp.
|
inline |
Rune iterator for a little endian UTF32 sequence.
Definition at line 1065 of file byte_endian.hpp.
|
inline |
Rune iterator for a big endian UTF32 sequence.
Definition at line 1092 of file byte_endian.hpp.
|
inline |
Rune iterator for a little endian UTF32 sequence.
Definition at line 1083 of file byte_endian.hpp.
auto mtcore::utf32_to_str | ( | io::Writer< WI > & | writer, |
const Slice< const char32_t > & | str ) -> Result<size_t, typename io::Writer<WI>::ErrType> |
Will convert a UTF-32 string to character sequence (UTF-8 encoded chars)
WI | Writer type |
writer | Writer to write output to (should take char as input) |
str | UTF-32 string to write (native endian) |
Definition at line 1320 of file byte_endian.hpp.
auto mtcore::utf32_to_str | ( | io::Writer< WI > & | writer, |
const SliceConstU32Be & | str ) -> Result<size_t, typename io::Writer<WI>::ErrType> |
Will convert a UTF-32 string to character sequence (UTF-8 encoded chars)
WI | Writer type |
writer | Writer to write output to (should take char as input) |
str | UTF-32 string to write (big endian) |
Definition at line 1266 of file byte_endian.hpp.
auto mtcore::utf32_to_str | ( | io::Writer< WI > & | writer, |
const SliceConstU32Le & | str ) -> Result<size_t, typename io::Writer<WI>::ErrType> |
Will convert a UTF-32 string to character sequence (UTF-8 encoded chars)
WI | Writer type |
writer | Writer to write output to (should take char as input) |
str | UTF-32 string to write (little endian) |
Definition at line 1293 of file byte_endian.hpp.
auto mtcore::utf32_to_utf16 | ( | io::Writer< WI > & | writer, |
const Slice< const char32_t > & | str, | ||
bool | writeBom = false ) -> Result<size_t, typename io::Writer<WI>::ErrType> |
Will convert a UTF-32 string to UTF-16 string Can optionally write a BOM to the prefix.
WI | Writer type |
writer | Writer to write output to (should take char16_t as input) |
str | UTF-32 string to write (native endian) |
writeBom | If it should write the BOM (will write it in native endian) |
Definition at line 1184 of file byte_endian.hpp.
auto mtcore::utf32_to_utf16 | ( | io::Writer< WI > & | writer, |
const SliceConstU32Be & | str, | ||
bool | writeBom = false ) -> Result<size_t, typename io::Writer<WI>::ErrType> |
Will convert a UTF-32 string to UTF-16 string Can optionally write a BOM to the prefix.
WI | Writer type |
writer | Writer to write output to (should take char16_t as input) |
str | UTF-32 string to write (big endian) |
writeBom | If it should write the BOM (will write it in native endian) |
Definition at line 1108 of file byte_endian.hpp.
auto mtcore::utf32_to_utf16 | ( | io::Writer< WI > & | writer, |
const SliceConstU32Le & | str, | ||
bool | writeBom = false ) -> Result<size_t, typename io::Writer<WI>::ErrType> |
Will convert a UTF-32 string to UTF-16 string Can optionally write a BOM to the prefix.
WI | Writer type |
writer | Writer to write output to (should take char16_t as input) |
str | UTF-32 string to write (little endian) |
writeBom | If it should write the BOM (will write it in native endian) |
Definition at line 1146 of file byte_endian.hpp.
auto mtcore::utf32_to_utf32be | ( | io::Writer< WI > & | writer, |
const Slice< const char32_t > & | str, | ||
bool | writeBom = false ) -> Result<size_t, typename io::Writer<WI>::ErrType> |
Converts UTF-32 Native Endian to UTF-32 Big Endian.
WI | Writer Type |
writer | Writer |
str | UTF-32 (big endian) to write |
writeBom | If it should write BOM |
Definition at line 2093 of file byte_endian.hpp.
auto mtcore::utf32_to_utf32be | ( | io::Writer< WI > & | writer, |
const SliceConstU32Native & | str, | ||
bool | writeBom = false ) -> Result<size_t, typename io::Writer<WI>::ErrType> |
Converts UTF-32 Native Endian to UTF-32 Big Endian.
WI | Writer Type |
writer | Writer |
str | UTF-32 (big endian) to write |
writeBom | If it should write BOM |
Definition at line 2058 of file byte_endian.hpp.
auto mtcore::utf32_to_utf32le | ( | io::Writer< WI > & | writer, |
const Slice< const char32_t > & | str, | ||
bool | writeBom = false ) -> Result<size_t, typename io::Writer<WI>::ErrType> |
Converts UTF-32 Native Endian to UTF-32 Little Endian.
WI | Writer Type |
writer | Writer |
str | UTF-32 (little endian) to write |
writeBom | If it should write BOM |
Definition at line 2043 of file byte_endian.hpp.
auto mtcore::utf32_to_utf32le | ( | io::Writer< WI > & | writer, |
const SliceConstU32Native & | str, | ||
bool | writeBom = false ) -> Result<size_t, typename io::Writer<WI>::ErrType> |
Converts UTF-32 Native Endian to UTF-32 Little Endian.
WI | Writer Type |
writer | Writer |
str | UTF-32 (little endian) to write |
writeBom | If it should write BOM |
Definition at line 2008 of file byte_endian.hpp.
auto mtcore::utf32_to_utf8 | ( | io::Writer< WI > & | writer, |
const Slice< const char32_t > & | str ) -> Result<size_t, typename io::Writer<WI>::ErrType> |
Will convert a UTF-32 string to UTF-8 string.
WI | Writer type |
writer | Writer to write output to (should take char8_t as input) |
str | UTF-32 string to write (native endian) |
Definition at line 1252 of file byte_endian.hpp.
auto mtcore::utf32_to_utf8 | ( | io::Writer< WI > & | writer, |
const SliceConstU32Be & | str ) -> Result<size_t, typename io::Writer<WI>::ErrType> |
Will convert a UTF-32 string to UTF-8 string.
WI | Writer type |
writer | Writer to write output to (should take char8_t as input) |
str | UTF-32 string to write (big endian) |
Definition at line 1198 of file byte_endian.hpp.
auto mtcore::utf32_to_utf8 | ( | io::Writer< WI > & | writer, |
const SliceConstU32Le & | str ) -> Result<size_t, typename io::Writer<WI>::ErrType> |
Will convert a UTF-32 string to UTF-8 string.
WI | Writer type |
writer | Writer to write output to (should take char8_t as input) |
str | UTF-32 string to write (little endian) |
Definition at line 1225 of file byte_endian.hpp.
auto mtcore::utf32be_to_utf32 | ( | io::Writer< WI > & | writer, |
const SliceConstU32Be & | str, | ||
bool | writeBom = false ) -> Result<size_t, typename io::Writer<WI>::ErrType> |
Converts UTF-32 Big Endian to UTF-32 Native Endian.
WI | Writer Type |
writer | Writer |
str | UTF-32 (little endian) to write |
writeBom | If it should write BOM |
Definition at line 2210 of file byte_endian.hpp.
auto mtcore::utf32be_to_utf32le | ( | io::Writer< WI > & | writer, |
const SliceConstU32Be & | str, | ||
bool | writeBom = false ) -> Result<size_t, typename io::Writer<WI>::ErrType> |
Converts UTF-32 Big Endian to UTF-32 Little Endian.
WI | Writer Type |
writer | Writer |
str | UTF-32 (little endian) to write |
writeBom | If it should write BOM |
Definition at line 2143 of file byte_endian.hpp.
auto mtcore::utf32le_to_utf32 | ( | io::Writer< WI > & | writer, |
const SliceConstU32Le & | str, | ||
bool | writeBom = false ) -> Result<size_t, typename io::Writer<WI>::ErrType> |
Converts UTF-32 Little Endian to UTF-32 Native Endian.
WI | Writer Type |
writer | Writer |
str | UTF-32 (little endian) to write |
writeBom | If it should write BOM |
Definition at line 2178 of file byte_endian.hpp.
auto mtcore::utf32le_to_utf32be | ( | io::Writer< WI > & | writer, |
const SliceConstU32Le & | str, | ||
bool | writeBom = false ) -> Result<size_t, typename io::Writer<WI>::ErrType> |
Converts UTF-32 Little Endian to UTF-32 Big Endian.
WI | Writer Type |
writer | Writer |
str | UTF-32 (little endian) to write |
writeBom | If it should write BOM |
Definition at line 2108 of file byte_endian.hpp.
|
inline |
Rune iterator for a UTF8 sequence.
Definition at line 997 of file byte_endian.hpp.
auto mtcore::utf8_to_str | ( | io::Writer< WI > & | writer, |
const Slice< const char8_t > & | str ) -> Result<size_t, typename io::Writer<WI>::ErrType> |
Will convert a UTF-8 string to character sequence.
WI | Writer type |
writer | Writer to write output to (should take char as input) |
str | UTF-8 string to write |
Definition at line 1688 of file byte_endian.hpp.
auto mtcore::utf8_to_utf16 | ( | io::Writer< WI > & | writer, |
const Slice< const char8_t > & | str, | ||
bool | writeBom = false ) -> Result<size_t, typename io::Writer<WI>::ErrType> |
Will convert a UTF-8 string to UTF-16.
WI | Writer type |
writer | Writer to write output to (should take char as input) |
str | UTF-8 string to write |
writeBom | If it should write a BOM |
Definition at line 1615 of file byte_endian.hpp.
auto mtcore::utf8_to_utf32 | ( | io::Writer< WI > & | writer, |
const Slice< const char8_t > & | str, | ||
bool | writeBom = false ) -> Result<size_t, typename io::Writer<WI>::ErrType> |
Will convert a UTF-8 string to UTF-32.
WI | Writer type |
writer | Writer to write output to (should take char as input) |
str | UTF-8 string to write |
writeBom | If it should write a BOM |
Definition at line 1335 of file byte_endian.hpp.
|
constexpr |
Native representation of Byte Order Mark (BOM)
Definition at line 39 of file byte_endian.hpp.
|
constexpr |
Returns the opposite endianness of a given endian (default is opposite of the native endian)
Definition at line 158 of file byte_endian.hpp.