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"
18 module ALib.Strings.AutoSizes;
19 import ALib.Strings.Tokenizer;
30 data.emplace_back( type, -1, -1 );
46 if ( session < requestedSize ) {
47 session= requestedSize;
53 if ( actual < requestedSize ) {
54 actual= (requestedSize + ( actual < 0 ? 0 : growthPadding ));
65 auto it=
data.begin();
66 while( it!=
data.end() ) {
70 target <<
',' << (*it).session;
94 # define PARSERROR ALIB_WARNING( "STRINGS", \
95 "Error reading tab stops string \"{}\":\n at position ", \
96 src, src.Length() - parser.Length() )
107 parser= tknzr.
Next();
111 else { PARSERROR
break; }
118 sessionValue= actual;
122 data.emplace_back( type, actual, sessionValue );
132 for(
auto& entry :
data ) {
133 integer actDiff= entry.session - entry.actual;
140 if( entry.actual > lastTabStop ) {
141 lastTabStop= entry.actual;
142 entry.actual= entry.session + tabDiff;
144 lastTabStop= entry.actual;
146 entry.actual= entry.session + tabDiff;
149 entry.actual = entry.session;
TAString & DeleteEnd(integer regionLength)
TAString & _(const TAppendable &src)
constexpr integer Length() const
constexpr bool IsEmpty() const
bool EndsWith(const TString &needle) const
integer LastIndexOf(TChar needle, integer startIndex=MAX_LEN) const
bool ConsumeInt(std::integral auto &result, TNumberFormat< TChar > *numberFormat=nullptr)
TSubstring & Trim(const TCString< TChar > &whiteSpaces=CStringConstantsTraits< TChar >::DefaultWhitespaces())
ALIB_DLL integer Actual(Types type, integer requestedSize, integer growthPadding)
ALIB_DLL void Export(AString &target)
bool dirty
Determines whether any value was changed sincel last Reset.
ALIB_DLL void Consolidate()
ALIB_DLL void Import(const String &source, lang::CurrentData session=lang::CurrentData::Clear)
std::vector< Entry > data
The current and measured sizes.
Types
The entry type, tab stop or field width.
@ Field
denotes a field width entry.
@ Tabstop
denotes a tab stop entry.
ALIB_DLL TSubstring< TChar > & Next(lang::Whitespaces trimming=lang::Whitespaces::Trim, TChar newDelim='\0')
@ Clear
Chooses to clear existing data.
@ Trim
Trim whitespaces away.
strings::TAString< character, lang::HeapAllocator > AString
Type alias in namespace alib.
strings::util::TTokenizer< character > Tokenizer
Type alias in namespace alib.
lang::integer integer
Type alias in namespace alib.
strings::TString< character > String
Type alias in namespace alib.
strings::TSubstring< character > Substring
Type alias in namespace alib.