33template<
typename TEnum>
34requires std::is_enum<TEnum>::value
47template<
typename TEnum>
48concept HasRecords = !std::same_as<void, typename RecordsTraits<TEnum>::Type>;
94template<
typename TEnum>
102 using TIntegral=
typename std::underlying_type<TEnum>::type;
126 template <
typename... TArgs>
127 Node( TEnum element, TArgs&&... args) noexcept
129 ,
record ( std::forward<TArgs>(args)... )
148 while( (*last) !=
nullptr )
149 last= &(*last)->next;
186template<
typename TEnum>
190 static_assert( std::is_trivially_destructible<typename RecordsTraits<TEnum>::Type>::value,
191 "Error: Enum Record types must be a trivially destructible." );
194 ALIB_ASSERT_ERROR( result !=
nullptr,
"ENUMS",
"Enum Record for type <{}>({}) not found.",
195 &
typeid(TEnum), UnderlyingIntegral(element) )
216template<
typename TEnum>
220 static_assert( std::is_trivially_destructible<typename RecordsTraits<TEnum>::Type>::value,
221 "Error: Enum Record types must be a trivially destructible." );
268template<
typename TEnum>
272 static_assert( std::is_trivially_destructible<typename RecordsTraits<TEnum>::Type>::value,
273 "Error: Enum Record types must be a trivially destructible." );
279 using
TIntegral= typename std::underlying_type<TEnum>::type;
291 static constexpr
bool AreOfType() {
return std::is_base_of_v<TRecord, TAssociated>; }
359 return !(*
this == other);
368 return TEnum(
node->integral );
377 return node->integral;
391 return &
node->record;
509template<
typename TEnum>
510concept IsSerializable = std::is_base_of_v<ERSerializable, typename RecordsTraits<TEnum>::Type>;
518template<
typename TEnum>
static T & GetSingleton()
#define ALIB_WARNINGS_RESTORE
#define ALIB_WARNINGS_IGNORE_DOCS
#define ALIB_ASSERT_ERROR(cond, domain,...)
Details of namespace alib::enumrecords.
const void * getEnumRecord(const std::type_info &rtti, integer elementValue)
void setEnumRecord(const std::type_info &rtti, integer elementValue, const void *record)
bool Parse(strings::TSubstring< TChar > &input, TEnum &result)
const RecordsTraits< TEnum >::Type & GetRecord(TEnum element)
const RecordsTraits< TEnum >::Type * TryRecord(TEnum element)
singletons::Singleton< T > Singleton
Type alias in namespace alib.
lang::integer integer
Type alias in namespace alib.
enumrecords::EnumRecords< TEnum > EnumRecords
Type alias in namespace alib.
strings::TString< character > String
Type alias in namespace alib.
String EnumElementName
The name of the enum element.
ERSerializable() noexcept=default
Defaulted constructor leaving the record undefined.
int MinimumRecognitionLength
ForwardIterator & operator++()
bool operator==(ForwardIterator other) const
Node * node
The current node this iterator refers to.
ForwardIterator operator++(int)
bool operator!=(ForwardIterator other) const
const TRecord * pointer
Implementation of std::iterator_traits.
typename detail::EnumRecordHook< TEnum >::Node Node
Shortcut to the record hook's inner node type (linked list).
integer difference_type
Implementation of std::iterator_traits.
const TRecord & reference
Implementation of std::iterator_traits.
const TRecord * operator->() const
const TRecord & operator*() const
std::forward_iterator_tag iterator_category
Implementation of std::iterator_traits.
ForwardIterator(Node *start) noexcept
TIntegral Integral() const
const TRecord & value_type
Implementation of std::iterator_traits.
EnumRecords() noexcept=default
Defaulted constructor.
static constexpr bool AreOfType()
static ForwardIterator begin()
static constexpr ForwardIterator end()
typename RecordsTraits< TEnum >::Type TRecord
The enum's associated record type.
typename std::underlying_type< TEnum >::type TIntegral
The enum's underlying integer type.
void Type
The data type associated with elements of TEnum.
A node of the forward list that contains the custom record data.
Node * next
Pointer to the next node.
TIntegral integral
The enum element's underlying integral value.
Node() noexcept=default
Default constructor.
TRecord record
The data record.
Node(TEnum element, TArgs &&... args) noexcept
typename std::underlying_type< TEnum >::type TIntegral
The enum's underlying integer type.
Node * first
The hook to the first record defined.
Node ** getPointerToLast()
typename RecordsTraits< TEnum >::Type TRecord
The enum's associated record type.