CommonLib
Loading...
Searching...
No Matches
hedgedev::csl::ut::expr Namespace Reference

Classes

struct  get_char_type
struct  get_char_type< T >
struct  get_encoding_char_type
struct  get_encoding_char_type< encoding::utf16_be >
struct  get_encoding_char_type< encoding::utf16_le >
struct  get_encoding_char_type< encoding::utf32_be >
struct  get_encoding_char_type< encoding::utf32_le >
struct  get_encoding_char_type< encoding::utf8 >
struct  is_basic_string
struct  is_basic_string< std::basic_string< T_char, T_traits, T_alloc > >
struct  is_basic_string_view
struct  is_basic_string_view< std::basic_string_view< T_char, T_traits > >

Concepts

concept  any_raw_string
concept  any_string
concept  any_string_u16
concept  any_string_u32
concept  any_string_u8
concept  any_string_w
concept  any_vector
concept  basic_string
concept  basic_string_view
concept  raw_string_c
concept  raw_string_u16
concept  raw_string_u32
concept  raw_string_u8
concept  raw_string_w
concept  vector_like

Typedefs

template<size_t index, typename... T_args>
using get_pack_type_t = std::tuple_element_t<index, std::tuple<T_args...>>
template<size_t size = sizeof(size_t), bool is_signed = false>
using inferred_size_t
template<typename T>
using get_char_type_t = typename get_char_type<std::remove_cvref_t<T>>::type
template<any_string T>
using inferred_string_t = std::basic_string<get_char_type_t<T>>
template<any_string T>
using inferred_string_view_t = std::basic_string_view<get_char_type_t<T>>
template<any_string T>
using inferred_stringstream_t = std::basic_stringstream<get_char_type_t<T>>
template<any_string T>
using inferred_fstream_t = std::basic_fstream<std::conditional_t<std::is_same_v<get_char_type_t<T>, char8_t>, char, get_char_type_t<T>>>
template<any_string... T_args>
using precedent_string_t = std::tuple_element_t<get_string_type_precedence<T_args...>(), std::tuple<T_args...>>
template<any_string... T_args>
using pi_string_t = inferred_string_t<precedent_string_t<T_args...>>
template<any_string... T_args>
using pi_string_view_t = inferred_string_view_t<precedent_string_t<T_args...>>
template<any_string... T_args>
using pi_stringstream_t = inferred_stringstream_t<precedent_string_t<T_args...>>
template<encoding::encoding_type encoding>
using get_encoding_char_type_t = typename get_encoding_char_type<encoding>::type
template<encoding::encoding_type encoding>
using encoded_string_t = std::basic_string<get_encoding_char_type_t<encoding>>
template<encoding::encoding_type encoding>
using encoded_string_view_t = std::basic_string_view<get_encoding_char_type_t<encoding>>

Functions

template<class T, typename = std::enable_if_t<std::is_enum_v<T>>>
constexpr bool has_flag (T in_mask, T in_flag)
template<any_string T_result, any_string T_str>
constexpr T_result create_inferred_string (const T_str &in_str)
template<any_string... T_args>
constexpr size_t get_string_type_precedence ()
template<any_string T>
constexpr encoding::encoding_type get_char_encoding_type ()
constexpr encoding::encoding_type get_native_encoding_type (encoding::encoding_type in_encoding)
constexpr size_t get_encoding_char_size (encoding::encoding_type in_encoding)
template<any_string T>
constexpr bool is_char_encoding_type (encoding::encoding_type in_encoding)

Variables

template<typename T_first, typename... T_args>
constexpr bool is_all_same_v = std::conjunction_v<std::is_same<std::remove_cvref_t<std::decay_t<T_first>>, std::remove_cvref_t<std::decay_t<T_args>>>...>
template<typename, template< typename... > class T_base>
constexpr bool is_supported_template_v = false
template<template< typename... > class T_base, typename... T_args>
constexpr bool is_supported_template_v< T_base< T_args... >, T_base > = true
template<any_string T_left, any_string T_right>
constexpr bool is_same_underlying_char_type_v = std::is_same_v<get_char_type_t<T_left>, get_char_type_t<T_right>>
template<any_string T, encoding::encoding_type encoding>
constexpr bool is_char_encoding_type_v = is_char_encoding_type<T>(encoding)

