25: allocator (
ALIB_DBG(
"Paragraphs",) 4)
28, MarkerBullets (allocator)
29, IndentFirstLine (allocator)
30, IndentOtherLines (allocator)
42: allocator(
ALIB_DBG(
"Paragraphs",) 2)
43, Buffer(externalBuffer)
45, MarkerBullets (allocator)
46, IndentFirstLine (allocator)
47, IndentOtherLines (allocator)
60 const String& pIndentOtherLines )
62 String indentOtherLines= pIndentOtherLines.
IsNull() ? indentFirstLine
123 #if defined( _WIN32 )
138 integer exceptStart= errPos - 25;
139 if( exceptStart <= 0 )
141 exceptPos+= exceptStart;
151 actText.
_( markedBuffer, exceptStart, 50 );
152 if( markedBuffer.
Length() > exceptStart + 50 )
169 searchCharBuf[1]=
'\n';
171 String searchChars(searchCharBuf, 2);
180 integer pos= parser.template IndexOfAny<lang::Inclusion::Include, NC>( searchChars );
190 if( parser.
CharAt( pos ) ==
'\n' )
192 parser.template ConsumeChars<NC, lang::CurrentData::Keep>( pos,
Buffer, 1 );
204 parser.template ConsumeChars<NC, lang::CurrentData::Keep>( pos,
Buffer, 1 );
292 const String& pIndentFirstLine,
293 const String& pIndentOtherLines )
297 String indentOtherLines= pIndentOtherLines.
IsNotNull() ? pIndentOtherLines : pIndentFirstLine;
299 bool isFirstLine=
true;
302 bool indentAreJustSpaces=
false;
305 integer maxLineWidthDetectionStartIdx= startIdx;
309 maxLineWidth= (std::max)( maxLineWidth, startIdx - maxLineWidthDetectionStartIdx
311 #
if defined( _WIN32 )
320 maxLineWidthDetectionStartIdx= startIdx;
324 int isWinNL=
text[ startIdx ] ==
'\r' ? 1 : 0;
325 if (
text[ startIdx + isWinNL ] ==
'\n' )
332 indent = isFirstLine ? indentFirstLines : indentOtherLines;
333 indentAreJustSpaces= (indent.template IndexOfAny<lang::Inclusion::Exclude>(
A_CHAR(
" " ) ) < 0 );
337 if ( !indentAreJustSpaces )
341 startIdx+= indent.
Length();
345 #if defined( _WIN32 )
348 text.template InsertChars<NC>(
'\r', 1, startIdx );
354 text.template Delete<NC>(startIdx, 1);
360 startIdx+= 1 + isWinNL;
373 indent = isFirstLine ? indentFirstLines : indentOtherLines;
374 indentAreJustSpaces= (indent.template IndexOfAny<lang::Inclusion::Exclude>(
A_CHAR(
" " ) ) < 0 );
388 bool isLastLine =
true;
389 bool exceeds =
false;
399 exceeds= lineWidth > 0 && idx - startIdx >= lineWidth;
403 if(idx - startIdx <= lineWidth )
404 lastSpaceInLine= idx;
415 #if defined( _WIN32 )
416 if(
text[idx-1] ==
'\n' &&
text[idx-2] !=
'\r' )
418 text.template InsertChars<NC>(
'\r', 1, idx-1 );
422 if(
text[idx-1] ==
'\n' &&
text[idx-2] ==
'\r' )
424 text.template Delete<NC>((idx-2), 1);
430 if( exceeds && ( lastSpaceInLine || !isLastLine ) )
432 integer wrapPos= lastSpaceInLine > 0 ? lastSpaceInLine : idx;
433 text.template ReplaceSubstring<NC>(
NEW_LINE, wrapPos, 1 );
438 if( justifyChar !=
'\0' )
440 integer qtyInserts= lineWidth - (wrapPos - startIdx );
445 while ( leftInsertBoundary < idx &&
text[leftInsertBoundary] ==
' ' )
446 ++leftInsertBoundary;
448 if( leftInsertBoundary < idx )
450 while( qtyInserts > 0 )
453 bool foundOne=
false;
454 while( qtyInserts > 0 )
457 if( actPos < leftInsertBoundary )
463 while( --actPos > leftInsertBoundary &&
text[actPos] ==
' ' )
ALIB_API integer SearchAndReplace(TChar needle, TChar replacement, integer startIdx=0, integer endIdx=strings::MAX_LEN)
TAString & DeleteEnd(integer regionLength)
TAString & InsertChars(TChar c, integer qty)
TAString & _(const TString< TChar > &src, integer regionStart, integer regionLength=MAX_LEN)
ALIB_API void SetBuffer(integer newCapacity)
TAString & InsertAt(const TString< TChar > &src, integer pos)
constexpr bool IsNull() const
TChar CharAt(integer idx) const
constexpr bool IsNotEmpty() const
constexpr integer Length() const
constexpr bool IsNotNull() const
ALIB_WARNINGS_RESTORE integer LastIndexOf(TChar needle, integer startIndex=MAX_LEN) const
bool EndsWith(const TString &needle) const
bool ConsumeString(const TString< TChar > &consumable)
TString< TChar > ConsumeToken(TChar separator=',', lang::Inclusion includeSeparator=lang::Inclusion::Include)
#define ALIB_CALLER_NULLED
#define ALIB_WARNINGS_RESTORE
#define ALIB_ASSERT_ERROR(cond,...)
#define ALIB_WARNINGS_ALLOW_UNSAFE_BUFFER_USAGE
platform_specific integer
platform_specific uinteger
lang::Exception Exception
Type alias in namespace alib.
std::deque< T, SCAMono< T > > StdDequeMono
Type alias in namespace alib.
constexpr const String EMPTY_STRING
An empty string of the default character type.
constexpr CString NEW_LINE
A zero-terminated string containing the new-line character sequence.
characters::character character
Type alias in namespace alib.
lang::integer integer
Type alias in namespace alib.