10# if !defined(HPP_ALIB_LANG_COMMONENUMS)
13# if !defined(HPP_ALIB_ENUMS_DETAIL_ENUMRECORDMAP)
18# if !defined(HPP_ALIB_ENUMS_RECORDBOOTSTRAP)
21# if !defined (HPP_ALIB_STRINGS_LOCALSTRING)
29namespace alib {
namespace enums {
54 EnumRecordMap.EmplaceIfNotExistent(
EnumRecordKey(rtti, elementValue ), record );
56 EnumRecordMap.try_emplace(
EnumRecordKey(rtti, elementValue ), record );
64 auto it= EnumRecordMap.Find(
EnumRecordKey( rtti, elementValue ) );
66 auto it= EnumRecordMap.find(
EnumRecordKey( rtti, elementValue ) );
68 if ( it != EnumRecordMap.end() )
75const HashMap < EnumRecordKey,
const void*,
94#if ALIB_STRINGS && !defined(ALIB_DOX)
97 void assembleMsgAndThrow [[noreturn]] (
const NString& error )
103 msg <<
"ERROR WHILE PARSING ENUMERATION RECORD STRING" <<
NewLine()
104 <<
" Detail: " << error <<
NewLine()
109 msg <<
"(Not resourced)";
111 <<
" Column: " << column + 1 <<
NewLine()
114 for(
integer i= column ; i >= 0 ; --i )
115 msg << (i != 0 ?
'-' :
'>');
118 throw std::runtime_error( msg.
Terminate() );
131 assembleMsgAndThrow(
NString256() << what <<
'.' );
138 assembleMsgAndThrow(
NString256() <<
"Found whitespaces "
145 assembleMsgAndThrow(
NString256() <<
"Found trailing whitespaces in string value \""
152 assembleMsgAndThrow(
NString256() <<
"Unnecessary character \""
154 <<
"\" found " << where );
160 assembleMsgAndThrow(
NString256() << where <<
'\"' << specificChar <<
'\"');
169 assembleMsgAndThrow(
NString256() <<
"Expected outer delimiter or end of input" );
175 assembleMsgAndThrow(
NString256() <<
"Expected end of parsable input string" );
185 bigInt= (std::numeric_limits<integer>::max)();
191 error(
"Power of 2 symbol '^' is not followed by a number" );
192 bigInt=
static_cast<integer>(1LL << exp);
201 error(
"Not an integral value" );
229 || ( isLastField && ( result ==
OuterDelimChar || result ==
'\0' ) ) )
234 error(
"End of input when parsing a character." );
252 error(
"Not a floating point value" );
296DOX_MARKER([DOX_ALIB_ENUMS_MULTIPLE_RECORDS])
310DOX_MARKER([DOX_ALIB_ENUMS_MULTIPLE_RECORDS])
318DOX_MARKER([DOX_ALIB_ENUMS_MULTIPLE_RECORDS_2])
327DOX_MARKER([DOX_ALIB_ENUMS_MULTIPLE_RECORDS_2])
const TChar * Terminate() const
constexpr bool IsEmpty() const
constexpr bool IsNotEmpty() const
constexpr integer Length() const
TChar CharAtStart() const
integer IndexOfAny(const TString &needles, integer startIdx=0) const
integer IndexOfOrLength(TChar needle) const
TString< TChar > ConsumeToken(TChar separator=',')
bool ConsumeString(const TString< TChar > &consumable)
ALIB_API bool ConsumeFloat(double &result, TNumberFormat< TChar > *numberFormat=nullptr)
integer ConsumeChars(integer regionLength, TSubstring *target=nullptr)
bool ConsumeDec(TIntegral &result, TNumberFormat< TChar > *numberFormat=nullptr)
bool ConsumeInt(TIntegral &result, TNumberFormat< TChar > *numberFormat=nullptr)
ALIB_API void setEnumRecord(const std::type_info &rtti, integer integral, const void *record)
ALIB_API const void * getEnumRecord(const std::type_info &rtti, integer integral)
const HashMap< EnumRecordKey, const void *, EnumRecordKey::Hash, EnumRecordKey::EqualTo > & getInternalRecordMap()
ALIB_API void Bootstrap()
@ Exclude
Chooses exclusion.
@ Include
Chooses inclusion.
@ Keep
Keep whitespaces in string.
@ Trim
Trim whitespaces away.
@ Enabled
Caching is enabled.
@ Disabled
Caching is disabled.
@ Right
Denotes the right side of something.
@ Left
Denotes the left side of something.
@ Omit
Do not propagate changes.
@ ToDescendants
Propagate changes to descendants/children/sub-components.
@ On
Switch it on, switched on, etc.
@ Off
Switch it off, switched off, etc.
@ Safe
Do it or treat it with safety.
@ Unsafe
Omit checks or perform unsafe operations.
@ Ascending
Chooses ascending sort oder.
@ Descending
Chooses descending sort oder.
@ Global
Denotes global reach.
@ Local
Denotes local reach.
@ Copy
Chooses not to clear existing data.
@ Move
Chooses to clear existing data.
@ Local
Denotes local time.
@ UTC
Denotes UTC (coordinated universal time).
@ Keep
Chooses not no clear existing data.
@ Clear
Chooses to clear existing data.
@ KeepWithSender
Keeps responsibility, e.g. when passing an object.
@ Transfer
Transfers responsibility to the receiving party.
@ Center
Chooses centered alignment.
@ Right
Chooses right alignment.
@ Left
Chooses left alignment.
@ Begin
The start of a transaction.
@ End
The end of a transaction.
@ Remove
Denotes removals.
@ GetCreate
Denotes to create data if not found.
@ Create
Denotes to create data.
@ Insert
Denotes insertions.
@ Get
Denotes to search data.
MonoAllocator GlobalAllocator(8 *1024)
constexpr CString DefaultWhitespaces()
constexpr CString NewLine()
strings::TString< nchar > NString
Type alias in namespace alib.
strings::TSubstring< character > Substring
Type alias in namespace alib.
NLocalString< 256 > NString256
Type alias name for TLocalString<nchar,256> .
strings::TCString< nchar > NCString
Type alias in namespace alib.
characters::character character
Type alias in namespace alib.
strings::TString< character > String
Type alias in namespace alib.
lang::integer integer
Type alias in namespace alib.
int MinimumRecognitionLength
static ALIB_API void Get(String &result, bool isLastField=false)
static ALIB_API void assertNoUnnecessary(character specificChar, const NCString &where)
static ALIB_API NString ResourceCategory
static ALIB_API integer getInteger(bool isLastField)
static ALIB_API void Delim()
static ALIB_API void assertEndOfInput()
static ALIB_API void OuterDelim()
static ALIB_API void assertChar(character specificChar, const NCString &where)
static ALIB_API void assertNoWhitespaces(const NCString &where)
static ALIB_API Substring Input
static ALIB_API String OriginalInput
static ALIB_API void assertEndOfRecord()
static ALIB_API character InnerDelimChar
static ALIB_API NString ResourceName
static ALIB_API void assertNoTrailingWhitespaces(String &token)
static ALIB_API character OuterDelimChar
static ALIB_API void error(const NCString &what)
EnumRecordPrototype() noexcept=default
ALIB_API void Parse() noexcept
static void Bootstrap(TEnum element, TArgs &&... args) noexcept