Typedef Documentation

◆ encoded_string_t

An std::basic_string inferred from an encoding type.

◆ encoded_string_view_t

An std::basic_string_view inferred from an encoding type.

◆ get_char_type_t

template<typename T>
using hedgedev::csl::ut::expr::get_char_type_t = typename get_char_type<std::remove_cvref_t<T>>::type

Gets the character type of a string container.

◆ get_encoding_char_type_t

Gets a character type suitable for the encoding.

Returns
char8_t for UTF-8, char16_t for UTF-16 or char32_t for UTF-32. If unknown, char.

◆ get_pack_type_t

template<size_t index, typename... T_args>
using hedgedev::csl::ut::expr::get_pack_type_t = std::tuple_element_t<index, std::tuple<T_args...>>

Gets the type of an element inside a parameter pack.

Template Parameters
indexThe index of the element.
T_argsThe parameter pack.

◆ inferred_fstream_t

template<any_string T>
using hedgedev::csl::ut::expr::inferred_fstream_t = std::basic_fstream<std::conditional_t<std::is_same_v<get_char_type_t<T>, char8_t>, char, get_char_type_t<T>>>

An std::basic_fstream inferred from any string type.

◆ inferred_size_t

template<size_t size = sizeof(size_t), bool is_signed = false>
using hedgedev::csl::ut::expr::inferred_size_t
Initial value:
std::conditional_t<size == 1,
std::conditional_t<is_signed, int8_t, uint8_t>,
std::conditional_t<(size > 1 && size <= 2),
std::conditional_t<is_signed, int16_t, uint16_t>,
std::conditional_t<(size > 2 && size <= 4),
std::conditional_t<is_signed, int32_t, uint32_t>,
std::conditional_t<(size > 4 && size <= 8),
std::conditional_t<is_signed, int64_t, uint64_t>,
size_t>>>>

Gets a fundamental size type inferred from the specified size.

Template Parameters
sizeThe size of the type to get.
Remarks
For unsigned types, use the unsigned keyword before the declaration.

◆ inferred_string_t

template<any_string T>
using hedgedev::csl::ut::expr::inferred_string_t = std::basic_string<get_char_type_t<T>>

An std::basic_string inferred from any string type.

◆ inferred_string_view_t

template<any_string T>
using hedgedev::csl::ut::expr::inferred_string_view_t = std::basic_string_view<get_char_type_t<T>>

An std::basic_string_view inferred from any string type.

◆ inferred_stringstream_t

template<any_string T>
using hedgedev::csl::ut::expr::inferred_stringstream_t = std::basic_stringstream<get_char_type_t<T>>

An std::basic_stringstream inferred from any string type.

◆ pi_string_t

template<any_string... T_args>
using hedgedev::csl::ut::expr::pi_string_t = inferred_string_t<precedent_string_t<T_args...>>

An std::basic_string inferred from the string type with the largest character size.

◆ pi_string_view_t

template<any_string... T_args>
using hedgedev::csl::ut::expr::pi_string_view_t = inferred_string_view_t<precedent_string_t<T_args...>>

An std::basic_string_view inferred from the string type with the largest character size.

◆ pi_stringstream_t

An std::basic_stringstream inferred from the string type with the largest character size.

◆ precedent_string_t

template<any_string... T_args>
using hedgedev::csl::ut::expr::precedent_string_t = std::tuple_element_t<get_string_type_precedence<T_args...>(), std::tuple<T_args...>>

Evaluates the string type with the largest character size.

Function Documentation

