8#ifndef HPP_ALIB_ENUMS_RECORDBOOTSTRAP
9#define HPP_ALIB_ENUMS_RECORDBOOTSTRAP 1
11#if !defined(HPP_ALIB_SINGLETONS_SINGLETON)
17#if !defined (HPP_ALIB_ENUMS_RECORDS)
20#if ALIB_STRINGS && !defined (HPP_ALIB_ENUMS_RECORDPARSER)
24#if ALIB_STRINGS && !defined(HPP_ALIB_STRINGS_SUBSTRING)
28#if ALIB_CAMP && !defined(HPP_ALIB_LANG_RESOURCES_RESOURCES)
32#if ALIB_CAMP && !defined(HPP_ALIB_LANG_CAMP)
36#if ALIB_MONOMEM && !defined (HPP_ALIB_MONOMEM_MONOALLOCATOR)
40#include <initializer_list>
43namespace alib {
namespace enums {
47template<
typename TEnum,
typename TEnableIf>
48template <
typename... TArgs>
53 auto** lastP = records.getPointerToLast();
57 *lastP=
new typename detail::EnumRecordHook<TEnum>::Node(
59 element, std::forward<TArgs>(args)... );
64 (*lastP)->next=
nullptr;
67template<
typename TEnum,
typename TEnableIf>
72 auto* table = definitions.begin();
74 auto** lastP = records.getPointerToLast();
75 for(
size_t i= 0; i!= definitions.size(); ++i)
80 *lastP=
new typename detail::EnumRecordHook<TEnum>::Node(
82 table[i].element, table[i].record );
86 lastP= &(*lastP)->next;
95 template<
typename TEnum,
typename TEnableIf>
104 auto** lastP = records.getPointerToLast();
111 auto* element= (*lastP=
new typename detail::EnumRecordHook<TEnum>::Node() );
115 element->record.Parse();
121 lastP= &element->next;
132 template<
typename TEnum,
typename TEnableIf>
142 if( input.IsNotNull() )
150 Bootstrap( input, innerDelim, outerDelim );
158 auto** lastP = records.getPointerToLast();
159 while( (input= pool.Get( category, nameNr.Reset( name)._(nr)
ALIB_DBG(,
false))).IsNotNull()
167 element->record.Parse();
174 lastP= &element->next;
181 for(
int i= 0 ; i < 35 ; ++i )
184 if( pool.Get( category, nameNr.Reset( name)._( nr)
ALIB_DBG(,
false)).IsNotNull() )
187 <<
"Detected a \"gap\" in numbering of enum records for type <"
188 << lang::DbgTypeDemangler(
typeid(TEnum)).
Get() <<
">: From index "
189 << nr - i - 1 <<
" to " << nr - 1 <<
".\n"
190 " Resource category/name: " << category <<
'/' << name <<
"." )
197 template<
typename TEnum,
typename TEnableIf>
201 static_assert( T_Resourced<TEnum>::value,
202 "No specialization for T_Resourced<TEnum> given. Method not applicable." );
207 innerDelim, outerDelim );
210 template<
typename TEnum,
typename TEnableIf>
217 Bootstrap( module.GetResourcePool(), module.ResourceCategory, name, innerDelim, outerDelim );
ALIB_FORCE_INLINE T * Emplace(TArgs &&... args)
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 std::underlying_type< TEnum >::type UnderlyingIntegral(TEnum element) noexcept(true)
ALIB_API void Bootstrap()
@ Get
Denotes to search data.
MonoAllocator GlobalAllocator(8 *1024)
NLocalString< 128 > NString128
Type alias name for TLocalString<nchar,128> .
NLocalString< 64 > NString64
Type alias name for TLocalString<nchar,64> .
strings::TString< nchar > NString
Type alias in namespace alib.
constexpr NString NullNString()
characters::character character
Type alias in namespace alib.
strings::TString< character > String
Type alias in namespace alib.
static ALIB_API void Get(String &result, bool isLastField=false)
static ALIB_API void assertEndOfInput()
static ALIB_API void OuterDelim()
static ALIB_API Substring Input
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()