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

Classes

struct  GetCharType
struct  GetCharType< std::basic_string< TChar, TTraits > >
struct  GetCharType< std::basic_string_view< TChar, TTraits > >
struct  GetCharType< T * >
struct  GetCharType< T(&)[Count]>
struct  IsBasicString
struct  IsBasicString< std::basic_string< TChar, TTraits > >
struct  IsBasicStringView
struct  IsBasicStringView< std::basic_string_view< TChar, TTraits > >

Concepts

concept  CStringA
concept  CStringW
concept  CString
concept  BasicString
concept  BasicStringView
concept  AnyString

Typedefs

template<size_t Index, typename... TArgs>
using GetPackType = std::tuple_element_t<Index, std::tuple<TArgs...>>
template<typename T>
using GetCharType_t = typename GetCharType<std::decay_t<T>>::Type
template<AnyString T>
using InferredString = std::basic_string<GetCharType_t<T>>
template<AnyString T>
using InferredStringView = std::basic_string_view<GetCharType_t<T>>
template<AnyString T>
using InferredStringOrView = std::conditional_t<CString<T>, InferredStringView<T>, InferredString<T>>
template<AnyString... TArgs>
using PrecedentString = std::tuple_element_t<GetStringTypePrecedence<TArgs...>(), std::tuple<TArgs...>>
template<AnyString... TArgs>
using PrecedentInferredString = InferredString<PrecedentString<TArgs...>>
template<AnyString... TArgs>
using PrecedentInferredStringView = InferredStringView<PrecedentString<TArgs...>>
template<AnyString... TArgs>
using PrecedentInferredStringOrView

Functions

template<class T, typename>
constexpr bool HasFlag (T in_mask, T in_flag)
template<AnyString TDst, AnyString TSrc>
constexpr TDst CreateInferredString (const TSrc &in_rStr)
template<AnyString... TArgs>
constexpr size_t GetStringTypePrecedence ()

Variables

template<typename T, typename... TArgs>
constexpr bool IsAllSame = std::conjunction_v<std::is_same<std::remove_cvref_t<std::decay_t<T>>, std::remove_cvref_t<std::decay_t<TArgs>>>...>
template<typename T>
constexpr bool IsBasicString_v = IsBasicString<std::remove_cvref_t<std::decay_t<T>>>::value
template<typename T>
constexpr bool IsBasicStringView_v = IsBasicStringView<std::remove_cvref_t<std::decay_t<T>>>::value
template<AnyString T1, AnyString T2>
constexpr bool IsSameUnderlyingCharType = std::is_same_v<GetCharType_t<T1>, GetCharType_t<T2>>

Typedef Documentation

◆ GetCharType_t

template<typename T>
using hedgedev::csl::ut::expr::GetCharType_t = typename GetCharType<std::decay_t<T>>::Type

Gets the character type of a string.

◆ GetPackType

template<size_t Index, typename... TArgs>
using hedgedev::csl::ut::expr::GetPackType = std::tuple_element_t<Index, std::tuple<TArgs...>>

◆ InferredString

template<AnyString T>
using hedgedev::csl::ut::expr::InferredString = std::basic_string<GetCharType_t<T>>

An std::basic_string inferred from any string type.

◆ InferredStringOrView

template<AnyString T>
using hedgedev::csl::ut::expr::InferredStringOrView = std::conditional_t<CString<T>, InferredStringView<T>, InferredString<T>>

An std::basic_string or std::basic_string_view inferred from the string type.

Returns
std::basic_string_view if the type is a C string. Otherwise, std::basic_string.

◆ InferredStringView

template<AnyString T>
using hedgedev::csl::ut::expr::InferredStringView = std::basic_string_view<GetCharType_t<T>>

An std::basic_string_view inferred from any string type.

◆ PrecedentInferredString

template<AnyString... TArgs>
using hedgedev::csl::ut::expr::PrecedentInferredString = InferredString<PrecedentString<TArgs...>>

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

◆ PrecedentInferredStringOrView

template<AnyString... TArgs>
using hedgedev::csl::ut::expr::PrecedentInferredStringOrView
Initial value:
std::conditional_t<(IsAllSame<TArgs...> && CString<GetPackType<0, TArgs...>>),
Definition StringTypes.h:71
std::tuple_element_t< Index, std::tuple< TArgs... > > GetPackType
Definition Expressions.h:9
InferredStringView< PrecedentString< TArgs... > > PrecedentInferredStringView
Definition StringTypes.h:154
InferredString< PrecedentString< TArgs... > > PrecedentInferredString
Definition StringTypes.h:148
constexpr bool IsAllSame
Definition Expressions.h:15

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

Returns
std::basic_string_view if all types are C strings. Otherwise, std::basic_string.

◆ PrecedentInferredStringView

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

◆ PrecedentString

template<AnyString... TArgs>
using hedgedev::csl::ut::expr::PrecedentString = std::tuple_element_t<GetStringTypePrecedence<TArgs...>(), std::tuple<TArgs...>>

Evaluates the string type with the largest character size.

Function Documentation

◆ CreateInferredString()

template<AnyString TDst, AnyString TSrc>
TDst hedgedev::csl::ut::expr::CreateInferredString ( const TSrc & in_rStr)
inlineconstexpr

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

Template Parameters
TDstThe string type to create.
TSrcThe string type to convert from.
Parameters
in_rStrThe string to create.
Returns
The input string in the destination format.

◆ GetStringTypePrecedence()

template<AnyString... TArgs>
size_t hedgedev::csl::ut::expr::GetStringTypePrecedence ( )
inlineconstexpr

Determines which string type has the largest character size.

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

◆ HasFlag()

template<class T, typename>
bool hedgedev::csl::ut::expr::HasFlag ( T in_mask,
T in_flag )
inlineconstexpr

Variable Documentation

◆ IsAllSame

template<typename T, typename... TArgs>
bool hedgedev::csl::ut::expr::IsAllSame = std::conjunction_v<std::is_same<std::remove_cvref_t<std::decay_t<T>>, std::remove_cvref_t<std::decay_t<TArgs>>>...>
inlineconstexpr

◆ IsBasicString_v

template<typename T>
bool hedgedev::csl::ut::expr::IsBasicString_v = IsBasicString<std::remove_cvref_t<std::decay_t<T>>>::value
inlineconstexpr

Checks if the type is an std::basic_string.

◆ IsBasicStringView_v

template<typename T>
bool hedgedev::csl::ut::expr::IsBasicStringView_v = IsBasicStringView<std::remove_cvref_t<std::decay_t<T>>>::value
inlineconstexpr

Checks if the type is an std::basic_string_view.

◆ IsSameUnderlyingCharType

template<AnyString T1, AnyString T2>
bool hedgedev::csl::ut::expr::IsSameUnderlyingCharType = std::is_same_v<GetCharType_t<T1>, GetCharType_t<T2>>
inlineconstexpr

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