8#if !defined(ALIB_C20_MODULES) || ((ALIB_C20_MODULES != 0) && (ALIB_C20_MODULES != 1))
9# error "Configuration MACRO ALIB_C20_MODULES has to be given to the compiler as either 0 or 1"
19 module ALib.Format.PropertyFormatter;
22 import ALib.Exceptions;
24 import ALib.Camp.Base;
50 integer parsePosCopy= parsePos;
51 if( (parsePos= formatString.IndexOf( ESCCharacter, parsePosCopy ) ) < 0 )
55 integer endPos= parsePos+ 1;
56 if( endPos < formatString.Length() ) {
58 if( formatString[endPos] == ESCCharacter ) {
59 formatString.Delete( endPos, 1 );
65 while( endPos < formatString.Length() && isalpha( formatString[endPos] ) )
68 identifier= formatString.Substring<NC>( parsePos + 1, endPos - parsePos - 1 );
72 if( identifier.IsEmpty() )
76 auto entryIt= propertyTable.begin();
77 while( entryIt != propertyTable.end() ) {
78 if( Substring(identifier).ConsumePartOf<lang::Case::Ignore>( entryIt->Name,
79 entryIt->MinimumRecognitionLength
80 ) == identifier.Length() )
83 formatString.Delete( parsePos, endPos - parsePos + (formatString[endPos] == ESCCharacter ? 1 : 0) );
86 callBacks.emplace_back( &*entryIt );
94 if( entryIt == propertyTable.end() ) {
95 Exception e( ALIB_CALLER_NULLED, FMTExceptions::UnknownPropertyInFormatString,
96 ESCCharacter, identifier, customFormatStringx );
97 for( auto& row : propertyTable )
98 e.Back().Add( ESCCharacter, row.Name,
", " );
107 std::vector<String> heapStrings;
115 Box argument= entry->Callback( src, localString );
117 heapStrings.emplace_back( localString );
118 argument= heapStrings.back();
121 results.
Add ( argument );
#define ALIB_CALLER_NULLED
Exception & Add(const lang::CallerInfo &ci, TEnum type, TArgs &&... args)
void DbgDisableBufferReplacementWarning()
constexpr bool IsNotEmpty() const
containers::SharedPtr< format::Formatter > SPFormatter
strings::util::StringEscaperStandard StringEscaperStandard
Type alias in namespace alib.
strings::TEscape< character > Escape
Type alias in namespace alib.
constexpr const String EMPTY_STRING
An empty string of the default character type.
lang::integer integer
Type alias in namespace alib.
boxing::Box Box
Type alias in namespace alib.
strings::TString< character > String
Type alias in namespace alib.
exceptions::Exception Exception
Type alias in namespace alib.
LocalString< 128 > String128
Type alias name for #"TLocalString;TLocalString<character,128>".
boxing::TBoxes< MonoAllocator > BoxesMA
Type alias in namespace alib.
strings::TAString< character, lang::HeapAllocator > AString
Type alias in namespace alib.
characters::character character
Type alias in namespace alib.