8#if !defined(ALIB_C20_MODULES) || ((ALIB_C20_MODULES != 0) && (ALIB_C20_MODULES != 1))
9# error "Symbol ALIB_C20_MODULES has to be given to the compiler as either 0 or 1"
17#if !ALIB_MONOMEM && ALIB_CONTAINERS
18# include <unordered_map>
25#if ALIB_MONOMEM && ALIB_CONTAINERS
36#if ALIB_MONOMEM && ALIB_CONTAINERS
51 void assembleMsgAndThrow [[noreturn]] (
const NString& error )
57 msg <<
"ERROR WHILE PARSING ENUMERATION RECORD STRING" <<
NEW_LINE
63 msg <<
"(Not resourced)";
65 <<
" Column: " << column + 1 <<
NEW_LINE
68 for(
integer i= column ; i >= 0 ; --i )
69 msg << (i != 0 ?
'-' :
'>');
72 throw std::runtime_error( msg.Terminate() );
85 assembleMsgAndThrow(
NString256() << what <<
'.' );
90 if(
Input.IsNotEmpty()
92 assembleMsgAndThrow(
NString256() <<
"Found whitespaces "
99 assembleMsgAndThrow(
NString256() <<
"Found trailing whitespaces in string value \""
105 if(
Input.CharAtStart() == specificChar )
106 assembleMsgAndThrow(
NString256() <<
"Unnecessary character \""
108 <<
"\" found " << where );
113 if( !
Input.ConsumeChar(specificChar) )
114 assembleMsgAndThrow(
NString256() << where <<
'\"' << specificChar <<
'\"');
119 if (
Input.IsEmpty() )
123 assembleMsgAndThrow(
NString256() <<
"Expected outer delimiter or end of input" );
128 if ( !
Input.IsEmpty() )
129 assembleMsgAndThrow(
NString256() <<
"Expected end of parsable input string" );
139 bigInt= (std::numeric_limits<integer>::max)();
144 if( !
Input.ConsumeDec( exp ) )
145 error(
"Power of 2 symbol '^' is not followed by a number" );
154 if( !
Input.ConsumeInt( bigInt ) )
155 error(
"Not an integral value" );
183 || ( isLastField && ( result ==
OuterDelimChar || result ==
'\0' ) ) )
188 error(
"End of input when parsing a character." );
205 if( !
Input.ConsumeFloat( result ) )
206 error(
"Not a floating point value" );
234}
namespace alib::enumrecords::detail {
239 #if ALIB_MONOMEM && ALIB_CONTAINERS
HashMap< MonoAllocator, EnumRecordKey, const void *, EnumRecordKey::Hash, EnumRecordKey::EqualTo > & getInternalRecordMap()
@ Keep
Keep whitespaces in string.
@ Exclude
Chooses exclusion.
constexpr CString NEW_LINE
A zero-terminated string containing the new-line character sequence.
lang::integer integer
Type alias in namespace alib.
strings::TString< nchar > NString
Type alias in namespace alib.
strings::TAString< nchar, lang::HeapAllocator > NAString
Type alias in namespace alib.
strings::TCString< nchar > NCString
Type alias in namespace alib.
constexpr CString DEFAULT_WHITESPACES
A zero-terminated string of default whitespace characters.
strings::TString< character > String
Type alias in namespace alib.
NLocalString< 256 > NString256
Type alias name for TLocalString<nchar,256>.
characters::character character
Type alias in namespace alib.
strings::TSubstring< character > Substring
Type alias in namespace alib.
static ALIB_DLL character InnerDelimChar
The delimiter of fields of a record.
static ALIB_DLL void OuterDelim()
static ALIB_DLL void assertNoTrailingWhitespaces(String &token)
static ALIB_DLL character OuterDelimChar
The delimiter of records.
static ALIB_DLL void assertChar(character specificChar, const NCString &where)
static ALIB_DLL Substring Input
The remaining input string.
static ALIB_DLL void error(const NCString &what)
static ALIB_DLL void assertNoWhitespaces(const NCString &where)
static ALIB_DLL void assertNoUnnecessary(character specificChar, const NCString &where)
static ALIB_DLL String OriginalInput
A backup of the originally given string to parse.
static ALIB_DLL void Get(String &result, bool isLastField=false)
static ALIB_DLL void Delim()
static ALIB_DLL void assertEndOfRecord()
static ALIB_DLL integer getInteger(bool isLastField)
static ALIB_DLL NString ResourceCategory
The resource category (if a resourced string was parsed).
static ALIB_DLL void assertEndOfInput()
static ALIB_DLL NString ResourceName
The resource name (if a resourced string was parsed).