8#ifndef HPP_ALIB_ENUMS_RECORDBOOTSTRAP
9#define HPP_ALIB_ENUMS_RECORDBOOTSTRAP 1
15#include "alib/enums/records.hpp"
26#include <initializer_list>
30namespace alib {
namespace enums {
34template<
typename TEnum,
typename TEnableIf>
35template <
typename... TArgs>
40 auto** lastP = records.getPointerToLast();
46 .New<
typename detail::EnumRecordHook<TEnum>::Node>(element, std::forward<TArgs>(args)... );
49 (*lastP)->next=
nullptr;
52template<
typename TEnum,
typename TEnableIf>
57 auto* table = definitions.begin();
59 auto** lastP = records.getPointerToLast();
60 for(
size_t i= 0; i!= definitions.size(); ++i)
67 .New<
typename detail::EnumRecordHook<TEnum>::Node>(table[i].element, table[i].record );
70 lastP= &(*lastP)->next;
77 template<
typename TEnum,
typename TEnableIf>
86 auto** lastP = records.getPointerToLast();
95 .New<
typename detail::EnumRecordHook<TEnum>::Node>() );
97 element->record.Parse();
102 lastP= &element->next;
112 template<
typename TEnum,
typename TEnableIf>
122 if( input.IsNotNull() )
130 Bootstrap( input, innerDelim, outerDelim );
138 auto** lastP = records.getPointerToLast();
139 while( (input= pool.Get( category, nameNr.Reset( name)._(nr)
ALIB_DBG(,
false))).
IsNotNull()
147 element->record.Parse();
153 lastP= &element->next;
160 for(
int i= 0 ; i < 35 ; ++i )
163 if( pool.Get( category, nameNr.Reset( name)._( nr)
ALIB_DBG(,
false)).
IsNotNull() )
166 <<
"Detected a \"gap\" in numbering of enum records for type <"
167 << lang::DbgTypeDemangler(
typeid(TEnum)).
Get() <<
">: From index "
168 << nr - i - 1 <<
" to " << nr - 1 <<
".\n"
169 " Resource category/name: " << category <<
'/' << name <<
"." )
176 template<
typename TEnum,
typename TEnableIf>
180 static_assert( T_Resourced<TEnum>::value,
181 "No specialization for T_Resourced<TEnum> given. Method not applicable." );
186 innerDelim, outerDelim );
189 template<
typename TEnum,
typename TEnableIf>
196 Bootstrap( module.GetResourcePool(), module.ResourceCategory, name, innerDelim, outerDelim );
static TDerivedClass & GetSingleton()
#define ALIB_ASSERT_MODULE(modulename)
#define ALIB_WARNINGS_RESTORE
#define ALIB_WARNINGS_ALLOW_UNSAFE_BUFFER_USAGE
ALIB_API void setEnumRecord(const std::type_info &rtti, integer integral, const void *record)
constexpr bool IsNotNull(const T &t)
@ Get
Denotes to search data.
ALIB_API MonoAllocator GLOBAL_ALLOCATOR
NLocalString< 128 > NString128
Type alias name for TLocalString<nchar,128>.
constexpr NString NULL_NSTRING
A nulled string of the narrow character type.
NLocalString< 64 > NString64
Type alias name for TLocalString<nchar,64>.
strings::TString< nchar > NString
Type alias in namespace alib.
characters::character character
Type alias in namespace alib.
strings::TString< character > String
Type alias in namespace alib.
lang::HeapAllocator HeapAllocator
Type alias in namespace alib.
lang::integer integer
Type alias in namespace alib.
static ALIB_API void Get(String &result, bool isLastField=false)
static ALIB_API void assertEndOfInput()
Asserts that the Input is empty.
static ALIB_API void OuterDelim()
static ALIB_API Substring Input
The remaining input string.
static ALIB_API void Initialize(const String &input, character innerDelim, character outerDelim, const NString &resourceCategory, const NString &resourceName)
static void Bootstrap(TEnum element, TArgs &&... args) noexcept
static constexpr ResourcePool * Pool()
static constexpr NString Category()
static constexpr NString Name()