◆ create_inferred_string()

template<any_string T_result, any_string T_str>
T_result hedgedev::csl::ut::expr::create_inferred_string ( const T_str & in_str)
inlineconstexpr

Creates a string inferred from a string literal at compile time.

Template Parameters
T_resultThe string type to create.
T_strThe string type to convert from.
Parameters
in_strThe string to create.
Returns
The input string in the destination format.

◆ get_char_encoding_type()

template<any_string T>
encoding::encoding_type hedgedev::csl::ut::expr::get_char_encoding_type ( )
inlineconstexpr

Gets an encoding type suitable for the character type.

◆ get_encoding_char_size()

size_t hedgedev::csl::ut::expr::get_encoding_char_size ( encoding::encoding_type in_encoding)
inlineconstexpr

Gets the character size of the encoding type.

◆ get_native_encoding_type()

encoding::encoding_type hedgedev::csl::ut::expr::get_native_encoding_type ( encoding::encoding_type in_encoding)
inlineconstexpr

Gets the native endianness of the specified encoding type.

◆ get_string_type_precedence()

template<any_string... T_args>
size_t hedgedev::csl::ut::expr::get_string_type_precedence ( )
inlineconstexpr

Determines which string type has the largest character size.

Returns
The index of the string type with the largest character size.

◆ has_flag()

template<class T, typename = std::enable_if_t<std::is_enum_v<T>>>
bool hedgedev::csl::ut::expr::has_flag ( T in_mask,
T in_flag )
inlineconstexpr

Checks if an enum instance has a bit flag set.

Template Parameters
TThe enum type.
Parameters
in_maskThe enum instance.
in_flagThe flag to check.

◆ is_char_encoding_type()

template<any_string T>
bool hedgedev::csl::ut::expr::is_char_encoding_type ( encoding::encoding_type in_encoding)
inlineconstexpr

Checks if the encoding type matches the string type.

Template Parameters
TThe string type.
Parameters
in_encodingThe encoding type.
Returns
true if the encoding type matches the string. Otherwise, false.

Variable Documentation

◆ is_all_same_v

template<typename T_first, typename... T_args>
bool hedgedev::csl::ut::expr::is_all_same_v = std::conjunction_v<std::is_same<std::remove_cvref_t<std::decay_t<T_first>>, std::remove_cvref_t<std::decay_t<T_args>>>...>
inlineconstexpr

Checks if all of the specified template types are the same type.

Template Parameters
T_firstThe first type.
T_argsThe remaining types.
Returns
true if all of the specified template types are the same. Otherwise, false.

◆ is_char_encoding_type_v

template<any_string T, encoding::encoding_type encoding>
bool hedgedev::csl::ut::expr::is_char_encoding_type_v = is_char_encoding_type<T>(encoding)
inlineconstexpr

Checks if the encoding type matches the string type.

Template Parameters
TThe string type.
encodingThe encoding type.
Returns
true if the encoding type matches the string. Otherwise, false.

◆ is_same_underlying_char_type_v

template<any_string T_left, any_string T_right>
bool hedgedev::csl::ut::expr::is_same_underlying_char_type_v = std::is_same_v<get_char_type_t<T_left>, get_char_type_t<T_right>>
inlineconstexpr

Checks if the underlying type of two given string types are the same.

◆ is_supported_template_v

template<typename, template< typename... > class T_base>
bool hedgedev::csl::ut::expr::is_supported_template_v = false
inlineconstexpr

Checks if a template type supports specific template parameters.

Template Parameters
T_baseThe template type to check.

◆ is_supported_template_v< T_base< T_args... >, T_base >

template<template< typename... > class T_base, typename... T_args>
bool hedgedev::csl::ut::expr::is_supported_template_v< T_base< T_args... >, T_base > = true
inlineconstexpr

Checks if a template type supports specific template parameters.

Template Parameters
T_baseThe template type to check.
T_argsThe template parameters to check.