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"
19 module ALib.Format.PropertyFormatter;
22 import ALib.Exceptions;
24 import ALib.Camp.Base;
49 integer parsePosCopy= parsePos;
50 if( (parsePos= formatString.IndexOf( ESCCharacter, parsePosCopy ) ) < 0 )
54 integer endPos= parsePos+ 1;
55 if( endPos < formatString.Length() ) {
57 if( formatString[endPos] == ESCCharacter ) {
58 formatString.Delete( endPos, 1 );
64 while( endPos < formatString.Length() && isalpha( formatString[endPos] ) )
67 identifier= formatString.Substring<NC>( parsePos + 1, endPos - parsePos - 1 );
71 if( identifier.IsEmpty() )
75 auto entryIt= propertyTable.begin();
76 while( entryIt != propertyTable.end() ) {
77 if( Substring(identifier).ConsumePartOf<lang::Case::Ignore>( entryIt->Name,
78 entryIt->MinimumRecognitionLength
79 ) == identifier.Length() )
82 formatString.Delete( parsePos, endPos - parsePos + (formatString[endPos] == ESCCharacter ? 1 : 0) );
85 callBacks.emplace_back( &*entryIt );
93 if( entryIt == propertyTable.end() ) {
94 Exception e( ALIB_CALLER_NULLED, FMTExceptions::UnknownPropertyInFormatString,
95 ESCCharacter, identifier, customFormatString );
96 for( auto& row : propertyTable )
97 e.Back().Add( ESCCharacter, row.Name,
", " );
106 std::vector<String> heapStrings;
114 Box argument= entry->Callback( src, localString );
116 heapStrings.emplace_back( localString );
117 argument= heapStrings.back();
120 results.
Add ( argument );
Exception & Add(const lang::CallerInfo &ci, TEnum type, TArgs &&... args)
void DbgDisableBufferReplacementWarning()
constexpr bool IsNotEmpty() const
#define ALIB_CALLER_NULLED
strings::TAString< character, lang::HeapAllocator > AString
Type alias in namespace alib.
LocalString< 128 > String128
Type alias name for TLocalString<character,128>.
lang::integer integer
Type alias in namespace alib.
boxing::Box Box
Type alias in namespace alib.
exceptions::Exception Exception
Type alias in namespace alib.
boxing::TBoxes< MonoAllocator > BoxesMA
Type alias in namespace alib.
containers::SharedPtr< format::Formatter > SPFormatter
strings::TString< character > String
Type alias in namespace alib.
characters::character character
Type alias in namespace alib.