2023-08-28 20:46:50 -07:00
|
|
|
#ifdef GEN_INTELLISENSE_DIRECTIVES
|
2023-08-21 20:28:39 -07:00
|
|
|
#pragma once
|
2023-09-25 09:12:11 -07:00
|
|
|
#include "components/types.hpp"
|
2023-08-28 20:46:50 -07:00
|
|
|
#endif
|
2023-08-21 20:28:39 -07:00
|
|
|
|
2023-08-22 21:05:58 -07:00
|
|
|
// This file was generated automatially by gencpp's bootstrap.cpp (See: https://github.com/Ed94/gencpp)
|
2023-08-21 22:51:59 -07:00
|
|
|
|
2024-12-03 10:14:14 -08:00
|
|
|
typedef enum Specifier_Def Specifier;
|
|
|
|
|
|
|
|
enum Specifier_Def : u32
|
2023-08-21 20:28:39 -07:00
|
|
|
{
|
2024-12-03 10:14:14 -08:00
|
|
|
Spec_Invalid,
|
|
|
|
Spec_Consteval,
|
|
|
|
Spec_Constexpr,
|
|
|
|
Spec_Constinit,
|
|
|
|
Spec_Explicit,
|
|
|
|
Spec_External_Linkage,
|
|
|
|
Spec_ForceInline,
|
|
|
|
Spec_Global,
|
|
|
|
Spec_Inline,
|
|
|
|
Spec_Internal_Linkage,
|
|
|
|
Spec_Local_Persist,
|
|
|
|
Spec_Mutable,
|
|
|
|
Spec_NeverInline,
|
|
|
|
Spec_Ptr,
|
|
|
|
Spec_Ref,
|
|
|
|
Spec_Register,
|
|
|
|
Spec_RValue,
|
|
|
|
Spec_Static,
|
|
|
|
Spec_Thread_Local,
|
|
|
|
Spec_Virtual,
|
|
|
|
Spec_Const,
|
|
|
|
Spec_Final,
|
|
|
|
Spec_NoExceptions,
|
|
|
|
Spec_Override,
|
|
|
|
Spec_Pure,
|
|
|
|
Spec_Volatile,
|
|
|
|
Spec_NumSpecifiers
|
|
|
|
};
|
2023-08-21 20:28:39 -07:00
|
|
|
|
2024-12-03 10:14:14 -08:00
|
|
|
inline bool is_trailing( Specifier specifier )
|
|
|
|
{
|
|
|
|
return specifier > Spec_Virtual;
|
|
|
|
}
|
2023-08-21 20:28:39 -07:00
|
|
|
|
2024-12-03 10:14:14 -08:00
|
|
|
inline StrC to_str( Specifier type )
|
|
|
|
{
|
|
|
|
local_persist StrC lookup[] {
|
|
|
|
{ sizeof( "INVALID" ), "INVALID" },
|
|
|
|
{ sizeof( "consteval" ), "consteval" },
|
|
|
|
{ sizeof( "constexpr" ), "constexpr" },
|
|
|
|
{ sizeof( "constinit" ), "constinit" },
|
|
|
|
{ sizeof( "explicit" ), "explicit" },
|
|
|
|
{ sizeof( "extern" ), "extern" },
|
|
|
|
{ sizeof( "forceinline" ), "forceinline" },
|
|
|
|
{ sizeof( "global" ), "global" },
|
|
|
|
{ sizeof( "inline" ), "inline" },
|
|
|
|
{ sizeof( "internal" ), "internal" },
|
|
|
|
{ sizeof( "local_persist" ), "local_persist" },
|
|
|
|
{ sizeof( "mutable" ), "mutable" },
|
|
|
|
{ sizeof( "neverinline" ), "neverinline" },
|
|
|
|
{ sizeof( "*" ), "*" },
|
|
|
|
{ sizeof( "&" ), "&" },
|
|
|
|
{ sizeof( "register" ), "register" },
|
|
|
|
{ sizeof( "&&" ), "&&" },
|
|
|
|
{ sizeof( "static" ), "static" },
|
|
|
|
{ sizeof( "thread_local" ), "thread_local" },
|
|
|
|
{ sizeof( "virtual" ), "virtual" },
|
|
|
|
{ sizeof( "const" ), "const" },
|
|
|
|
{ sizeof( "final" ), "final" },
|
|
|
|
{ sizeof( "noexcept" ), "noexcept" },
|
|
|
|
{ sizeof( "override" ), "override" },
|
|
|
|
{ sizeof( "= 0" ), "= 0" },
|
|
|
|
{ sizeof( "volatile" ), "volatile" },
|
|
|
|
};
|
|
|
|
return lookup[type];
|
|
|
|
}
|
|
|
|
|
|
|
|
inline Specifier to_specifier( StrC str )
|
|
|
|
{
|
|
|
|
local_persist u32 keymap[Spec_NumSpecifiers];
|
|
|
|
do_once_start for ( u32 index = 0; index < Spec_NumSpecifiers; index++ )
|
2023-08-21 20:28:39 -07:00
|
|
|
{
|
2024-12-03 10:14:14 -08:00
|
|
|
StrC enum_str = to_str( (Specifier)index );
|
|
|
|
keymap[index] = crc32( enum_str.Ptr, enum_str.Len - 1 );
|
2023-08-21 20:28:39 -07:00
|
|
|
}
|
2024-12-03 10:14:14 -08:00
|
|
|
do_once_end u32 hash = crc32( str.Ptr, str.Len );
|
|
|
|
for ( u32 index = 0; index < Spec_NumSpecifiers; index++ )
|
2023-08-21 20:28:39 -07:00
|
|
|
{
|
2024-12-03 10:14:14 -08:00
|
|
|
if ( keymap[index] == hash )
|
|
|
|
return (Specifier)index;
|
2023-08-21 20:28:39 -07:00
|
|
|
}
|
2024-12-03 10:14:14 -08:00
|
|
|
return Spec_Invalid;
|
|
|
|
}
|