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"
60 ERSerializable::MinimumRecognitionLength= 0;
68 while(*tail !=
nullptr)
72 (*tail)->next=
nullptr;
74 return &(*tail)->message;
87 if( tryRecord ==
nullptr )
89 std::vector<std::pair<integer,const void*>> recordList;
91 if( record.first.RTTI == message->
Type.
TypeID() )
92 recordList.push_back( std::pair<integer,const void*>(record.first.Element, record.second) );
93 if( recordList.size() == 0)
95 ALIB_ERROR(
"EXCEPT",
"No enum records defined for exception enumeration "
96 "type {!Q<>}.", message->
Type.
TypeID().name() )
100 std::sort( recordList.begin(), recordList.end(),
101 [] (std::pair<integer,const void*>& a, std::pair<integer,const void*>& b )
103 return a.first < b.first;
105 std::vector<std::any> args; args.reserve(32);
106 args.emplace_back(
"Enum record {} not found for exception enumeration type {}.\n"
107 "The following records have been found:\n" );
111 for(
auto& pair : recordList )
113 args.emplace_back(
" {}: {}\n" );
114 args.emplace_back( pair.first );
123 if( pool ==
nullptr )
124 message->emplace( message->begin(),
125 enumRecord.DescriptionOrItsResourceName );
127 message->emplace( message->begin(),
129 enumRecord.DescriptionOrItsResourceName
137 auto* result= **
this;
138 while( result->next !=
nullptr )
139 result= result->next;
141 return result->message;
148 while( entry->next !=
nullptr )
160 Enum* result= &entry->message.Type;
161 while( (entry= entry->next) !=
nullptr )
162 if( entry->message.Type.Integral() >= 0 )
163 result= &entry->message.Type;
178 formatter.GetArgContainer();
180 for (
auto entry=
begin(); entry !=
end(); ++entry )
182 text.
Add(
A_CHAR(
"{}{}: {!Q<>}"), (entry->Type.Integral() >= 0 ?
'E' :
'I'), entryNo, entry->Type );
186 formatter.FormatArgs( buf.
Reset(), *entry );
191 buf <<
BASECAMP.GetResource(
"ExcFmtExc");
193 buf <<
A_CHAR(
"\nAn exception occurred while formatting another (!) exception:\n" );
197 tknzr.
Set( buf,
'\n' );
202 text.
Add( entry->CI );
222 if( enumRecord ==
nullptr )
223 return Exception( ci, SystemErrors::UNKNOWN, errNo );
Exception(Exception &) noexcept=default
Deleted copy constructor. Exceptions must be caught only as references.
ALIB_DLL AString & Format(AString &target) const
ALIB_DLL Message & Back() const
ALIB_DLL Message * allocMessageLink()
ALIB_DLL const Enum & Type() const
ALIB_DLL void finalizeMessage(Message *message, bool hasRecord, ResourcePool *pool, const NString &category)
ALIB_DLL int Size() const
AllocatorType & GetAllocator() noexcept
virtual const String & Get(const NString &category, const NString &name, bool dbgAssert)=0
void DbgDisableBufferReplacementWarning()
ALIB_DLL TSubstring< TChar > & Next(lang::Whitespaces trimming=lang::Whitespaces::Trim, TChar newDelim='\0')
void Set(const TString< TChar > &src, TChar delimiter, bool skipEmptyTokens=false)
TLocalString< TChar, 8 > TrimChars
#define ALIB_BOXING_VTABLE_DEFINE(TMapped, Identifier)
#define ALIB_ERROR(domain,...)
#define ALIB_CALLER_PRUNED
void raise(const CallerInfo &ci, int type, std::string_view domain, const std::span< std::any > &args)
const TRecord * TryRecord(Enum e)
const TRecord & GetRecord(Enum e)
HashMap< MonoAllocator, EnumRecordKey, const void *, EnumRecordKey::Hash, EnumRecordKey::EqualTo > & getInternalRecordMap()
const RecordsTraits< TEnum >::Type * TryRecord(TEnum element)
Exception CreateSystemException(const CallerInfo &ci, int errNo)
strings::TAString< character, lang::HeapAllocator > AString
Type alias in namespace alib.
strings::util::TTokenizer< character > Tokenizer
Type alias in namespace alib.
camp::Basecamp BASECAMP
The singleton instance of ALib Camp class Basecamp.
strings::TString< nchar > NString
Type alias in namespace alib.
format::Paragraphs Paragraphs
Type alias in namespace alib.
resources::ResourcePool ResourcePool
Type alias in namespace alib.
format::Formatter Formatter
Type alias in namespace alib.
boxing::Enum Enum
Type alias in namespace alib.
LocalString< 1024 > String1K
Type alias name for TLocalString<character,1024>.
exceptions::Exception Exception
Type alias in namespace alib.
lang::CallerInfo CallerInfo
Type alias in namespace alib.
const std::type_info & TypeID() const
String EnumElementName
The name of the enum element.
static ALIB_DLL void Get(String &result, bool isLastField=false)
String DescriptionOrItsResourceName
ExceptionEntry * next
A pointer to the next message.