52 #ifndef __PCL_String_h
53 #define __PCL_String_h
58 #include <pcl/Diagnostics.h>
74 #ifdef __PCL_ALIGNED_STRING_ALLOCATION
76 # define PCL_STRING_ALLOCATOR AlignedAllocator
79 # define PCL_STRING_ALLOCATOR StandardAllocator
82 #ifndef __PCL_NO_STRING_COMPLEX
86 #ifndef __PCL_NO_STRING_OSTREAM
88 # define _GLIBCXX_USE_WCHAR_T 1
93 #ifdef __PCL_QT_INTERFACE
94 # include <QtCore/QByteArray>
95 # include <QtCore/QDateTime>
96 # include <QtCore/QString>
97 # define PCL_GET_CHARPTR_FROM_QSTRING( qs ) (qs.toLatin1().data())
98 # define PCL_GET_CHAR16PTR_FROM_QSTRING( qs ) ((char16_type*)( qs.utf16() ))
99 # define PCL_GET_CHARPTR_FROM_QSTRINGVIEW( qv ) ((const char*)qv.data())
100 # define PCL_GET_CHAR16PTR_FROM_QSTRINGVIEW( qv ) ((const char16_type*)qv.data())
101 # define PCL_GET_QSTRING_FROM_CHAR16PTR( s ) (QString::fromUtf16( (const char16_t*)(s) ))
102 # define PCL_GET_CHARPTR_FROM_QBYTEARRAY( qb ) (qb.data())
103 # define PCL_QDATE_FMT_STR "yyyy/MM/dd"
104 # define PCL_QDATETIME_FMT_STR "yyyy/MM/dd hh:mm:ss"
110 #ifndef __PCL_NO_STRING_VECTOR
111 template <
typename T>
class PCL_CLASS GenericVector;
132 namespace RandomizationOption
136 Lowercase = 0x00000001,
137 Uppercase = 0x00000002,
138 Alpha = Lowercase|Uppercase,
140 Symbols = 0x00000008,
141 HexDigits = 0x00000010,
142 BinDigits = 0x00000020,
143 FullRange = 0x80000000,
144 Default = Alpha|Digits
217 unsigned precision_ = 2,
220 char separator_ =
':',
221 char padding_ =
' ' )
223 , precision( precision_ )
226 , separator( separator_ )
227 , padding( padding_ )
430 unsigned precision_ = 3,
431 bool timeZone_ =
true,
432 bool zuluTime_ =
true )
433 : timeItems( timeItems_ )
434 , precision( precision_ )
435 , timeZone( timeZone_ )
436 , zuluTime( zuluTime_ )
464 unsigned precision_ = 3 )
491 template <
class T,
class R,
class A = PCL_STRING_ALLOCATOR>
577 m_data = Data::New();
607 m_data = Data::New( len );
608 R::Copy( m_data->string, t, len );
611 m_data = Data::New();
636 m_data = Data::New( len );
637 R::Copy( m_data->string, i, len );
640 m_data = Data::New();
663 if ( i < len && (n =
pcl::Min( n, len-i )) > 0 )
665 m_data = Data::New( n );
666 R::Copy( m_data->string, t+i, n );
669 m_data = Data::New();
679 m_data = Data::New( n );
680 R::Fill( m_data->string, c, n );
683 m_data = Data::New();
692 if ( m_data !=
nullptr )
706 return m_data->IsUnique();
718 return m_data == s.m_data;
735 Data* newData = Data::New( len );
737 R::Copy( newData->string, m_data->string, len );
752 return R::BytesPerChar();
763 return Length()*BytesPerChar();
774 return m_data->end - m_data->string;
787 return m_data->capacity - m_data->string;
799 return m_data->capacity - m_data->end;
820 return m_data !=
nullptr;
832 return m_data->string == m_data->end;
858 PCL_PRECONDITION( !IsEmpty() )
869 return m_data->alloc;
901 PCL_PRECONDITION( i < Length() )
903 return m_data->string + i;
917 PCL_PRECONDITION( i < Length() )
918 return m_data->string + i;
962 return *m_data->string;
974 return *m_data->string;
991 return m_data->string;
1004 return m_data->string;
1053 return (m_data->string < m_data->end) ? m_data->end-1 :
nullptr;
1068 return (m_data->string < m_data->end) ? m_data->end-1 :
nullptr;
1087 return (m_data->string < m_data->end) ? m_data->string-1 :
nullptr;
1102 return (m_data->string < m_data->end) ? m_data->string-1 :
nullptr;
1117 PCL_PRECONDITION( i >= m_data->string )
1118 return i - m_data->string;
1121 #ifndef __PCL_NO_STL_COMPATIBLE_ITERATORS
1164 static const char_type theNullChar = char_traits::Null();
1165 return IsEmpty() ? &theNullChar : Begin();
1290 MaybeReallocate( len );
1291 R::Copy( m_data->string, t, len );
1322 MaybeReallocate( len );
1323 R::Copy( m_data->string, i, len );
1335 void Assign( std::initializer_list<char_type> l )
1337 Assign( l.begin(), l.end() );
1356 if ( i < len && (n =
pcl::Min( n, len-i )) > 0 )
1358 MaybeReallocate( n );
1359 R::Copy( m_data->string, t+i, n );
1372 if ( !R::IsNull( c ) && n > 0 )
1374 MaybeReallocate( n );
1375 R::Fill( m_data->string, c, n );
1405 Data* newData = Data::New( len );
1409 R::Fill( m_data->string, c, len );
1435 else if ( !IsUnique() )
1437 Data* newData = Data::New( len );
1441 R::Fill( m_data->string+i, c, n );
1468 volatile char* s =
reinterpret_cast<volatile char*
>( m_data->string );
1485 if ( Capacity() < n+1 )
1489 m_data->Reserve( len, n );
1490 if ( old !=
nullptr )
1493 R::Copy( m_data->string, old, len );
1494 m_data->alloc.Deallocate( old );
1501 Data* newData = Data::New();
1502 newData->Reserve( len,
pcl::Max( len, n ) );
1504 R::Copy( newData->string, m_data->string, len );
1525 if ( n != Length() )
1529 if ( !IsUnique() || m_data->ShouldReallocate( n ) )
1531 Data* newData = Data::New( n );
1534 R::Copy( newData->string, m_data->string,
pcl::Min( n, m ) );
1539 m_data->SetLength( n );
1571 SetLength( R::Length( m_data->string ) );
1599 if ( Available() > 0 )
1607 m_data->Allocate( len, 0 );
1608 R::Copy( m_data->string, old, len );
1609 m_data->alloc.Deallocate( old );
1613 Data* newData = Data::New( len, 0 );
1614 R::Copy( newData->string, m_data->string, len );
1674 if ( dst !=
nullptr )
1675 if ( maxCharsToCopy > 0 )
1677 if ( --maxCharsToCopy > 0 )
1683 R::Copy( dst, m_data->string+i, n );
1695 template <
class R1,
class A1>
1701 UninitializedGrow( i, n );
1702 R::Copy( m_data->string+i, s.m_data->string, n );
1718 UninitializedGrow( i, n );
1719 R::Copy( m_data->string+i, p, n );
1732 UninitializedGrow( i, n );
1733 R::Copy( m_data->string+i, t, n );
1743 if ( (n =
pcl::Min( n, R::Length( t ) )) > 0 )
1745 UninitializedGrow( i, n );
1746 R::Copy( m_data->string+i, t, n );
1757 UninitializedGrow( i, n );
1758 R::Fill( m_data->string+i, c, n );
1765 template <
class R1,
class A1>
1768 Insert( maxPos, s );
1775 template <
class R1,
class A1>
1791 Insert( maxPos, i, j );
1800 Insert( maxPos, t, n );
1808 Insert( maxPos, t );
1826 Insert( maxPos, c, n );
1833 template <
class R1,
class A1>
1889 template <
class R1,
class A1>
1899 template <
class R1,
class A1>
1968 template <
class R1,
class A1>
1983 UninitializedGrow( i, ns-n );
1989 R::Copy( m_data->string+i, s.m_data->string, ns );
2022 UninitializedGrow( i, nt-n );
2028 R::Copy( m_data->string+i, t, nt );
2056 UninitializedGrow( i, nc-n );
2062 R::Fill( m_data->string+i, c, nc );
2080 ReplaceChar( c1, c2, i, n,
true );
2092 ReplaceChar( c1, c2, i, n,
false );
2100 template <
class R1,
class A1,
class R2,
class A2>
2104 ReplaceString( s1.m_data->string, s1.
Length(), s2.m_data->string, s2.
Length(), i,
true );
2114 ReplaceString( t1, R::Length( t1 ), t2, R::Length( t2 ), i,
true );
2124 template <
class R1,
class A1,
class R2,
class A2>
2128 ReplaceString( s1.m_data->string, s1.
Length(), s2.m_data->string, s2.
Length(), i,
false );
2140 ReplaceString( t1, R::Length( t1 ), t2, R::Length( t2 ), i,
false );
2158 if ( !IsUnique() || m_data->ShouldReallocate( newLen ) )
2160 Data* newData = Data::New( newLen );
2162 R::Copy( newData->string, m_data->string, i );
2164 R::Copy( newData->string+i, m_data->string+i+n, newLen-i );
2171 R::CopyOverlapped( m_data->string+i, m_data->string+i+n, newLen-i );
2172 m_data->SetLength( newLen );
2187 Delete( i, maxPos );
2206 ReplaceString( &c, 1,
nullptr, 0, i,
true );
2218 ReplaceString( &c, 1,
nullptr, 0, i,
false );
2226 template <
class R1,
class A1>
2229 ReplaceString( s.m_data->string, s.
Length(),
nullptr, 0, i,
true );
2239 ReplaceString( t, R::Length( t ),
nullptr, 0, i,
true );
2249 template <
class R1,
class A1>
2252 ReplaceString( s.m_data->string, s.
Length(),
nullptr, 0, i,
false );
2264 ReplaceString( t, R::Length( t ),
nullptr, 0, i,
false );
2280 m_data->Deallocate();
2283 Data* newData = Data::New();
2304 t.m_data->Allocate( n );
2305 R::Copy( t.m_data->string, m_data->string+i, n );
2327 t.m_data->Allocate( n );
2328 R::Copy( t.m_data->string, m_data->string, n );
2349 t.m_data->Allocate( n );
2350 R::Copy( t.m_data->string, m_data->string+len-n, n );
2366 return Substring( i );
2377 return Left( (i > 0) ? i-1 : 0 );
2397 template <
class C,
class R1,
class A1>
2406 for ( SearchEngine S( s.m_data->string, n,
true ); ; )
2408 size_type j = S( m_data->string, i, len );
2418 l = R::SearchTrimLeft( l, r );
2419 m = R::SearchTrimRight( l, r ) - l;
2423 t.m_data->Allocate( m );
2424 R::Copy( t.m_data->string, l, m );
2466 for ( SearchEngine S( s, n,
true ); ; )
2468 size_type j = S( m_data->string, i, len );
2478 l = R::SearchTrimLeft( l, r );
2479 m = R::SearchTrimRight( l, r ) - l;
2483 t.m_data->Allocate( m );
2484 R::Copy( t.m_data->string, l, m );
2539 l = R::SearchTrimLeft( l, r );
2540 m = R::SearchTrimRight( l, r ) - l;
2544 t.m_data->Allocate( m );
2545 R::Copy( t.m_data->string, l, m );
2548 list.Add(
typename C::item_type( t ) );
2582 template <
class C,
typename S>
2607 l = R::SearchTrimLeft( l, r );
2608 m = R::SearchTrimRight( l, r ) - l;
2612 t.m_data->Allocate( m );
2613 R::Copy( t.m_data->string, l, m );
2616 list.Add(
typename C::item_type( t ) );
2649 template <
class C,
class R1,
class A1>
2659 for ( SearchEngine S( s.m_data->string, n,
false ); ; )
2661 size_type j = S( m_data->string, i, len );
2671 l = R::SearchTrimLeft( l, r );
2672 m = R::SearchTrimRight( l, r ) - l;
2676 t.m_data->Allocate( m );
2677 R::Copy( t.m_data->string, l, m );
2680 list.Add(
typename C::item_type( t ) );
2725 for ( SearchEngine S( s, n,
false ); ; )
2727 size_type j = S( m_data->string, i, len );
2737 l = R::SearchTrimLeft( l, r );
2738 m = R::SearchTrimRight( l, r ) - l;
2742 t.m_data->Allocate( m );
2743 R::Copy( t.m_data->string, l, m );
2746 list.Add(
typename C::item_type( t ) );
2787 c = R::ToCaseFolded( c );
2792 if ( R::ToCaseFolded( *p ) == c )
2803 l = R::SearchTrimLeft( l, r );
2804 m = R::SearchTrimRight( l, r ) - l;
2808 t.m_data->Allocate( m );
2809 R::Copy( t.m_data->string, l, m );
2812 list.Add(
typename C::item_type( t ) );
2830 return (m_data->string !=
nullptr) ? *m_data->string : R::Null();
2839 return (m_data->string < m_data->end) ? *(m_data->end-1) : R::Null();
2845 template <
class R1,
class A1>
2848 if ( s.IsEmpty() || Length() < s.Length() )
2850 for (
const_iterator p = m_data->string, q = s.m_data->string; q < s.m_data->end; ++p, ++q )
2863 if ( n == 0 || Length() < n )
2865 for (
const_iterator p = m_data->string, e = p+n; p < e; ++p, ++t )
2876 return m_data->string < m_data->end && *m_data->string == c;
2883 template <
class R1,
class A1>
2886 if ( s.IsEmpty() || Length() < s.Length() )
2888 for (
const_iterator p = m_data->string, q = s.m_data->string; q < s.m_data->end; ++p, ++q )
2889 if ( R::ToCaseFolded( *p ) != R::ToCaseFolded( *q ) )
2901 if ( n == 0 || Length() < n )
2903 for (
const_iterator p = m_data->string, e = p+n; p < e; ++p, ++t )
2904 if ( R::ToCaseFolded( *p ) != R::ToCaseFolded( *t ) )
2915 return m_data->string < m_data->end && R::ToCaseFolded( *m_data->string ) == R::ToCaseFolded( c );
2921 template <
class R1,
class A1>
2925 if ( n == 0 || Length() < n )
2927 for (
const_iterator p = m_data->end-n, q = s.m_data->string; p < m_data->end; ++p, ++q )
2940 if ( n == 0 || Length() < n )
2942 for (
const_iterator p = m_data->end-n; p < m_data->end; ++p, ++t )
2953 return m_data->string < m_data->end && *(m_data->end-1) == c;
2960 template <
class R1,
class A1>
2964 if ( n == 0 || Length() < n )
2966 for (
const_iterator p = m_data->end-n, q = s.m_data->string; p < m_data->end; ++p, ++q )
2967 if ( R::ToCaseFolded( *p ) != R::ToCaseFolded( *q ) )
2979 if ( n == 0 || Length() < n )
2981 for (
const_iterator p = m_data->end-n; p < m_data->end; ++p, ++t )
2982 if ( R::ToCaseFolded( *p ) != R::ToCaseFolded( *t ) )
2993 return m_data->string < m_data->end && R::ToCaseFolded( *(m_data->end-1) ) == R::ToCaseFolded( c );
3001 template <
class R1,
class A1>
3005 i = SearchEngine( s.m_data->string, s.
Length(),
true )( m_data->string, i, len );
3006 return (i < len) ? i : notFound;
3017 i = SearchEngine( t, R::Length( t ),
true )( m_data->string, i, len );
3018 return (i < len) ? i : notFound;
3028 for (
const_iterator p = m_data->string+i; p < m_data->end; ++p )
3030 return p - m_data->string;
3042 template <
class R1,
class A1>
3046 i = SearchEngine( s.m_data->string, s.
Length(),
false )( m_data->string, i, len );
3047 return (i < len) ? i : notFound;
3061 i = SearchEngine( t, R::Length( t ),
false )( m_data->string, i, len );
3062 return (i < len) ? i : notFound;
3075 c = R::ToCaseFolded( c );
3076 for (
const_iterator p = m_data->string+i; p < m_data->end; ++p )
3077 if ( R::ToCaseFolded( *p ) == c )
3078 return p - m_data->string;
3085 template <
class R1,
class A1>
3088 return FindFirst( s, i );
3096 return FindFirst( t, i );
3104 return FindFirst( c, i );
3110 template <
class R1,
class A1>
3113 return FindFirstIC( s, i );
3121 return FindFirstIC( t, i );
3129 return FindFirstIC( c, i );
3141 template <
class R1,
class A1>
3145 size_type i = SearchEngine( s.m_data->string, s.Length(),
true,
true )( m_data->string, 0, r );
3146 return (i < r) ? i : notFound;
3161 size_type i = SearchEngine( t, R::Length( t ),
true,
true )( m_data->string, 0, r );
3162 return (i < r) ? i : notFound;
3191 template <
class R1,
class A1>
3195 size_type i = SearchEngine( s.m_data->string, s.Length(),
false,
true )( m_data->string, 0, r );
3196 return (i < r) ? i : notFound;
3214 size_type i = SearchEngine( t, R::Length( t ),
false,
true )( m_data->string, 0, r );
3215 return (i < r) ? i : notFound;
3228 c = R::ToCaseFolded( c );
3231 if ( R::ToCaseFolded( *--p ) == c )
3239 template <
class R1,
class A1>
3242 return Find( s ) != notFound;
3250 return Find( t ) != notFound;
3258 return Find( c ) != notFound;
3267 template <
class R1,
class A1>
3270 return FindIC( s ) != notFound;
3281 return FindIC( t ) != notFound;
3292 return FindIC( c ) != notFound;
3306 const_iterator l = R::SearchTrimLeft( m_data->string, m_data->end );
3308 if ( m_data->string < l || r < m_data->end )
3323 const_iterator l = R::SearchTrimLeft( m_data->string, m_data->end );
3324 if ( m_data->string < l )
3325 Trim( l, m_data->end - l );
3339 const_iterator r = R::SearchTrimRight( m_data->string, m_data->end );
3340 if ( r < m_data->end )
3341 Trim( m_data->string, r - m_data->string );
3388 int encloseLeft = 1;
3389 int encloseRight = 1;
3393 if ( *m_data->string == c )
3395 if ( *(m_data->end-1) == c )
3401 size_type n = len + encloseLeft + encloseRight;
3404 if ( !IsUnique() || m_data->ShouldReallocate( n ) )
3406 Data* newData = Data::New( n );
3407 R::Copy( newData->string + encloseLeft, m_data->string, len );
3413 m_data->SetLength( n );
3414 R::CopyOverlapped( m_data->string + encloseLeft, m_data->string, len );
3418 *m_data->string = c;
3420 *(m_data->end-1) = c;
3445 EnsureEnclosed( R::SingleQuote() );
3469 EnsureEnclosed( R::DoubleQuote() );
3502 if ( *m_data->string == R::SingleQuote() && *(m_data->end-1) == R::SingleQuote() ||
3503 *m_data->string == R::DoubleQuote() && *(m_data->end-1) == R::DoubleQuote() )
3506 R::CopyOverlapped( m_data->string, m_data->string+1, len-2 );
3507 m_data->SetLength( len-2 );
3511 Data* newData = Data::New( len-2 );
3512 R::Copy( newData->string, m_data->string+1, len-2 );
3544 Append( fill, width-len );
3562 Prepend( fill, width-len );
3584 Prepend( fill, n2 );
3585 Append( fill, n-n2 );
3651 template <
class R1,
class A1>
3654 return R::CompareCodePoints( m_data->string, Length(), s.m_data->string, s.
Length(), caseSensitive );
3684 return R::CompareCodePoints( m_data->string, Length(), t, R::Length( t ), caseSensitive );
3717 return R::CompareCodePoints( m_data->string, Length(), &c, 1, caseSensitive );
3746 template <
class R1,
class A1>
3748 bool caseSensitive =
true,
bool localeAware =
true ) const noexcept
3750 return R::Compare( m_data->string, Length(), s.m_data->string, s.
Length(), caseSensitive, localeAware );
3782 return R::Compare( m_data->string, Length(), t, R::Length( t ), caseSensitive, localeAware );
3816 return R::Compare( m_data->string, Length(), &c, 1, caseSensitive, localeAware );
3839 template <
class R1,
class A1>
3842 return R::Compare( m_data->string, Length(), s.m_data->string, s.
Length(),
false, localeAware );
3868 return R::Compare( m_data->string, Length(), t, R::Length( t ),
false, localeAware );
3897 return R::Compare( m_data->string, Length(), &c, 1,
false, localeAware );
3915 template <
class R1,
class A1>
3918 return R::WildMatch( m_data->string, Length(), pattern.m_data->string, pattern.
Length(), caseSensitive );
3934 template <
class R1,
class A1>
3937 return R::WildMatch( m_data->string, Length(), pattern.m_data->string, pattern.Length(),
false );
3957 return R::WildMatch( m_data->string, Length(), pattern, R::Length( pattern ), caseSensitive );
3976 return R::WildMatch( m_data->string, Length(), pattern, R::Length( pattern ),
false );
3985 for (
iterator i = m_data->string; i < m_data->end; ++i )
3986 if ( R::IsWildcard( *i ) )
4001 R::ToCaseFolded( m_data->string, len );
4015 R::ToLowercase( m_data->string, len );
4029 R::ToUppercase( m_data->string, len );
4076 for (
iterator i = m_data->string, j = m_data->end; i < --j; ++i )
4099 pcl::Sort( m_data->string, m_data->end );
4125 pcl::Sort( m_data->string, m_data->end, p );
4159 char_type c = *R::SearchTrimLeft( m_data->string, m_data->end );
4160 return R::IsDigit( c ) || R::IsSign( c ) || R::IsDecimalSeparator( c );
4181 char_type c = *R::SearchTrimLeft( m_data->string, m_data->end );
4182 return R::IsSymbolDigit( c );
4208 if ( R::IsStartingSymbolDigit( *i ) )
4211 if ( ++i == m_data->end )
4213 if ( !R::IsSymbolDigit( *i ) )
4216 pos = i - m_data->string;
4234 if ( R::IsStartingSymbolDigit( *m_data->string ) )
4237 if ( !R::IsSymbolDigit( *i ) )
4254 return pcl::Hash64( m_data->string, Size(), seed );
4267 return pcl::Hash32( m_data->string, Size(), seed );
4288 return Data::DeleteFreeList();
4299 void DetachFromData()
4301 if ( !m_data->Detach() )
4302 Data::Dispose( m_data );
4320 if ( m_data->ShouldReallocate( len ) )
4322 m_data->Deallocate();
4323 m_data->Allocate( len );
4326 m_data->SetLength( len );
4330 Data* newData = Data::New( len );
4354 if (
size_type( m_data->capacity - m_data->string ) < newLen+1 )
4356 iterator old = m_data->string;
4357 m_data->Allocate( newLen );
4358 if ( old !=
nullptr )
4361 R::Copy( m_data->string, old, i );
4363 R::Copy( m_data->string+i+n, old+i, len-i );
4364 m_data->alloc.Deallocate( old );
4370 R::CopyOverlapped( m_data->string+i+n, m_data->string+i, len-i );
4371 m_data->SetLength( newLen );
4376 Data* newData = Data::New( newLen );
4378 R::Copy( newData->string, m_data->string, i );
4380 R::Copy( newData->string+i+n, m_data->string+i, len-i );
4391 void Trim( const_iterator left,
size_type len )
4397 if ( m_data->ShouldReallocate( len ) )
4399 iterator old = m_data->string;
4400 m_data->Allocate( len );
4401 R::Copy( m_data->string, left, len );
4402 if ( old !=
nullptr )
4403 m_data->alloc.Deallocate( old );
4407 if ( left != m_data->string )
4408 R::CopyOverlapped( m_data->string, left, len );
4409 m_data->SetLength( len );
4414 Data* newData = Data::New( len );
4415 R::Copy( newData->string, left, len );
4428 void ReplaceChar( char_type c1, char_type c2,
size_type i,
size_type n,
bool caseSensitive )
4436 if ( caseSensitive )
4438 for ( iterator p = m_data->string + i, p1 = p + n; p < p1; ++p )
4443 p = m_data->string + d;
4445 for ( iterator p1 = m_data->string + i + n; ++p < p1; )
4453 c1 = R::ToCaseFolded( c1 );
4454 for ( iterator p = m_data->string + i, p1 = p + n; p < p1; ++p )
4455 if ( R::ToCaseFolded( *p ) == c1 )
4459 p = m_data->string + d;
4461 for ( iterator p1 = m_data->string + i + n; ++p < p1; )
4462 if ( R::ToCaseFolded( *p ) == c1 )
4482 SearchEngine S( t1, n1, caseSensitive );
4486 for (
size_type p = i; (p = S( m_data->string, p, len )) < len; p += n1 )
4487 R::Copy( m_data->string + p, t2, n2 );
4492 for (
size_type p = i; (p = S( m_data->string, p, len )) < len; p += n1 )
4498 newLen += P.Length()*(n2 - n1);
4500 newLen -= P.Length()*(n1 - n2);
4504 Data* newData = Data::New( newLen );
4511 R::Copy( newData->string+targetIndex, m_data->string+sourceIndex, n );
4512 R::Copy( newData->string+targetIndex+n, t2, n2 );
4513 targetIndex += n + n2;
4514 sourceIndex = p + n1;
4516 if ( sourceIndex < len )
4517 R::Copy( newData->string+targetIndex, m_data->string+sourceIndex, len-sourceIndex );
4546 class PCL_CLASS SearchEngine
4560 SearchEngine( const_iterator pattern,
size_type patternLength,
4561 bool caseSensitive =
true,
bool searchLast =
false,
bool useBoyerMoore =
true )
4562 : m_pattern( pattern )
4563 , m_patternLength( int( patternLength ) )
4564 , m_caseSensitive( caseSensitive )
4565 , m_searchLast( searchLast )
4566 , m_useBoyerMoore( useBoyerMoore && m_patternLength > 3 )
4568 if ( m_useBoyerMoore )
4586 if ( endIndex <= startIndex
4587 || m_patternLength <= 0
4588 || endIndex-startIndex <
size_type( m_patternLength )
4590 || m_pattern ==
nullptr )
4593 if ( m_caseSensitive )
4595 if ( m_useBoyerMoore )
4599 for (
size_type i = startIndex, r = endIndex-m_patternLength; i <= r; )
4602 const_iterator t = text + r - i;
4603 const_iterator p = m_pattern;
4604 for (
int j = m_patternLength; --j >= 0; )
4609 skip = j - m_skipList[
uint8( c )];
4622 for (
size_type i = startIndex, r = endIndex-m_patternLength; i <= r; )
4625 const_iterator t = text + i + m_patternLength;
4626 const_iterator p = m_pattern + m_patternLength;
4627 for (
int j = m_patternLength; --j >= 0; )
4633 skip = j - m_skipList[
uint8( c )];
4650 for (
size_type i = endIndex-m_patternLength; ; --i )
4652 const_iterator t = text + i;
4653 const_iterator p = m_pattern;
4654 for (
int j = m_patternLength; ; ++t, ++p )
4661 if ( i == startIndex )
4667 for (
size_type i = startIndex, r = endIndex-m_patternLength; ; ++i )
4669 const_iterator t = text + i;
4670 const_iterator p = m_pattern;
4671 for (
int j = m_patternLength; ; ++t, ++p )
4686 if ( m_useBoyerMoore )
4690 for (
size_type i = startIndex, r = endIndex-m_patternLength; i <= r; )
4693 const_iterator t = text + r - i;
4694 const_iterator p = m_pattern;
4695 for (
int j = m_patternLength; --j >= 0; )
4697 char_type c = R::ToCaseFolded( *t++ );
4698 if ( c != R::ToCaseFolded( *p++ ) )
4700 skip = j - m_skipList[
uint8( c )];
4713 for (
size_type i = startIndex, r = endIndex-m_patternLength; i <= r; )
4716 const_iterator t = text + i + m_patternLength;
4717 const_iterator p = m_pattern + m_patternLength;
4718 for (
int j = m_patternLength; --j >= 0; )
4720 char_type c = R::ToCaseFolded( *--t );
4721 if ( c != R::ToCaseFolded( *--p ) )
4724 skip = j - m_skipList[
uint8( c )];
4741 for (
size_type i = endIndex-m_patternLength; ; --i )
4743 const_iterator t = text + i;
4744 const_iterator p = m_pattern;
4745 for (
int j = m_patternLength; ; ++t, ++p )
4747 if ( R::ToCaseFolded( *t ) != R::ToCaseFolded( *p ) )
4752 if ( i == startIndex )
4758 for (
size_type i = startIndex, r = endIndex-m_patternLength; ; ++i )
4760 const_iterator t = text + i;
4761 const_iterator p = m_pattern;
4762 for (
int j = m_patternLength; ; ++t, ++p )
4764 if ( R::ToCaseFolded( *t ) != R::ToCaseFolded( *p ) )
4780 int m_skipList[ 256 ];
4781 const_iterator m_pattern;
4782 int m_patternLength;
4783 bool m_caseSensitive : 1;
4784 bool m_searchLast : 1;
4785 bool m_useBoyerMoore : 1;
4787 void InitSkipList() noexcept
4789 ::memset( m_skipList, 0xff,
sizeof( m_skipList ) );
4792 const_iterator p = m_pattern + m_patternLength;
4793 if ( m_caseSensitive )
4794 for (
int i = 0; i < m_patternLength; ++i )
4795 m_skipList[
uint8( *--p )] = i;
4797 for (
int i = 0; i < m_patternLength; ++i )
4798 m_skipList[
uint8( R::ToCaseFolded( *--p ) )] = i;
4802 const_iterator p = m_pattern;
4803 if ( m_caseSensitive )
4804 for (
int i = 0; i < m_patternLength; ++i )
4805 m_skipList[
uint8( *p++ )] = i;
4807 for (
int i = 0; i < m_patternLength; ++i )
4808 m_skipList[
uint8( R::ToCaseFolded( *p++ ) )] = i;
4820 class PCL_CLASS Data :
public ReferenceCounter
4824 #ifndef __PCL_NO_STRING_FREE_LIST
4825 static Data* freeList;
4826 static AtomicInt freeLock;
4831 iterator
string =
nullptr;
4832 iterator end =
nullptr;
4833 iterator capacity =
nullptr;
4855 Allocate( len, total );
4878 total = (len <= total) ? alloc.PagedLength( total+1 ) : len+1;
4879 string = alloc.Allocate( total );
4880 capacity =
string + total;
4890 Allocate( len, len );
4903 PCL_PRECONDITION( len <= total )
4904 string = alloc.Allocate( total+1 );
4905 capacity =
string + total+1;
4906 SetLength(
pcl::Min( len, total ) );
4914 PCL_CHECK( (
string ==
nullptr) ? end ==
nullptr :
string < end )
4915 if (
string !=
nullptr )
4917 alloc.Deallocate(
string );
4926 bool ShouldReallocate(
size_type len )
const noexcept
4929 return m <= len || alloc.ReallocatedLength( m, len+1 ) < (m >> 1);
4936 void SetLength(
size_type len ) noexcept
4938 *(end = (
string + len)) = R::Null();
4944 void Reset() noexcept
4946 string = end = capacity =
nullptr;
4955 #ifndef __PCL_NO_STRING_FREE_LIST
4956 static Data* NextFree() noexcept
4958 if ( freeLock.TestAndSet( 0, 1 ) )
4960 Data* data = freeList;
4961 if ( data !=
nullptr )
4962 freeList =
reinterpret_cast<Data*
>( data->string );
4963 freeLock.Store( 0 );
4979 #ifndef __PCL_NO_STRING_FREE_LIST
4980 Data* data = NextFree();
4981 if ( data !=
nullptr )
4983 data->string =
nullptr;
4999 #ifndef __PCL_NO_STRING_FREE_LIST
5000 Data* data = NextFree();
5001 if ( data !=
nullptr )
5003 data->Allocate( len );
5007 return new Data( len );
5019 #ifndef __PCL_NO_STRING_FREE_LIST
5020 Data* data = NextFree();
5021 if ( data !=
nullptr )
5023 data->Allocate( len, total );
5027 return new Data( len, total );
5037 static void Dispose( Data* data )
5039 PCL_PRECONDITION( data !=
nullptr )
5040 PCL_CHECK( data->RefCount() == 0 )
5041 #ifndef __PCL_NO_STRING_FREE_LIST
5042 if ( freeLock.TestAndSet( 0, 1 ) )
5046 data->string =
reinterpret_cast<iterator
>( freeList );
5048 freeLock.Store( 0 );
5065 #ifndef __PCL_NO_STRING_FREE_LIST
5066 while ( freeList !=
nullptr )
5068 Data* data = freeList;
5069 freeList =
reinterpret_cast<Data*
>( data->string );
5070 data->string =
nullptr;
5082 Data* m_data =
nullptr;
5085 #ifndef __PCL_NO_STRING_FREE_LIST
5087 template <
class T,
class R,
class A>
5088 typename GenericString<T,R,A>::Data* GenericString<T,R,A>::Data::freeList =
nullptr;
5090 template <
class T,
class R,
class A>
5091 AtomicInt GenericString<T,R,A>::Data::freeLock;
5098 template <
class T,
class R,
class A>
inline
5116 template <
class T,
class R1,
class A1,
class R2,
class A2>
inline
5119 return s1.CompareCodePoints( s2 ) == 0;
5129 template <
class T,
class R1,
class A1,
class R2,
class A2>
inline
5132 return s1.CompareCodePoints( s2 ) < 0;
5142 template <
class T,
class R1,
class A1,
class R2,
class A2>
inline
5145 return s1.CompareCodePoints( s2 ) <= 0;
5155 template <
class T,
class R1,
class A1,
class R2,
class A2>
inline
5158 return s1.CompareCodePoints( s2 ) > 0;
5168 template <
class T,
class R1,
class A1,
class R2,
class A2>
inline
5171 return s1.CompareCodePoints( s2 ) >= 0;
5180 template <
class T,
class R,
class A>
inline
5183 return s1.CompareCodePoints( t2 ) == 0;
5193 template <
class T,
class R,
class A>
inline
5196 return s1.CompareCodePoints( t2 ) < 0;
5206 template <
class T,
class R,
class A>
inline
5209 return s1.CompareCodePoints( t2 ) <= 0;
5219 template <
class T,
class R,
class A>
inline
5222 return s1.CompareCodePoints( t2 ) > 0;
5232 template <
class T,
class R,
class A>
inline
5235 return s1.CompareCodePoints( t2 ) >= 0;
5244 template <
class T,
class R,
class A>
inline
5247 return s2.CompareCodePoints( t1 ) == 0;
5257 template <
class T,
class R,
class A>
inline
5260 return s2.CompareCodePoints( t1 ) > 0;
5270 template <
class T,
class R,
class A>
inline
5273 return s2.CompareCodePoints( t1 ) >= 0;
5283 template <
class T,
class R,
class A>
inline
5286 return s2.CompareCodePoints( t1 ) < 0;
5296 template <
class T,
class R,
class A>
inline
5299 return s2.CompareCodePoints( t1 ) <= 0;
5308 template <
class T,
class R,
class A>
inline
5311 return s1.CompareCodePoints( c2 ) == 0;
5321 template <
class T,
class R,
class A>
inline
5324 return s1.CompareCodePoints( c2 ) < 0;
5334 template <
class T,
class R,
class A>
inline
5337 return s1.CompareCodePoints( c2 ) <= 0;
5347 template <
class T,
class R,
class A>
inline
5350 return s1.CompareCodePoints( c2 ) > 0;
5360 template <
class T,
class R,
class A>
inline
5363 return s1.CompareCodePoints( c2 ) >= 0;
5372 template <
class T,
class R,
class A>
inline
5375 return s2.CompareCodePoints( c1 ) == 0;
5385 template <
class T,
class R,
class A>
inline
5388 return s2.CompareCodePoints( c1 ) > 0;
5398 template <
class T,
class R,
class A>
inline
5401 return s2.CompareCodePoints( c1 ) >= 0;
5411 template <
class T,
class R,
class A>
inline
5414 return s2.CompareCodePoints( c1 ) < 0;
5424 template <
class T,
class R,
class A>
inline
5427 return s2.CompareCodePoints( c1 ) <= 0;
5600 (void)
operator =( s );
5662 (void)
operator =( t );
5706 (void)Format(
"%hd", x );
5716 (void)Format(
"%hu", x );
5726 (void)Format(
"%i", x );
5736 (void)Format(
"%u", x );
5746 (void)Format(
"%ld", x );
5756 (void)Format(
"%lu", x );
5766 (void)Format(
"%lli", x );
5776 (void)Format(
"%llu", x );
5786 (void)Format(
"%.7g", x );
5796 (void)Format(
"%.16g", x );
5807 (void)Format(
"%.16Lg", x );
5809 (void)Format(
"%.18Lg", x );
5813 #ifndef __PCL_NO_STRING_COMPLEX
5822 (void)Format(
"{%.7g,%.7g}", x.
Real(), x.
Imag() );
5832 (void)Format(
"{%.16g,%.16g}", x.
Real(), x.
Imag() );
5843 (void)Format(
"{%.16Lg,%.16Lg}", x.
Real(), x.
Imag() );
5845 (void)Format(
"{%.18Lg,%.18Lg}", x.
Real(), x.
Imag() );
5851 #ifdef __PCL_QT_INTERFACE
5855 : string_base( qs.isEmpty() ? iterator( nullptr ) : iterator( PCL_GET_CHARPTR_FROM_QSTRING( qs ) ) )
5860 IsoString(
const QAnyStringView& qv )
5861 : string_base( qv.isEmpty() ? iterator( nullptr ) : iterator( PCL_GET_CHARPTR_FROM_QSTRINGVIEW( qv ) ) )
5866 IsoString(
const QByteArray& qb )
5867 : string_base( qb.isEmpty() ? iterator( nullptr ) : iterator( PCL_GET_CHARPTR_FROM_QBYTEARRAY( qb ) ) )
5872 IsoString(
const QDate& qd )
5873 : string_base( iterator( PCL_GET_CHARPTR_FROM_QSTRING( qd.toString( PCL_QDATE_FMT_STR ) ) ) )
5878 IsoString(
const QDateTime& qdt )
5879 : string_base( iterator( PCL_GET_CHARPTR_FROM_QSTRING( qdt.toString( PCL_QDATETIME_FMT_STR ) ) ) )
5937 return operator =( s.
Begin() );
5970 IsoString& operator =( const_c_ustring t );
5972 #ifdef __PCL_QT_INTERFACE
5974 IsoString& operator =(
const QString& qs )
5979 Assign( PCL_GET_CHARPTR_FROM_QSTRING( qs ) );
5983 IsoString& operator =(
const QByteArray& qb )
5988 Assign( PCL_GET_CHARPTR_FROM_QBYTEARRAY( qb ) );
5992 IsoString& operator =(
const QDate& qd )
5994 Assign( PCL_GET_CHARPTR_FROM_QSTRING( qd.toString( PCL_QDATE_FMT_STR ) ) );
5998 IsoString& operator =(
const QDateTime& qdt )
6000 Assign( PCL_GET_CHARPTR_FROM_QSTRING( qdt.toString( PCL_QDATETIME_FMT_STR ) ) );
6008 IsoString SetToLength(
size_type n )
const
6010 return string_base::SetToLength( n );
6013 IsoString ResizedToNullTerminated()
const
6015 return string_base::ResizedToNullTerminated();
6018 IsoString Squeezed()
const
6020 return string_base::Squeezed();
6027 return string_base::Substring( i, n );
6032 return string_base::Left( n );
6037 return string_base::Right( n );
6042 return string_base::Suffix( i );
6047 return string_base::Prefix( i );
6052 IsoString Trimmed()
const
6054 return string_base::Trimmed();
6057 IsoString TrimmedLeft()
const
6059 return string_base::TrimmedLeft();
6062 IsoString TrimmedRight()
const
6064 return string_base::TrimmedRight();
6071 return string_base::LeftJustified( width, fill );
6076 return string_base::RightJustified( width, fill );
6081 return string_base::CenterJustified( width, fill );
6086 IsoString Enclosed( char_type c )
const
6088 return string_base::Enclosed( c );
6091 IsoString SingleQuoted()
const
6093 return string_base::SingleQuoted();
6096 IsoString DoubleQuoted()
const
6098 return string_base::DoubleQuoted();
6101 IsoString Unquoted()
const
6103 return string_base::Unquoted();
6108 IsoString CaseFolded()
const
6110 return string_base::CaseFolded();
6113 IsoString Lowercase()
const
6115 return string_base::Lowercase();
6118 IsoString Uppercase()
const
6120 return string_base::Uppercase();
6125 IsoString Reversed()
const
6127 return string_base::Reversed();
6130 IsoString Sorted()
const
6132 return string_base::Sorted();
6136 IsoString Sorted( BP p )
const
6138 return string_base::Sorted( p );
6156 return c.ToSeparated( *
this, separator );
6175 template <
class C,
class AF>
6179 return c.ToSeparated( *
this, separator, append );
6195 return c.ToSeparated( *
this, separator );
6214 template <
class C,
class AF>
6218 return c.ToSeparated( *
this, separator, append );
6233 return ToSeparated( c,
IsoString( separator ) );
6252 template <
class C,
class AF>
6255 return ToSeparated( c,
IsoString( separator ), append );
6449 return ToURLEncoded( c.Begin(), c.Length()*
sizeof( *c.Begin() ) );
6497 return FromURLEncoded( c.Begin(), c.Length()*
sizeof( *c.Begin() ) );
6513 return FromURLEncoded( Begin(), Length() );
6538 return ToURLDecoded( c.Begin(), c.Length()*
sizeof( *c.Begin() ) );
6565 #ifdef __PCL_QT_INTERFACE
6567 operator QString()
const
6569 return QString( c_str() );
6572 operator QAnyStringView()
const
6574 return QAnyStringView( c_str() );
6577 operator QByteArray()
const
6579 return QByteArray( c_str() );
6582 operator QDate()
const
6584 return QDate::fromString( c_str(), PCL_QDATE_FMT_STR );
6587 operator QDateTime()
const
6589 return QDateTime::fromString( c_str(), PCL_QDATETIME_FMT_STR );
6608 va_start( paramList, fmt );
6610 (void)VFormat( fmt, paramList );
6612 va_end( paramList );
6630 va_start( paramList, fmt );
6632 (void)AppendVFormat( fmt, paramList );
6634 va_end( paramList );
6682 for (
const_iterator i = m_data->string; i < m_data->end; ++p, ++i )
6713 #ifdef __PCL_QT_INTERFACE
6715 QString ToQString()
const
6717 return operator QString();
6720 QByteArray ToQByteArray()
const
6722 return operator QByteArray();
6725 QDate ToQDate()
const
6727 return operator QDate();
6730 QDateTime ToQDateTime()
const
6732 return operator QDateTime();
6884 return TryToInt( value, 0 );
6981 return TryToUInt( value, 0 );
7037 return ToInt64( 0 );
7066 return TryToInt64( value, 0 );
7120 return ToUInt64( 0 );
7149 return TryToUInt64( value, 0 );
7185 bool TryToUInt64(
unsigned long long& value,
int base )
const noexcept;
7253 #ifndef __PCL_NO_STRING_VECTOR
7304 int sign, s1, s2;
double s3;
7305 ParseSexagesimal( sign, s1, s2, s3, separator );
7306 return sign*(s1 + (s2 + s3/60)/60);
7309 double SexagesimalToDouble(
char separator )
const
7311 return SexagesimalToDouble(
IsoString( separator ) );
7314 double SexagesimalToDouble(
const ustring_base& separator )
const
7316 return SexagesimalToDouble( IsoString( separator ) );
7334 int sign, s1, s2;
double s3;
7335 ParseSexagesimal( sign, s1, s2, s3, separators );
7336 return sign*(s1 + (s2 + s3/60)/60);
7358 int sign, s1, s2;
double s3;
7359 if ( TryParseSexagesimal( sign, s1, s2, s3, separator ) )
7361 value = sign*(s1 + (s2 + s3/60)/60);
7367 bool TrySexagesimalToDouble(
double& value,
char separator )
const noexcept
7369 return TrySexagesimalToDouble( value,
IsoString( separator ) );
7372 bool TrySexagesimalToDouble(
double& value,
const ustring_base& separator )
const noexcept
7374 return TrySexagesimalToDouble( value, IsoString( separator ) );
7391 int sign, s1, s2;
double s3;
7392 if ( TryParseSexagesimal( sign, s1, s2, s3, separators ) )
7394 value = sign*(s1 + (s2 + s3/60)/60);
7428 void ParseSexagesimal(
int& sign,
int& s1,
int& s2,
double& s3,
char separator )
const
7430 ParseSexagesimal( sign, s1, s2, s3,
IsoString( separator ) );
7433 void ParseSexagesimal(
int& sign,
int& s1,
int& s2,
double& s3,
const ustring_base& separator )
const
7435 ParseSexagesimal( sign, s1, s2, s3,
IsoString( separator ) );
7470 bool TryParseSexagesimal(
int& sign,
int& s1,
int& s2,
double& s3,
char separator ) const noexcept
7472 return TryParseSexagesimal( sign, s1, s2, s3,
IsoString( separator ) );
7475 bool TryParseSexagesimal(
int& sign,
int& s1,
int& s2,
double& s3,
const ustring_base& separator )
const noexcept
7477 return TryParseSexagesimal( sign, s1, s2, s3,
IsoString( separator ) );
7534 return ToSexagesimal( (d < 0) ? -1 : +1,
Abs( d ), 0, 0, options );
7651 return ToHex( c.Begin(), c.Length()*
sizeof( *c.Begin() ) );
7683 return ToBase64( c.Begin(), c.Length()*
sizeof( *c.Begin() ) );
7702 IsoString b64 = ToBase64( data, length );
7707 else if ( c ==
'/' )
7726 return ToBase64URL( c.Begin(), c.Length()*
sizeof( *c.Begin() ) );
7784 else if ( c ==
'_' )
7847 return std::move( s1 );
7869 return std::move( s2 );
7891 return std::move( s1 );
7913 return std::move( s1 );
7949 return std::move( s1 );
7983 return std::move( s2 );
8019 return std::move( s1 );
8053 return std::move( s2 );
8126 #ifndef __PCL_NO_STRING_OSTREAM
8128 inline std::ostream&
operator <<( std::ostream& o,
const IsoString& s )
8130 return o << s.c_str();
8204 using c16_string = char16_t*;
8209 using const_c16_string =
const char16_t*;
8357 :
String( l.begin(), l.end() )
8451 String( std::initializer_list<char8_type> l )
8452 :
String( l.begin(), l.end() )
8471 Assign( x ?
"true" :
"false" );
8481 (void)Format( L
"%hd", x );
8491 (void)Format( L
"%hu", x );
8501 (void)Format( L
"%i", x );
8511 (void)Format( L
"%u", x );
8521 (void)Format( L
"%ld", x );
8531 (void)Format( L
"%lu", x );
8541 (void)Format( L
"%lli", x );
8551 (void)Format( L
"%llu", x );
8561 (void)Format( L
"%.7g", x );
8571 (void)Format( L
"%.16g", x );
8582 (void)Format( L
"%.16Lg", x );
8584 (void)Format( L
"%.18Lg", x );
8588 #ifndef __PCL_NO_STRING_COMPLEX
8596 (void)Format( L
"{%.7g,%.7g}", x.
Real(), x.
Imag() );
8605 (void)Format( L
"{%.16g,%.16g}", x.
Real(), x.
Imag() );
8615 (void)Format( L
"{%.16Lg,%.16Lg}", x.
Real(), x.
Imag() );
8617 (void)Format( L
"{%.18Lg,%.18Lg}", x.
Real(), x.
Imag() );
8623 #ifdef __PCL_QT_INTERFACE
8626 String(
const QString& qs )
8627 : string_base( qs.isEmpty() ? iterator( nullptr ) : iterator( PCL_GET_CHAR16PTR_FROM_QSTRING( qs ) ) )
8632 String(
const QDate& qd )
8633 : string_base( iterator( PCL_GET_CHAR16PTR_FROM_QSTRING( qd.toString( PCL_QDATE_FMT_STR ) ) ) )
8638 String(
const QDateTime& qdt )
8639 : string_base( iterator( PCL_GET_CHAR16PTR_FROM_QSTRING( qdt.toString( PCL_QDATETIME_FMT_STR ) ) ) )
8652 string_base::Assign( s );
8661 string_base::Transfer( s );
8671 string_base::Assign( s );
8681 string_base::Transfer( s );
8701 string_base::Assign( t );
8711 string_base::Assign( c );
8775 #ifdef __PCL_QT_INTERFACE
8777 String& operator =(
const QString& qs )
8782 string_base::Assign( PCL_GET_CHAR16PTR_FROM_QSTRING( qs ) );
8786 String& operator =(
const QDate& qd )
8788 string_base::Assign( PCL_GET_CHAR16PTR_FROM_QSTRING( qd.toString( PCL_QDATE_FMT_STR ) ) );
8792 String& operator =(
const QDateTime& qdt )
8794 string_base::Assign( PCL_GET_CHAR16PTR_FROM_QSTRING( qdt.toString( PCL_QDATETIME_FMT_STR ) ) );
8807 string_base::Assign( s );
8816 string_base::Assign( s, i, n );
8824 string_base::Assign( t );
8833 string_base::Assign( i, j );
8842 void Assign( std::initializer_list<char_type> l )
8844 Assign( l.begin(), l.end() );
8854 string_base::Assign( t, i, n );
8862 string_base::Assign( c, n );
8880 string_base::Assign(
reinterpret_cast<const_iterator>( t ), i, n );
8888 string_base::Assign(
char_type( c ), n );
8908 string_base::Assign(
char_type( c ), n );
8919 MaybeReallocate( n );
8922 for (
iterator i = m_data->string; i < m_data->end; ++i, ++t )
8935 size_type n = char8_traits::Length( t );
8938 MaybeReallocate( n );
8940 for (
iterator i = m_data->string; i < m_data->end; ++i, ++t )
8954 size_type len = char8_traits::Length( t );
8958 MaybeReallocate( n );
8961 for (
iterator i = m_data->string; i < m_data->end; ++i, ++t )
8976 MaybeReallocate( q - p );
8978 for (
iterator i = m_data->string; i < m_data->end; ++i, ++p )
8992 void Assign( std::initializer_list<char8_type> l )
8994 Assign( l.begin(), l.end() );
9002 string_base::Assign(
char_type( c ), n );
9009 string_base::Insert( i, s );
9012 void Insert(
size_type i, const_iterator p, const_iterator q )
9014 string_base::Insert( i, p, q );
9017 void Insert(
size_type i, const_iterator t )
9019 string_base::Insert( i, t );
9024 string_base::Insert( i, t, n );
9029 string_base::Insert( i, c, n );
9032 void Insert(
size_type i,
const char16_t* t )
9034 string_base::Insert( i,
reinterpret_cast<const_iterator
>( t ) );
9039 string_base::Insert( i, String( c, n ) );
9042 void Insert(
size_type i,
const wchar_t* t )
9044 #ifdef __PCL_WINDOWS
9045 string_base::Insert( i,
reinterpret_cast<const_iterator
>( t ) );
9047 string_base::Insert( i, String( t ) );
9053 string_base::Insert( i, String( c, n ) );
9061 UninitializedGrow( i, n );
9062 const_char8_iterator t = s.Begin();
9064 for ( iterator p = m_data->string+i, q = p+n; p < q; ++p, ++t )
9065 *p = char_type(
uint8( *t ) );
9069 void Insert(
size_type i,
const string8_base& s )
9074 UninitializedGrow( i, n );
9075 const_char8_iterator t = s.Begin();
9077 for ( iterator p = m_data->string+i, q = p+n; p < q; ++p, ++t )
9078 *p = char_type(
uint8( *t ) );
9082 void Insert(
size_type i, const_c_string8 t )
9084 size_type n = char8_traits::Length( t );
9087 UninitializedGrow( i, n );
9089 for ( iterator p = m_data->string+i, q = p+n; p < q; ++p, ++t )
9090 *p = char_type(
uint8( *t ) );
9096 n =
pcl::Min( n, char8_traits::Length( t ) );
9099 UninitializedGrow( i, n );
9101 for ( iterator p = m_data->string+i, q = p+n; p < q; ++p, ++t )
9102 *p = char_type(
uint8( *t ) );
9106 void Insert(
size_type i, const_char8_iterator p, const_char8_iterator q )
9111 UninitializedGrow( i, n );
9113 for ( iterator r = m_data->string+i, s = r+n; r < s; ++r, ++p )
9114 *r = char_type(
uint8( *p ) );
9120 string_base::Insert( i, char_type( c ), n );
9125 void Append(
const String& s )
9127 string_base::Append( s );
9130 String& operator +=(
const String& s )
9136 void Append( const_iterator i, const_iterator j )
9138 string_base::Append( i, j );
9141 void Append( const_iterator t )
9143 string_base::Append( t );
9146 String& operator +=( const_iterator t )
9152 void Append( const_iterator t,
size_type n )
9154 string_base::Append( t, n );
9157 void Append( char_type c,
size_type n = 1 )
9159 string_base::Append( c, n );
9162 String& operator +=( char_type c )
9168 void Append(
const char16_t* t )
9170 string_base::Append(
reinterpret_cast<const_iterator
>( t ) );
9173 String& operator +=(
const char16_t* t )
9179 void Append( char16_t c,
size_type n = 1 )
9181 string_base::Append( char_type( c ), n );
9184 String& operator +=( char16_t c )
9190 void Append(
const wchar_t* t )
9192 #ifdef __PCL_WINDOWS
9193 string_base::Append(
reinterpret_cast<const_iterator
>( t ) );
9195 string_base::Append( String( t ) );
9199 String& operator +=(
const wchar_t* t )
9205 void Append(
wchar_t c,
size_type n = 1 )
9207 string_base::Append( char_type( c ), n );
9210 String& operator +=(
wchar_t c )
9216 void Append(
const string8_base& s )
9218 Insert( maxPos, s );
9221 String& operator +=(
const string8_base& s )
9227 void Append(
const string8_base& s,
size_type n )
9229 Insert( maxPos, s, n );
9232 void Append( const_c_string8 t )
9234 Insert( maxPos, t );
9237 String& operator +=( const_c_string8 t )
9243 void Append( const_c_string8 t,
size_type n )
9245 Insert( maxPos, t, n );
9248 void Append( const_char8_iterator p, const_char8_iterator q )
9250 Insert( maxPos, p, q );
9253 void Append( char8_type c,
size_type n = 1 )
9255 string_base::Append( char_type( c ), n );
9258 String& operator +=( char8_type c )
9264 void Add(
const String& s )
9269 void Add( const_iterator i, const_iterator j )
9274 void Add( const_iterator t )
9279 void Add( const_iterator t,
size_type n )
9284 void Add( char_type c,
size_type n = 1 )
9289 void Add(
const char16_t* t )
9299 void Add(
const wchar_t* t )
9309 void Add(
const string8_base& s )
9314 void Add(
const string8_base& s,
size_type n )
9319 void Add( const_c_string8 t )
9324 void Add( const_c_string8 t,
size_type n )
9329 void Add( const_char8_iterator p, const_char8_iterator q )
9334 void Add( char8_type c,
size_type n = 1 )
9341 void Prepend(
const String& s )
9343 string_base::Prepend( s );
9346 String& operator -=(
const String& s )
9352 void Prepend( const_iterator i, const_iterator j )
9354 string_base::Prepend( i, j );
9357 void Prepend( const_iterator t )
9359 string_base::Prepend( t );
9362 String& operator -=( const_iterator t )
9368 void Prepend( const_iterator t,
size_type n )
9370 string_base::Prepend( t, n );
9373 void Prepend( char_type c,
size_type n = 1 )
9375 string_base::Prepend( c, n );
9378 String& operator -=( char_type c )
9384 void Prepend(
const char16_t* t )
9386 string_base::Prepend(
reinterpret_cast<const_iterator
>( t ) );
9389 String& operator -=(
const char16_t* t )
9395 void Prepend( char16_t c,
size_type n = 1 )
9397 string_base::Prepend( char_type( c ), n );
9400 String& operator -=( char16_t c )
9406 void Prepend(
const wchar_t* t )
9408 #ifdef __PCL_WINDOWS
9409 string_base::Prepend(
reinterpret_cast<const_iterator
>( t ) );
9411 string_base::Prepend( String( t ) );
9415 String& operator -=(
const wchar_t* t )
9421 void Prepend(
wchar_t c,
size_type n = 1 )
9423 string_base::Prepend( char_type( c ), n );
9426 String& operator -=(
wchar_t c )
9432 void Prepend(
const string8_base& s )
9437 String& operator -=(
const string8_base& s )
9443 void Prepend(
const string8_base& s,
size_type n )
9448 void Prepend( const_c_string8 t )
9453 String& operator -=( const_c_string8 t )
9459 void Prepend( const_c_string8 t,
size_type n )
9464 void Prepend( const_char8_iterator p, const_char8_iterator q )
9469 void Prepend( char8_type c,
size_type n = 1 )
9471 string_base::Prepend( String( c, n ) );
9474 String& operator -=( char8_type c )
9484 string_base::Replace( i, n, s );
9489 string_base::Replace( i, n, t );
9494 string_base::Replace( i, n, c, nc );
9499 string_base::Replace( i, n,
reinterpret_cast<const_iterator
>( t ) );
9504 string_base::Replace( i, n, char_type( c ), nc );
9509 #ifdef __PCL_WINDOWS
9510 string_base::Replace( i, n,
reinterpret_cast<const_iterator
>( t ) );
9512 string_base::Replace( i, n, String( t ) );
9518 string_base::Replace( i, n, char_type( c ), nc );
9533 size_type nt = char8_traits::Length( t );
9537 UninitializedGrow( i, nt-n );
9544 for ( iterator p = m_data->string+i, q = p+nt; p < q; ++p, ++t )
9545 *p = char_type( *t );
9556 string_base::Replace( i, n, char_type( c ), nc );
9561 void ReplaceChar( char_type c1, char_type c2,
size_type i = 0,
size_type n = maxPos )
9563 string_base::ReplaceChar( c1, c2, i, n );
9566 void ReplaceCharIC( char_type c1, char_type c2,
size_type i = 0,
size_type n = maxPos )
9568 string_base::ReplaceCharIC( c1, c2, i, n );
9573 string_base::ReplaceChar( char_type( c1 ), char_type( c2 ), i, n );
9576 void ReplaceCharIC( char16_t c1, char16_t c2,
size_type i = 0,
size_type n = maxPos )
9578 string_base::ReplaceCharIC( char_type( c1 ), char_type( c2 ), i, n );
9583 string_base::ReplaceChar( char_type( c1 ), char_type( c2 ), i, n );
9588 string_base::ReplaceCharIC( char_type( c1 ), char_type( c2 ), i, n );
9591 void ReplaceChar( char8_type c1, char8_type c2,
size_type i = 0,
size_type n = maxPos )
9593 string_base::ReplaceChar( char_type( c1 ), char_type( c2 ), i, n );
9596 void ReplaceCharIC( char8_type c1, char8_type c2,
size_type i = 0,
size_type n = maxPos )
9598 string_base::ReplaceCharIC( char_type( c1 ), char_type( c2 ), i, n );
9603 void ReplaceString(
const String& s1,
const String& s2,
size_type i = 0 )
9605 string_base::ReplaceString( s1, s2, i );
9608 void ReplaceStringIC(
const String& s1,
const String& s2,
size_type i = 0 )
9610 string_base::ReplaceStringIC( s1, s2, i );
9613 void ReplaceString( const_iterator t1, const_iterator t2,
size_type i = 0 )
9615 string_base::ReplaceString( t1, t2, i );
9618 void ReplaceStringIC( const_iterator t1, const_iterator t2,
size_type i = 0 )
9620 string_base::ReplaceStringIC( t1, t2, i );
9623 void ReplaceString(
const char16_t* t1,
const char16_t* t2,
size_type i = 0 )
9625 string_base::ReplaceString(
reinterpret_cast<const_iterator
>( t1 ),
9626 reinterpret_cast<const_iterator
>( t2 ), i );
9629 void ReplaceStringIC(
const char16_t* t1,
const char16_t* t2,
size_type i = 0 )
9631 string_base::ReplaceStringIC(
reinterpret_cast<const_iterator
>( t1 ),
9632 reinterpret_cast<const_iterator
>( t2 ), i );
9635 void ReplaceString(
const wchar_t* t1,
const wchar_t* t2,
size_type i = 0 )
9637 #ifdef __PCL_WINDOWS
9638 string_base::ReplaceString(
reinterpret_cast<const_iterator
>( t1 ),
9639 reinterpret_cast<const_iterator
>( t2 ), i );
9641 string_base::ReplaceString( String( t1 ), String( t2 ), i );
9645 void ReplaceStringIC(
const wchar_t* t1,
const wchar_t* t2,
size_type i = 0 )
9647 #ifdef __PCL_WINDOWS
9648 string_base::ReplaceStringIC(
reinterpret_cast<const_iterator
>( t1 ),
9649 reinterpret_cast<const_iterator
>( t2 ), i );
9651 string_base::ReplaceStringIC( String( t1 ), String( t2 ), i );
9655 void ReplaceString( const_c_string8 t1, const_c_string8 t2,
size_type i = 0 )
9657 string_base::ReplaceString( String( t1 ), String( t2 ), i );
9660 void ReplaceStringIC( const_c_string8 t1, const_c_string8 t2,
size_type i = 0 )
9662 string_base::ReplaceStringIC( String( t1 ), String( t2 ), i );
9667 void DeleteChar( char_type c,
size_type i = 0 )
9669 string_base::DeleteChar( c, i );
9672 void DeleteCharIC( char_type c,
size_type i = 0 )
9674 string_base::DeleteCharIC( c, i );
9677 void DeleteChar( char16_t c,
size_type i = 0 )
9679 string_base::DeleteChar( char_type( c ), i );
9682 void DeleteCharIC( char16_t c,
size_type i = 0 )
9684 string_base::DeleteCharIC( char_type( c ), i );
9687 void DeleteChar(
wchar_t c,
size_type i = 0 )
9689 string_base::DeleteChar( char_type( c ), i );
9692 void DeleteCharIC(
wchar_t c,
size_type i = 0 )
9694 string_base::DeleteCharIC( char_type( c ), i );
9697 void DeleteChar( char8_type c,
size_type i = 0 )
9699 string_base::DeleteChar( char_type( c ), i );
9702 void DeleteCharIC( char8_type c,
size_type i = 0 )
9704 string_base::DeleteCharIC( char_type( c ), i );
9709 void DeleteString(
const String& s,
size_type i = 0 )
9711 string_base::DeleteString( s, i );
9714 void DeleteStringIC(
const String& s,
size_type i = 0 )
9716 string_base::DeleteStringIC( s, i );
9719 void DeleteString( const_iterator t,
size_type i = 0 )
9721 string_base::DeleteString( t, i );
9724 void DeleteStringIC( const_iterator t,
size_type i = 0 )
9726 string_base::DeleteStringIC( t, i );
9729 void DeleteString(
const char16_t* t,
size_type i = 0 )
9731 string_base::DeleteString(
reinterpret_cast<const_iterator
>( t ), i );
9734 void DeleteStringIC(
const char16_t* t,
size_type i = 0 )
9736 string_base::DeleteStringIC(
reinterpret_cast<const_iterator
>( t ), i );
9739 void DeleteString(
const wchar_t* t,
size_type i = 0 )
9741 #ifdef __PCL_WINDOWS
9742 string_base::DeleteString(
reinterpret_cast<const_iterator
>( t ), i );
9744 string_base::DeleteString( String( t ), i );
9748 void DeleteStringIC(
const wchar_t* t,
size_type i = 0 )
9750 #ifdef __PCL_WINDOWS
9751 string_base::DeleteStringIC(
reinterpret_cast<const_iterator
>( t ), i );
9753 string_base::DeleteStringIC( String( t ), i );
9757 void DeleteString( const_c_string8 t,
size_type i = 0 )
9759 string_base::DeleteString( String( t ), i );
9762 void DeleteStringIC( const_c_string8 t,
size_type i = 0 )
9764 string_base::DeleteStringIC( String( t ), i );
9769 bool StartsWith(
const String& s )
const noexcept
9771 return string_base::StartsWith( s );
9774 bool StartsWith( const_iterator t )
const noexcept
9776 return string_base::StartsWith( t );
9779 bool StartsWith( char_type c )
const noexcept
9781 return string_base::StartsWith( c );
9784 bool StartsWithIC(
const String& s )
const noexcept
9786 return string_base::StartsWithIC( s );
9789 bool StartsWithIC( const_iterator t )
const noexcept
9791 return string_base::StartsWithIC( t );
9794 bool StartsWithIC( char_type c )
const noexcept
9796 return string_base::StartsWithIC( c );
9799 bool StartsWith(
const char16_t* t )
const noexcept
9801 return string_base::StartsWith(
reinterpret_cast<const_iterator
>( t ) );
9804 bool StartsWith( char16_t c )
const noexcept
9806 return string_base::StartsWith( char_type( c ) );
9809 bool StartsWithIC(
const char16_t* t )
const noexcept
9811 return string_base::StartsWithIC(
reinterpret_cast<const_iterator
>( t ) );
9814 bool StartsWithIC( char16_t c )
const noexcept
9816 return string_base::StartsWithIC( char_type( c ) );
9819 bool StartsWith(
const wchar_t* t )
const noexcept
9821 #ifdef __PCL_WINDOWS
9822 return string_base::StartsWith(
reinterpret_cast<const_iterator
>( t ) );
9824 return string_base::StartsWith( String( t ) );
9828 bool StartsWith(
wchar_t c )
const noexcept
9830 return string_base::StartsWith( char_type( c ) );
9833 bool StartsWithIC(
const wchar_t* t )
const noexcept
9835 #ifdef __PCL_WINDOWS
9836 return string_base::StartsWithIC(
reinterpret_cast<const_iterator
>( t ) );
9838 return string_base::StartsWithIC( String( t ) );
9842 bool StartsWithIC(
wchar_t c )
const noexcept
9844 return string_base::StartsWithIC( char_type( c ) );
9847 bool StartsWith( const_c_string8 t )
const noexcept
9849 size_type n = char8_traits::Length( t );
9850 if ( n == 0 || Length() < n )
9852 for ( const_iterator p = m_data->string, q = p+n; p < q; ++p, ++t )
9853 if ( *p != char_type( *t ) )
9858 bool StartsWith( char8_type c )
const noexcept
9860 return string_base::StartsWith( char_type( c ) );
9863 bool StartsWithIC( const_c_string8 t )
const noexcept
9865 size_type n = char8_traits::Length( t );
9866 if ( n == 0 || Length() < n )
9868 for ( const_iterator p = m_data->string, q = p+n; p < q; ++p, ++t )
9869 if ( char_traits::ToCaseFolded( *p ) != char_type( char8_traits::ToCaseFolded( *t ) ) )
9874 bool StartsWithIC( char8_type c )
const noexcept
9876 return string_base::StartsWithIC( char_type( c ) );
9881 bool EndsWith(
const String& s )
const noexcept
9883 return string_base::EndsWith( s );
9886 bool EndsWith( const_iterator t )
const noexcept
9888 return string_base::EndsWith( t );
9891 bool EndsWith( char_type c )
const noexcept
9893 return string_base::EndsWith( c );
9896 bool EndsWithIC(
const String& s )
const noexcept
9898 return string_base::EndsWithIC( s );
9901 bool EndsWithIC( const_iterator t )
const noexcept
9903 return string_base::EndsWithIC( t );
9906 bool EndsWithIC( char_type c )
const noexcept
9908 return string_base::EndsWithIC( c );
9911 bool EndsWith(
const char16_t* t )
const noexcept
9913 return string_base::EndsWith(
reinterpret_cast<const_iterator
>( t ) );
9916 bool EndsWith( char16_t c )
const noexcept
9918 return string_base::EndsWith( char_type( c ) );
9921 bool EndsWithIC(
const char16_t* t )
const noexcept
9923 return string_base::EndsWithIC(
reinterpret_cast<const_iterator
>( t ) );
9926 bool EndsWithIC( char16_t c )
const noexcept
9928 return string_base::EndsWithIC( char_type( c ) );
9931 bool EndsWith(
const wchar_t* t )
const noexcept
9933 #ifdef __PCL_WINDOWS
9934 return string_base::EndsWith(
reinterpret_cast<const_iterator
>( t ) );
9936 return string_base::EndsWith( String( t ) );
9940 bool EndsWith(
wchar_t c )
const noexcept
9942 return string_base::EndsWith( char_type( c ) );
9945 bool EndsWithIC(
const wchar_t* t )
const noexcept
9947 #ifdef __PCL_WINDOWS
9948 return string_base::EndsWithIC(
reinterpret_cast<const_iterator
>( t ) );
9950 return string_base::EndsWithIC( String( t ) );
9954 bool EndsWithIC(
wchar_t c )
const noexcept
9956 return string_base::EndsWithIC( char_type( c ) );
9959 bool EndsWith( const_c_string8 t )
const noexcept
9961 size_type n = char8_traits::Length( t );
9962 if ( n == 0 || Length() < n )
9964 for ( const_iterator p = m_data->end-n; p < m_data->end; ++p, ++t )
9965 if ( *p != char_type( *t ) )
9970 bool EndsWith( char8_type c )
const noexcept
9972 return string_base::EndsWith( char_type( c ) );
9975 bool EndsWithIC( const_c_string8 t )
const noexcept
9977 size_type n = char8_traits::Length( t );
9978 if ( n == 0 || Length() < n )
9980 for ( const_iterator p = m_data->end-n; p < m_data->end; ++p, ++t )
9981 if ( char_traits::ToCaseFolded( *p ) != char_type( char8_traits::ToCaseFolded( *t ) ) )
9986 bool EndsWithIC( char8_type c )
const noexcept
9988 return string_base::EndsWithIC( char_type( c ) );
9995 return string_base::FindFirst( s, i );
10000 return string_base::FindFirst( t, i );
10005 return string_base::FindFirst( c, i );
10010 return string_base::FindFirstIC( s, i );
10015 return string_base::FindFirstIC( t, i );
10020 return string_base::FindFirstIC( c, i );
10025 return string_base::FindFirst(
reinterpret_cast<const_iterator
>( t ), i );
10030 return string_base::FindFirst( char_type( c ), i );
10035 return string_base::FindFirstIC(
reinterpret_cast<const_iterator
>( t ), i );
10040 return string_base::FindFirstIC( char_type( c ), i );
10045 #ifdef __PCL_WINDOWS
10046 return string_base::FindFirst(
reinterpret_cast<const_iterator
>( t ), i );
10048 return string_base::FindFirst( String( t ), i );
10054 return string_base::FindFirst( char_type( c ), i );
10059 #ifdef __PCL_WINDOWS
10060 return string_base::FindFirstIC(
reinterpret_cast<const_iterator
>( t ), i );
10062 return string_base::FindFirstIC( String( t ), i );
10068 return string_base::FindFirstIC( char_type( c ), i );
10073 return string_base::FindFirst( String( t ), i );
10078 return string_base::FindFirst( char_type( c ), i );
10083 return string_base::FindFirstIC( String( t ), i );
10088 return string_base::FindFirstIC( char_type( c ), i );
10095 return FindFirst( s, i );
10100 return FindFirst( t, i );
10105 return FindFirst( c, i );
10110 return FindFirst( t, i );
10115 return FindFirst( c, i );
10120 return FindFirst( t, i );
10125 return FindFirst( c, i );
10130 return FindFirst( t, i );
10135 return FindFirst( c, i );
10140 return FindFirstIC( s, i );
10145 return FindFirstIC( t, i );
10150 return FindFirstIC( c, i );
10155 return FindFirstIC( t, i );
10160 return FindFirstIC( c, i );
10165 return FindFirstIC( t, i );
10170 return FindFirstIC( c, i );
10175 return FindFirstIC( t, i );
10180 return FindFirstIC( c, i );
10187 return string_base::FindLast( s, r );
10192 return string_base::FindLast( t, r );
10197 return string_base::FindLast( c, r );
10202 return string_base::FindLastIC( s, r );
10207 return string_base::FindLastIC( t, r );
10212 return string_base::FindLastIC( c, r );
10217 return string_base::FindLast(
reinterpret_cast<const_iterator
>( t ), r );
10222 return string_base::FindLast( char_type( c ), r );
10227 return string_base::FindLastIC(
reinterpret_cast<const_iterator
>( t ), r );
10232 return string_base::FindLastIC( char_type( c ), r );
10237 #ifdef __PCL_WINDOWS
10238 return string_base::FindLast(
reinterpret_cast<const_iterator
>( t ), r );
10240 return string_base::FindLast( String( t ), r );
10246 return string_base::FindLast( char_type( c ), r );
10251 #ifdef __PCL_WINDOWS
10252 return string_base::FindLastIC(
reinterpret_cast<const_iterator
>( t ), r );
10254 return string_base::FindLastIC( String( t ), r );
10260 return string_base::FindLastIC( char_type( c ), r );
10265 return string_base::FindLast( String( t ), r );
10270 return string_base::FindLast( char_type( c ), r );
10275 return string_base::FindLastIC( String( t ), r );
10280 return string_base::FindLastIC( char_type( c ), r );
10285 bool Contains(
const String& s )
const noexcept
10287 return string_base::Contains( s );
10290 bool Contains( const_iterator t )
const noexcept
10292 return string_base::Contains( t );
10295 bool Contains( char_type c )
const noexcept
10297 return string_base::Contains( c );
10300 bool ContainsIC(
const String& s )
const noexcept
10302 return string_base::ContainsIC( s );
10305 bool ContainsIC( const_iterator t )
const noexcept
10307 return string_base::ContainsIC( t );
10310 bool ContainsIC( char_type c )
const noexcept
10312 return string_base::ContainsIC( c );
10315 bool Contains(
const char16_t* t )
const noexcept
10317 return string_base::Contains(
reinterpret_cast<const_iterator
>( t ) );
10320 bool Contains( char16_t c )
const noexcept
10322 return string_base::Contains( char_type( c ) );
10325 bool ContainsIC(
const char16_t* t )
const noexcept
10327 return string_base::ContainsIC(
reinterpret_cast<const_iterator
>( t ) );
10330 bool ContainsIC( char16_t c )
const noexcept
10332 return string_base::ContainsIC( char_type( c ) );
10335 bool Contains(
const wchar_t* t )
const noexcept
10337 #ifdef __PCL_WINDOWS
10338 return string_base::Contains(
reinterpret_cast<const_iterator
>( t ) );
10340 return string_base::Contains( String( t ) );
10344 bool Contains(
wchar_t c )
const noexcept
10346 return string_base::Contains( char_type( c ) );
10349 bool ContainsIC(
const wchar_t* t )
const noexcept
10351 #ifdef __PCL_WINDOWS
10352 return string_base::ContainsIC(
reinterpret_cast<const_iterator
>( t ) );
10354 return string_base::ContainsIC( String( t ) );
10358 bool ContainsIC(
wchar_t c )
const noexcept
10360 return string_base::ContainsIC( char_type( c ) );
10363 bool Contains( const_c_string8 t )
const noexcept
10365 return string_base::Contains( String( t ) );
10368 bool Contains( char8_type c )
const noexcept
10370 return string_base::Contains( char_type( c ) );
10373 bool ContainsIC( const_c_string8 t )
const noexcept
10375 return string_base::ContainsIC( String( t ) );
10378 bool ContainsIC( char8_type c )
const noexcept
10380 return string_base::ContainsIC( char_type( c ) );
10385 int CompareCodePoints(
const String& s,
bool caseSensitive =
true ) const noexcept
10387 return string_base::CompareCodePoints( s, caseSensitive );
10390 int CompareCodePoints( const_iterator t,
bool caseSensitive =
true ) const noexcept
10392 return string_base::CompareCodePoints( t, caseSensitive );
10395 int CompareCodePoints( char_type c,
bool caseSensitive =
true ) const noexcept
10397 return string_base::CompareCodePoints( c, caseSensitive );
10400 int CompareCodePoints(
const char16_t* t,
bool caseSensitive =
true ) const noexcept
10402 return string_base::CompareCodePoints(
reinterpret_cast<const_iterator
>( t ), caseSensitive );
10405 int CompareCodePoints( char16_t c,
bool caseSensitive =
true ) const noexcept
10407 return string_base::CompareCodePoints( char_type( c ), caseSensitive );
10410 int CompareCodePoints(
const wchar_t* t,
bool caseSensitive =
true ) const noexcept
10412 #ifdef __PCL_WINDOWS
10413 return string_base::CompareCodePoints(
reinterpret_cast<const_iterator
>( t ), caseSensitive );
10415 return string_base::CompareCodePoints( String( t ), caseSensitive );
10419 int CompareCodePoints(
wchar_t c,
bool caseSensitive =
true ) const noexcept
10421 return string_base::CompareCodePoints( char_type( c ), caseSensitive );
10424 int CompareCodePoints( const_c_string8 t,
bool caseSensitive =
true ) const noexcept
10426 return string_base::CompareCodePoints( String( t ), caseSensitive );
10429 int CompareCodePoints( char8_type c,
bool caseSensitive =
true ) const noexcept
10431 return string_base::CompareCodePoints( char_type( c ), caseSensitive );
10436 int Compare(
const String& s,
bool caseSensitive =
true,
bool localeAware =
true ) const noexcept
10441 int Compare( const_iterator t,
bool caseSensitive =
true,
bool localeAware =
true ) const noexcept
10446 int Compare( char_type c,
bool caseSensitive =
true,
bool localeAware =
true ) const noexcept
10451 int CompareIC(
const String& s,
bool localeAware =
true ) const noexcept
10453 return string_base::CompareIC( s, localeAware );
10456 int CompareIC( const_iterator t,
bool localeAware =
true ) const noexcept
10458 return string_base::CompareIC( t, localeAware );
10461 int CompareIC( char_type c,
bool localeAware =
true ) const noexcept
10463 return string_base::CompareIC( c, localeAware );
10466 int Compare(
const char16_t* t,
bool caseSensitive =
true,
bool localeAware =
true ) const noexcept
10468 return string_base::Compare(
reinterpret_cast<const_iterator
>( t ), caseSensitive, localeAware );
10471 int Compare( char16_t c,
bool caseSensitive =
true,
bool localeAware =
true ) const noexcept
10476 int CompareIC(
const char16_t* t,
bool localeAware =
true ) const noexcept
10478 return string_base::CompareIC(
reinterpret_cast<const_iterator
>( t ), localeAware );
10481 int CompareIC( char16_t c,
bool localeAware =
true ) const noexcept
10483 return string_base::CompareIC( char_type( c ), localeAware );
10486 int Compare(
const wchar_t* t,
bool caseSensitive =
true,
bool localeAware =
true ) const noexcept
10488 #ifdef __PCL_WINDOWS
10489 return string_base::Compare(
reinterpret_cast<const_iterator
>( t ), caseSensitive, localeAware );
10495 int Compare(
wchar_t c,
bool caseSensitive =
true,
bool localeAware =
true ) const noexcept
10500 int CompareIC(
const wchar_t* t,
bool localeAware =
true ) const noexcept
10502 #ifdef __PCL_WINDOWS
10503 return string_base::CompareIC(
reinterpret_cast<const_iterator
>( t ), localeAware );
10505 return string_base::CompareIC( String( t ), localeAware );
10509 int CompareIC(
wchar_t c,
bool localeAware =
true ) const noexcept
10511 return string_base::CompareIC( char_type( c ), localeAware );
10514 int Compare( const_c_string8 t,
bool caseSensitive =
true,
bool localeAware =
true ) const noexcept
10519 int Compare( char8_type c,
bool caseSensitive =
true,
bool localeAware =
true ) const noexcept
10524 int CompareIC( const_c_string8 t,
bool localeAware =
true ) const noexcept
10526 return string_base::CompareIC( String( t ), localeAware );
10529 int CompareIC( char8_type c,
bool localeAware =
true ) const noexcept
10531 return string_base::CompareIC( char_type( c ), localeAware );
10536 bool WildMatch(
const String& pattern,
bool caseSensitive =
true ) const noexcept
10538 return string_base::WildMatch( pattern, caseSensitive );
10541 bool WildMatchIC(
const String& pattern )
const noexcept
10543 return string_base::WildMatchIC( pattern );
10546 bool WildMatch( const_iterator pattern,
bool caseSensitive =
true ) const noexcept
10548 return string_base::WildMatch( pattern, caseSensitive );
10551 bool WildMatchIC( const_iterator pattern )
const noexcept
10553 return string_base::WildMatchIC( pattern );
10556 bool WildMatch(
const string8_base& pattern,
bool caseSensitive =
true ) const noexcept
10558 return char_traits::WildMatch( m_data->string, Length(), pattern.Begin(), pattern.Length(), caseSensitive );
10561 bool WildMatchIC(
const string8_base& pattern )
const noexcept
10563 return char_traits::WildMatch( m_data->string, Length(), pattern.Begin(), pattern.Length(),
false );
10566 bool WildMatch( const_c_string8 pattern,
bool caseSensitive =
true ) const noexcept
10568 return char_traits::WildMatch( m_data->string, Length(), pattern, char8_traits::Length( pattern ), caseSensitive );
10571 bool WildMatchIC( const_c_string8 pattern )
const noexcept
10573 return char_traits::WildMatch( m_data->string, Length(), pattern, char8_traits::Length( pattern ),
false );
10578 String SetToLength(
size_type n )
const
10580 return string_base::SetToLength( n );
10583 String ResizedToNullTerminated()
const
10585 return string_base::ResizedToNullTerminated();
10588 String Squeezed()
const
10590 return string_base::Squeezed();
10597 return string_base::Substring( i, n );
10602 return string_base::Left( n );
10607 return string_base::Right( n );
10612 return string_base::Suffix( i );
10617 return string_base::Prefix( i );
10623 size_type Break( C& list,
const String& s,
bool trim =
false,
size_type i = 0 )
const
10625 return string_base::Break( list, s, trim, i );
10629 size_type Break( C& list,
const string8_base& s,
bool trim =
false,
size_type i = 0 )
const
10631 return string_base::Break( list, String( s ), trim, i );
10635 size_type Break( C& list, const_c_string8 s,
bool trim =
false,
size_type i = 0 )
const
10637 return string_base::Break( list, String( s ), trim, i );
10643 return string_base::Break( list, c, trim, i );
10649 return string_base::Break( list, char_type( c ), trim, i );
10652 template <
class C,
typename S>
10653 size_type Break( C& list,
const Array<S>& ca,
bool trim =
false,
size_type i = 0 )
const
10655 return string_base::Break( list, ca, trim, i );
10661 size_type BreakIC( C& list,
const String& s,
bool trim =
false,
size_type i = 0 )
const
10663 return string_base::BreakIC( list, s, trim, i );
10667 size_type BreakIC( C& list,
const string8_base& s,
bool trim =
false,
size_type i = 0 )
const
10669 return string_base::BreakIC( list, String( s ), trim, i );
10673 size_type BreakIC( C& list, const_c_string8 s,
bool trim =
false,
size_type i = 0 )
const
10675 return string_base::BreakIC( list, String( s ), trim, i );
10681 return string_base::BreakIC( list, c, trim, i );
10685 size_type BreakIC( C& list, char8_type c,
bool trim =
false,
size_type i = 0 )
const
10687 return string_base::BreakIC( list, char_type( c ), trim, i );
10692 String Trimmed()
const
10694 return string_base::Trimmed();
10697 String TrimmedLeft()
const
10699 return string_base::TrimmedLeft();
10702 String TrimmedRight()
const
10704 return string_base::TrimmedRight();
10711 return string_base::LeftJustified( width, fill );
10716 return string_base::RightJustified( width, fill );
10721 return string_base::CenterJustified( width, fill );
10726 String Enclosed( char_type c )
const
10728 return string_base::Enclosed( c );
10731 String SingleQuoted()
const
10733 return string_base::SingleQuoted();
10736 String DoubleQuoted()
const
10738 return string_base::DoubleQuoted();
10741 String Unquoted()
const
10743 return string_base::Unquoted();
10748 String CaseFolded()
const
10750 return string_base::CaseFolded();
10753 String Lowercase()
const
10755 return string_base::Lowercase();
10758 String Uppercase()
const
10760 return string_base::Uppercase();
10765 String Reversed()
const
10767 return string_base::Reversed();
10770 String Sorted()
const
10772 return string_base::Sorted();
10775 template <
class BP>
10776 String Sorted( BP p )
const
10778 return string_base::Sorted( p );
10796 return c.ToSeparated( *
this, separator );
10815 template <
class C,
class AF>
10819 return c.ToSeparated( *
this, separator, append );
10835 return c.ToSeparated( *
this, separator );
10854 template <
class C,
class AF>
10858 return c.ToSeparated( *
this, separator, append );
10873 return ToSeparated( c,
String( separator ) );
10892 template <
class C,
class AF>
10895 return ToSeparated( c,
String( separator ), append );
10911 return ToSeparated( c,
String( separator ) );
10930 template <
class C,
class AF>
10933 return ToSeparated( c,
String( separator ), append );
11101 #ifdef __PCL_QT_INTERFACE
11103 operator QString()
const
11105 return PCL_GET_QSTRING_FROM_CHAR16PTR( c_str() );
11108 operator QDate()
const
11110 return QDate::fromString(
operator QString(), PCL_QDATE_FMT_STR );
11113 operator QDateTime()
const
11115 return QDateTime::fromString(
operator QString(), PCL_QDATETIME_FMT_STR );
11134 va_start( paramList, fmt );
11136 (void)VFormat( fmt, paramList );
11138 va_end( paramList );
11156 va_start( paramList, fmt );
11158 (void)AppendVFormat( fmt, paramList );
11160 va_end( paramList );
11179 int count = s.
VFormat( fmt, paramList );
11199 int count = s.
VFormat( fmt, paramList );
11219 va_start( paramList, fmt );
11221 (void)VFormat( fmt, paramList );
11223 va_end( paramList );
11242 va_start( paramList, fmt );
11244 (void)AppendVFormat( fmt, paramList );
11246 va_end( paramList );
11359 return UTF16ToUTF8( Begin(), i, n );
11389 #ifdef __PCL_WINDOWS
11425 #ifdef __PCL_WINDOWS
11426 char_traits::Copy(
reinterpret_cast<iterator>( a.Begin() ), m_data->string+i, n );
11429 for (
const_iterator s = m_data->string+i, e = s+n; s < e; ++w, ++s )
11430 *w = wchar_t( *s );
11449 return UTF16ToUTF32( Begin(), i, n );
11452 #ifdef __PCL_QT_INTERFACE
11454 QString ToQString()
const
11456 return operator QString();
11459 QDate ToQDate()
const
11461 return operator QDate();
11464 QDateTime ToQDateTime()
const
11466 return operator QDateTime();
11617 return TryToInt( value, 0 );
11686 return ToUInt( 0 );
11714 return TryToUInt( value, 0 );
11770 return ToInt64( 0 );
11799 return TryToInt64( value, 0 );
11853 return ToUInt64( 0 );
11882 return TryToUInt64( value, 0 );
11986 #ifndef __PCL_NO_STRING_VECTOR
12037 int sign, s1, s2;
double s3;
12038 ParseSexagesimal( sign, s1, s2, s3, separator );
12039 return sign*(s1 + (s2 + s3/60)/60);
12057 int sign, s1, s2;
double s3;
12058 ParseSexagesimal( sign, s1, s2, s3, separators );
12059 return sign*(s1 + (s2 + s3/60)/60);
12081 int sign, s1, s2;
double s3;
12082 if ( TryParseSexagesimal( sign, s1, s2, s3, separator ) )
12084 value = sign*(s1 + (s2 + s3/60)/60);
12104 int sign, s1, s2;
double s3;
12105 if ( TryParseSexagesimal( sign, s1, s2, s3, separators ) )
12107 value = sign*(s1 + (s2 + s3/60)/60);
12186 bool TryParseSexagesimal(
int& sign,
int& s1,
int& s2,
double& s3, const
Array<
char_type>& separators ) const noexcept;
12212 static
String ToSexagesimal(
int sign,
double s1,
double s2,
double s3,
12227 return ToSexagesimal( (d < 0) ? -1 : +1,
Abs( d ), 0, 0, options );
12350 m_data->Allocate( n =
pcl::Min( n, len-p ) );
12352 for (
iterator i = m_data->string; i < m_data->
end; ++i, ++t )
12362 MaybeReallocate( len );
12363 for (
iterator i = m_data->string; i < m_data->
end; ++i, ++t )
12403 return String( std::move( s1 ) );
12414 return std::move( s1 );
12425 return String( std::move( s2 ) );
12436 return std::move( s2 );
12447 return String( std::move( s1 ) );
12458 return std::move( s1 );
12469 return String( std::move( s1 ) );
12480 return std::move( s1 );
12505 return String( std::move( s1 ) );
12516 return std::move( s1 );
12539 return String( std::move( s2 ) );
12550 return std::move( s2 );
12575 return String( std::move( s1 ) );
12586 return std::move( s1 );
12609 return String( std::move( s2 ) );
12620 return std::move( s2 );
12644 String s = std::move( s1 );
12657 return std::move( s1 );
12679 String s = std::move( s2 );
12692 return std::move( s2 );
12716 String s = std::move( s1 );
12729 return std::move( s1 );
12751 String s = std::move( s2 );
12764 return std::move( s2 );
12788 String s = std::move( s1 );
12801 return std::move( s1 );
12823 String s = std::move( s2 );
12836 return std::move( s2 );
12860 String s = std::move( s1 );
12873 return std::move( s1 );
12895 String s = std::move( s2 );
12908 return std::move( s2 );
12932 String s = std::move( s1 );
12945 return std::move( s1 );
12967 String s = std::move( s2 );
12980 return std::move( s2 );
13004 String s = std::move( s1 );
13017 return std::move( s1 );
13039 String s = std::move( s2 );
13052 return std::move( s2 );
13077 return String( std::move( s1 ) );
13088 return std::move( s1 );
13111 return String( std::move( s2 ) );
13122 return std::move( s2 );
13359 return s1.CompareCodePoints( t2 ) == 0;
13370 return s1.CompareCodePoints( t2 ) < 0;
13381 return s1.CompareCodePoints( t2 ) <= 0;
13392 return s1.CompareCodePoints( t2 ) > 0;
13403 return s1.CompareCodePoints( t2 ) >= 0;
13414 return s2.CompareCodePoints( t1 ) == 0;
13425 return s2.CompareCodePoints( t1 ) > 0;
13436 return s2.CompareCodePoints( t1 ) >= 0;
13447 return s2.CompareCodePoints( t1 ) < 0;
13458 return s2.CompareCodePoints( t1 ) <= 0;
13469 return s1.CompareCodePoints( c2 ) == 0;
13480 return s1.CompareCodePoints( c2 ) < 0;
13491 return s1.CompareCodePoints( c2 ) <= 0;
13502 return s1.CompareCodePoints( c2 ) > 0;
13513 return s1.CompareCodePoints( c2 ) >= 0;
13524 return s2.CompareCodePoints( c1 ) == 0;
13535 return s2.CompareCodePoints( c1 ) > 0;
13546 return s2.CompareCodePoints( c1 ) >= 0;
13557 return s2.CompareCodePoints( c1 ) < 0;
13568 return s2.CompareCodePoints( c1 ) <= 0;
13579 return s1.CompareCodePoints( t2 ) == 0;
13590 return s1.CompareCodePoints( t2 ) < 0;
13601 return s1.CompareCodePoints( t2 ) <= 0;
13612 return s1.CompareCodePoints( t2 ) > 0;
13623 return s1.CompareCodePoints( t2 ) >= 0;
13634 return s2.CompareCodePoints( t1 ) == 0;
13645 return s2.CompareCodePoints( t1 ) > 0;
13656 return s2.CompareCodePoints( t1 ) >= 0;
13667 return s2.CompareCodePoints( t1 ) < 0;
13678 return s2.CompareCodePoints( t1 ) <= 0;
13689 return s1.CompareCodePoints( c2 ) == 0;
13700 return s1.CompareCodePoints( c2 ) < 0;
13711 return s1.CompareCodePoints( c2 ) <= 0;
13722 return s1.CompareCodePoints( c2 ) > 0;
13733 return s1.CompareCodePoints( c2 ) >= 0;
13744 return s2.CompareCodePoints( c1 ) == 0;
13755 return s2.CompareCodePoints( c1 ) > 0;
13766 return s2.CompareCodePoints( c1 ) >= 0;
13777 return s2.CompareCodePoints( c1 ) < 0;
13788 return s2.CompareCodePoints( c1 ) <= 0;
13799 return s1.CompareCodePoints( t2 ) == 0;
13810 return s1.CompareCodePoints( t2 ) < 0;
13821 return s1.CompareCodePoints( t2 ) <= 0;
13832 return s1.CompareCodePoints( t2 ) > 0;
13843 return s1.CompareCodePoints( t2 ) >= 0;
13854 return s2.CompareCodePoints( t1 ) == 0;
13865 return s2.CompareCodePoints( t1 ) > 0;
13876 return s2.CompareCodePoints( t1 ) >= 0;
13887 return s2.CompareCodePoints( t1 ) < 0;
13898 return s2.CompareCodePoints( t1 ) <= 0;
13909 return s1.CompareCodePoints( c2 ) == 0;
13920 return s1.CompareCodePoints( c2 ) < 0;
13931 return s1.CompareCodePoints( c2 ) <= 0;
13942 return s1.CompareCodePoints( c2 ) > 0;
13953 return s1.CompareCodePoints( c2 ) >= 0;
13964 return s2.CompareCodePoints( c1 ) == 0;
13975 return s2.CompareCodePoints( c1 ) > 0;
13986 return s2.CompareCodePoints( c1 ) >= 0;
13997 return s2.CompareCodePoints( c1 ) < 0;
14008 return s2.CompareCodePoints( c1 ) <= 0;
14013 #ifndef __PCL_NO_STRING_OSTREAM
14015 inline std::wostream&
operator <<( std::wostream& o,
const String& s )
14017 #ifdef __PCL_WINDOWS
14018 return o << reinterpret_cast<const wchar_t*>( s.c_str() );
14020 Array<wchar_t> w = s.ToWCharArray();
14021 return o << w.Begin();
14025 inline std::ostream&
operator <<( std::ostream& o,
const String& s )
14027 return o << s.ToUTF8();
Provides memory allocation for PCL containers.
bool IsEmpty() const noexcept
A template instantiation of GenericCharTraits for char16_type.
static size_type Length(const char_type *__restrict__ s) noexcept
constexpr T Imag() const noexcept
constexpr T Real() const noexcept
Root base class of all PCL containers of objects.
A type-safe collection of enumerated flags.
static constexpr char_type LF() noexcept
static constexpr char_type Colon() noexcept
static constexpr char_type Null() noexcept
static constexpr char_type Hyphen() noexcept
static constexpr char_type Blank() noexcept
static constexpr char_type Comma() noexcept
static constexpr char_type Tab() noexcept
Generic character string.
size_type FindFirstIC(const_c_string t, size_type i=0) const noexcept
void Append(const_c_string t)
int CompareIC(const_c_string t, bool localeAware=true) const noexcept
void JustifyCenter(size_type width, char_type fill=R::Blank())
int CompareCodePoints(const GenericString< T, R1, A1 > &s, bool caseSensitive=true) const noexcept
static size_type DeleteFreeList()
void Transfer(GenericString &s)
bool WildMatch(const GenericString< T, R1, A1 > &pattern, bool caseSensitive=true) const noexcept
bool ContainsIC(const_c_string t) const noexcept
size_type FindFirst(const_c_string t, size_type i=0) const noexcept
reverse_iterator ReverseBegin()
const_iterator begin() const noexcept
size_type Find(const GenericString< T, R1, A1 > &s, size_type i=0) const noexcept
void ReplaceString(const GenericString< T, R1, A1 > &s1, const GenericString< T, R2, A2 > &s2, size_type i=0)
bool StartsWith(const_c_string t) const noexcept
void Insert(size_type i, const_c_string t, size_type n)
void JustifyRight(size_type width, char_type fill=R::Blank())
void ReplaceChar(char_type c1, char_type c2, size_type i=0, size_type n=maxPos)
bool StartsWithIC(char_type c) const noexcept
void Add(const_c_string t, size_type n)
void Swap(GenericString &s) noexcept
void Insert(size_type i, char_type c, size_type n=1)
GenericString ResizedToNullTerminated() const
size_type BreakIC(C &list, char_type c, bool trim=false, size_type i=0) const
GenericString SetToLength(size_type n) const
void DeleteLeft(size_type i)
void EnsureDoubleQuoted()
bool EndsWithIC(char_type c) const noexcept
void c_copy(iterator dst, size_type maxCharsToCopy, size_type i=0) const noexcept
GenericString Left(size_type n) const
void Prepend(const GenericString< T, R1, A1 > &s)
size_type FindIC(const_c_string t, size_type i=0) const noexcept
GenericString(char_type c, size_type n=1)
void Assign(const_iterator i, const_iterator j)
char_type LastChar() const noexcept
size_type FindLast(const_c_string t, size_type r=maxPos) const noexcept
size_type FindIC(const GenericString< T, R1, A1 > &s, size_type i=0) const noexcept
void Assign(const_c_string t, size_type i, size_type n)
GenericString(const_iterator i, const_iterator j)
void Assign(const GenericString &s, size_type i, size_type n)
GenericString Enclosed(char_type c) const
GenericString Suffix(size_type i) const
void Insert(size_type i, const_iterator p, const_iterator q)
void EnsureEnclosed(char_type c)
reverse_iterator ReverseEnd()
size_type FindLast(const GenericString< T, R1, A1 > &s, size_type r=maxPos) const noexcept
const_iterator end() const noexcept
GenericString Lowercase() const
bool Contains(const GenericString< T, R1, A1 > &s) const noexcept
size_type FindFirst(char_type c, size_type i=0) const noexcept
GenericString(std::initializer_list< char_type > l)
void Assign(std::initializer_list< char_type > l)
void Insert(size_type i, const_c_string t)
void Add(char_type c, size_type n=1)
GenericString TrimmedRight() const
void Reserve(size_type n)
GenericString Unquoted() const
bool StartsWith(char_type c) const noexcept
uint64 Hash64(uint64 seed=0) const noexcept
void Assign(const GenericString &s)
void ReplaceStringIC(const GenericString< T, R1, A1 > &s1, const GenericString< T, R2, A2 > &s2, size_type i=0)
bool StartsWithIC(const GenericString< T, R1, A1 > &s) const noexcept
GenericString Uppercase() const
bool ContainsIC(const GenericString< T, R1, A1 > &s) const noexcept
size_type FindLast(char_type c, size_type r=maxPos) const noexcept
GenericString SingleQuoted() const
char_type FirstChar() const noexcept
void Append(const_c_string t, size_type n)
void Assign(const_c_string t)
GenericString Trimmed() const
void Prepend(const_c_string t)
GenericString Sorted() const
size_type IndexAt(const_iterator i) const noexcept
GenericString LeftJustified(size_type width, char_type fill=R::Blank()) const
size_type FindIC(char_type c, size_type i=0) const noexcept
static size_type BytesPerChar() noexcept
void Replace(size_type i, size_type n, const GenericString< T, R1, A1 > &s)
void DeleteCharIC(char_type c, size_type i=0)
GenericString Right(size_type n) const
bool IsValid() const noexcept
GenericString RightJustified(size_type width, char_type fill=R::Blank()) const
bool WildMatch(const_c_string pattern, bool caseSensitive=true) const noexcept
size_type Break(C &list, char_type c, bool trim=false, size_type i=0) const
int Compare(const GenericString< T, R1, A1 > &s, bool caseSensitive=true, bool localeAware=true) const noexcept
bool StartsWith(const GenericString< T, R1, A1 > &s) const noexcept
size_type UpperBound() const noexcept
GenericString Prefix(size_type i) const
const_reverse_iterator ReverseBegin() const noexcept
int CompareCodePoints(const_c_string t, bool caseSensitive=true) const noexcept
int CompareIC(char_type c, bool localeAware=true) const noexcept
GenericString(const GenericString &s)
typename container_type::const_item_type const_item_type
bool EndsWithIC(const GenericString< T, R1, A1 > &s) const noexcept
bool IsEmpty() const noexcept
bool HasWildcards() const noexcept
bool IsValidIdentifier() const noexcept
const allocator & Allocator() const noexcept
void DeleteRight(size_type i)
bool StartsWithIC(const_c_string t) const noexcept
int CompareCodePoints(char_type c, bool caseSensitive=true) const noexcept
GenericString CenterJustified(size_type width, char_type fill=R::Blank()) const
void Add(const_c_string t)
void Append(const_iterator i, const_iterator j)
void DeleteString(const GenericString< T, R1, A1 > &s, size_type i=0)
void Fill(char_type c, size_type i, size_type n=maxPos)
void Replace(size_type i, size_type n, const_c_string t)
void SetLength(size_type n)
bool WildMatchIC(const GenericString< T, R1, A1 > &pattern) const noexcept
size_type FindFirstIC(char_type c, size_type i=0) const noexcept
GenericString(const_c_string t, size_type i, size_type n)
bool IsAliasOf(const GenericString &s) const noexcept
bool IsNumeral() const noexcept
void Prepend(const_iterator i, const_iterator j)
GenericString Sorted(BP p) const
void DeleteStringIC(const_c_string t, size_type i=0)
void Prepend(char_type c, size_type n=1)
bool IsSymbol() const noexcept
bool EndsWith(char_type c) const noexcept
void SecureFill(char c='\0') noexcept
size_type Break(C &list, const Array< S > &ca, bool trim=false, size_type i=0) const
bool Contains(char_type c) const noexcept
GenericString Reversed() const
void DeleteString(const_c_string t, size_type i=0)
bool WildMatchIC(const_c_string pattern) const noexcept
uint32 Hash32(uint32 seed=0) const noexcept
uint64 Hash(uint64 seed=0) const noexcept
size_type FindLastIC(char_type c, size_type r=maxPos) const noexcept
void Delete(size_type i, size_type n=1)
size_type FindFirstIC(const GenericString< T, R1, A1 > &s, size_type i=0) const noexcept
size_type Size() const noexcept
void DeleteChar(char_type c, size_type i=0)
void DeleteStringIC(const GenericString< T, R1, A1 > &s, size_type i=0)
int CompareIC(const GenericString< T, R1, A1 > &s, bool localeAware=true) const noexcept
GenericString(const_c_string t)
int Compare(const_c_string t, bool caseSensitive=true, bool localeAware=true) const noexcept
const_iterator End() const noexcept
size_type Break(C &list, const GenericString< T, R1, A1 > &s, bool trim=false, size_type i=0) const
void JustifyLeft(size_type width, char_type fill=R::Blank())
void ResizeToNullTerminated()
void Add(const GenericString< T, R1, A1 > &s)
size_type Find(const_c_string t, size_type i=0) const noexcept
size_type LowerBound() const noexcept
void Append(const GenericString< T, R1, A1 > &s)
void Replace(size_type i, size_type n, char_type c, size_type nc=1)
bool Contains(const_c_string t) const noexcept
void ReplaceString(const_c_string t1, const_c_string t2, size_type i=0)
void ReplaceStringIC(const_c_string t1, const_c_string t2, size_type i=0)
void SetAllocator(const allocator &a)
size_type FindFirst(const GenericString< T, R1, A1 > &s, size_type i=0) const noexcept
size_type Capacity() const noexcept
size_type Available() const noexcept
void Prepend(const_c_string t, size_type n)
void ReplaceCharIC(char_type c1, char_type c2, size_type i=0, size_type n=maxPos)
void EnsureSingleQuoted()
bool ContainsIC(char_type c) const noexcept
size_type BreakIC(C &list, const GenericString< T, R1, A1 > &s, bool trim=false, size_type i=0) const
bool EndsWithIC(const_c_string t) const noexcept
size_type Find(char_type c, size_type i=0) const noexcept
size_type Break(C &list, const_c_string s, bool trim=false, size_type i=0) const
void Transfer(GenericString &&s)
GenericString DoubleQuoted() const
size_type FindLastIC(const GenericString< T, R1, A1 > &s, size_type r=maxPos) const noexcept
void Append(char_type c, size_type n=1)
void Add(const_iterator i, const_iterator j)
const_iterator Begin() const noexcept
bool EndsWith(const_c_string t) const noexcept
bool IsUnique() const noexcept
void Insert(size_type i, const GenericString< T, R1, A1 > &s)
const_iterator At(size_type i) const noexcept
void Assign(char_type c, size_type n=1)
GenericString CaseFolded() const
GenericString Squeezed() const
int Compare(char_type c, bool caseSensitive=true, bool localeAware=true) const noexcept
const_c_string c_str() const noexcept
GenericString Substring(size_type i, size_type n=maxPos) const
const_reverse_iterator ReverseEnd() const noexcept
GenericString TrimmedLeft() const
typename container_type::item_type item_type
size_type FindLastIC(const_c_string t, size_type r=maxPos) const noexcept
size_type Length() const noexcept
bool IsValidIdentifier(distance_type &pos) const noexcept
bool EndsWith(const GenericString< T, R1, A1 > &s) const noexcept
GenericString(GenericString &&s)
size_type BreakIC(C &list, const_c_string s, bool trim=false, size_type i=0) const
Generic vector of arbitrary length.
A template instantiation of GenericCharTraits for the char type.
Eight-bit string (ISO/IEC-8859-1 or UTF-8 string)
IsoString(const ustring_base &s)
IsoString(Complex< float > &x)
IsoString EncodedHTMLSpecialChars() const
IsoString(std::initializer_list< char_type > l)
string_base::const_iterator const_iterator
GenericVector< double > ParseListOfDoubleAsVector(char separator=',', int maxCount=int_max) const
IsoString(const ByteArray &B)
bool TryToInt(int &value, int base) const noexcept
string_base::item_type item_type
IsoString & ToSeparated(const C &c, char_type separator)
static IsoString ToURLEncoded(const void *data, size_type length)
ustring_base::char_type uchar_type
IsoString & ToURLDecoded()
IsoString & ToCommaSeparated(const C &c)
IsoString & ToHyphenated(const C &c)
int AppendVFormat(const_c_string fmt, va_list paramList)
bool TryToUInt(unsigned &value) const noexcept
IsoString & ToSeparated(const C &c, const_c_string separator)
IsoString & ToSeparated(const C &c, char_type separator, AF append)
IsoString URLDecoded() const
string_base::iterator iterator
bool TryToInt64(long long &value, int base) const noexcept
ByteArray FromBase64() const
IsoString(unsigned long x)
IsoString(const string_base &s)
static IsoString ToBase64URL(const void *data, size_type length)
ByteArray FromHex() const
bool TryToInt64(long long &value) const noexcept
IsoString(unsigned long long x)
static ByteArray FromURLEncoded(const C &c)
string_base::const_item_type const_item_type
IsoString(const IsoString &)=default
unsigned long long ToUInt64(int base) const
bool TryToDouble(double &value) const noexcept
ustring_base::const_c_string const_c_ustring
IsoString & ToEncodedHTMLSpecialChars()
void ParseISO8601DateTime(int &year, int &month, int &day, double &dayf, double &tz) const
IsoString(IsoString &&)=default
IsoString & ToColonSeparated(const C &c)
bool TryToInt(int &value) const noexcept
unsigned long long ToUInt64() const
IsoString & ToSpaceSeparated(const C &c)
IsoString DecodedHTMLSpecialChars() const
static IsoString ToURLDecoded(const C &c)
IsoString & ToNewLineSeparated(const C &c)
long ToInt(int base) const
static IsoString ToURLEncoded(const C &c)
IsoString & ToSeparated(const C &c, const_c_string separator, AF append)
IsoString(Complex< long double > &x)
long long ToInt64() const
static IsoString ToBase64(const void *data, size_type length)
IsoString & ToTabSeparated(const C &c)
IsoString(unsigned int x)
bool TryToUInt64(unsigned long long &value) const noexcept
IsoString(Complex< double > &x)
IsoString(string_base &&s)
unsigned long ToUInt(int base) const
IsoString & ToDecodedHTMLSpecialChars()
IsoString(char_type c, size_type n=1)
ByteArray ToByteArray() const
static IsoString ToHex(const C &c)
ByteArray FromBase64URL() const
IsoString(const_c_ustring t)
IsoString & AppendFormat(const_c_string fmt,...)
ustring_base::c_string c_ustring
static IsoString ToHex(const void *data, size_type length)
GenericVector< float > ParseListOfFloatAsVector(char separator=',', int maxCount=int_max) const
IsoString & ToSeparated(const C &c, const IsoString &separator)
static IsoString ToBase64URL(const C &c)
IsoString & ToSeparated(const C &c, const IsoString &separator, AF append)
static IsoString Random(size_type n, RandomizationOptions options=RandomizationOption::Default)
IsoString & Format(const_c_string fmt,...)
ustring_base MBSToWCS() const
static ByteArray FromURLEncoded(const void *data, size_type length)
Array< double > ParseListOfDouble(char separator=',', size_type maxCount=~size_type(0)) const
string_base::block_allocator block_allocator
IsoString(const_iterator i, const_iterator j)
string_base::char_type char_type
static IsoString CurrentLocalISO8601DateTime(const ISO8601ConversionOptions &options=ISO8601ConversionOptions())
string_base::const_c_string const_c_string
IsoString & ToURLEncoded()
IsoString(unsigned short x)
static IsoString CurrentUTCISO8601DateTime(const ISO8601ConversionOptions &options=ISO8601ConversionOptions())
bool TryParseISO8601DateTime(int &year, int &month, int &day, double &dayf, double &tz) const noexcept
ustring_base UTF8ToUTF16(size_type i=0, size_type n=maxPos) const
IsoString(const_c_string t)
string_base::c_string c_string
IsoString & ToNullSeparated(const C &c)
IsoString & operator=(const IsoString &s)
static IsoString ToURLDecoded(const void *data, size_type length)
static IsoString ToISO8601DateTime(int year, int month, int day, double dayf, double tz=0, const ISO8601ConversionOptions &options=ISO8601ConversionOptions())
unsigned long ToUInt() const
IsoString URLEncoded() const
ustring_base::const_iterator const_uchar_iterator
ByteArray FromURLEncoded() const
int VFormat(const_c_string fmt, va_list paramList)
Array< float > ParseListOfFloat(char separator=',', size_type maxCount=~size_type(0)) const
ustring_base::iterator uchar_iterator
bool TryToBool(bool &value) const noexcept
bool TryToFloat(float &value) const noexcept
bool TryToUInt64(unsigned long long &value, int base) const noexcept
long long ToInt64(int base) const
static IsoString ToBase64(const C &c)
IsoString(const_c_string t, size_type i, size_type n)
ustring_base ToString() const
bool TryToUInt(unsigned &value, int base) const noexcept
A collection of string randomization options.
Reverse random access iterator.
String & ToNewLineSeparated(const C &c)
String & ToSeparated(const C &c, const String &separator)
String(const_char8_iterator i, const_char8_iterator j)
String(Complex< long double > &x)
static IsoString UTF16ToUTF8(const_c_string string, size_type i=0, size_type n=maxPos)
static String CurrentUTCISO8601DateTime(const ISO8601ConversionOptions &options=ISO8601ConversionOptions())
bool TryToInt64(long long &value, int base) const noexcept
GenericVector< double > ParseListOfDoubleAsVector(char separator=',', int maxCount=int_max) const
static String CurrentLocalISO8601DateTime(const ISO8601ConversionOptions &options=ISO8601ConversionOptions())
bool TryToInt(int &value, int base) const noexcept
void Assign(const String &s, size_type i, size_type n)
void Assign(std::initializer_list< char_type > l)
void Assign(const_iterator i, const_iterator j)
IsoString ToLocal8Bit() const
string_base::char_type char_type
String & ToSeparated(const C &c, char_type separator)
int AppendVFormat(const_c_string8 fmt, va_list paramList)
static String UTF32ToUTF16(const uint32 *string, size_type i=0, size_type n=maxPos)
String & ToSeparated(const C &c, char_type separator, AF append)
Array< uint32 > ToUTF32(size_type i=0, size_type n=maxPos) const
void ParseISO8601DateTime(int &year, int &month, int &day, double &dayf, double &tz) const
string8_base::const_c_string const_c_string8
string_base::block_allocator block_allocator
String & AppendFormat(const wchar_t *fmt,...)
Array< wchar_t > ToWCharArray(size_type i=0, size_type n=maxPos) const
String & ToSpaceSeparated(const C &c)
string_base::iterator iterator
String DecodedHTMLSpecialChars() const
String(const wchar_t *t, size_type i, size_type n)
long long ToInt64() const
String & Format(const wchar_t *fmt,...)
String(std::initializer_list< char_type > l)
string_base::item_type item_type
String(const_c_string8 t, size_type i, size_type n)
String(String &&)=default
String & ToSeparated(const C &c, const_c_string8 separator)
String(std::initializer_list< char8_type > l)
void Assign(const_char8_iterator p, const_char8_iterator q)
GenericVector< float > ParseListOfFloatAsVector(char separator=',', int maxCount=int_max) const
bool TryToUInt64(unsigned long long &value) const noexcept
String(Complex< double > &x)
string8_base::c_string c_string8
String(const_c_string8 t)
void Assign(std::initializer_list< char8_type > l)
void Assign(const wchar_t *t, size_type i, size_type n)
bool TryToFloat(float &value) const noexcept
void Assign(const string8_base &s)
String & ToSeparated(const C &c, const String &separator, AF append)
String(char_type c, size_type n)
String(const string_base &s)
void Assign(const_c_string8 t, size_type i, size_type n)
String & ToSeparated(const C &c, const_c_string separator)
String(char8_type c, size_type n=1)
void Assign(const_iterator t, size_type i, size_type n)
String(const String &)=default
string8_base::const_iterator const_char8_iterator
string_base::const_iterator const_iterator
IsoString ToIsoString() const
void Assign(const char16_t *t, size_type i, size_type n)
String & AppendFormat(const_c_string8 fmt,...)
void Assign(char_type c, size_type n=1)
bool TryParseISO8601DateTime(int &year, int &month, int &day, double &dayf, double &tz) const noexcept
bool TryToUInt(unsigned &value, int base) const noexcept
static Array< uint32 > UTF16ToUTF32(const_c_string string, size_type i=0, size_type n=maxPos)
String & Format(const_c_string8 fmt,...)
String & ToNullSeparated(const C &c)
String(Complex< float > &x)
String(const string8_base &s)
Array< float > ParseListOfFloat(char separator=',', size_type maxCount=~size_type(0)) const
void Assign(char16_t c, size_type n=1)
bool TryToInt64(long long &value) const noexcept
long ToInt(int base) const
bool TryToUInt(unsigned &value) const noexcept
bool TryToInt(int &value) const noexcept
void Assign(const_iterator t)
void Assign(char8_type c, size_type n=1)
unsigned long ToUInt() const
String & ToSeparated(const C &c, const_c_string separator, AF append)
string8_base::char_type char8_type
void Assign(const char16_t *t)
String(const_iterator i, const_iterator j)
String & ToHyphenated(const C &c)
void Assign(wchar_t c, size_type n=1)
string8_base::iterator char8_iterator
long long ToInt64(int base) const
string_base::const_item_type const_item_type
static String Random(size_type n, RandomizationOptions options=RandomizationOption::Default)
void Assign(const wchar_t *t)
String(const char16_t *t, size_type i, size_type n)
int VFormat(const wchar_t *fmt, va_list paramList)
String & ToCommaSeparated(const C &c)
int VFormat(const_c_string8 fmt, va_list paramList)
static String ToISO8601DateTime(int year, int month, int day, double dayf, double tz=0, const ISO8601ConversionOptions &options=ISO8601ConversionOptions())
String(unsigned long long x)
String & ToColonSeparated(const C &c)
String(const char16_t *t)
void Assign(const_c_string8 t)
string_base::c_string c_string
string_base::const_c_string const_c_string
String(char16_t c, size_type n)
void Assign(const String &s)
bool TryToUInt64(unsigned long long &value, int base) const noexcept
GenericString< char16_type, CharTraits, PCL_STRING_ALLOCATOR > string_base
bool TryToDouble(double &value) const noexcept
String EncodedHTMLSpecialChars() const
unsigned long long ToUInt64(int base) const
String(const_iterator t, size_type i, size_type n)
String(wchar_t c, size_type n)
String & ToSeparated(const C &c, const_c_string8 separator, AF append)
int AppendVFormat(const wchar_t *fmt, va_list paramList)
String & ToEncodedHTMLSpecialChars()
String & ToTabSeparated(const C &c)
String & ToDecodedHTMLSpecialChars()
IsoString ToUTF8(size_type i=0, size_type n=maxPos) const
unsigned long long ToUInt64() const
static String UTF8ToUTF16(const_c_string8 string, size_type i=0, size_type n=maxPos)
Array< double > ParseListOfDouble(char separator=',', size_type maxCount=~size_type(0)) const
bool TryToBool(bool &value) const noexcept
unsigned long ToUInt(int base) const
IsoString To7BitASCII() const
Array< T, A > & operator<<(Array< T, A > &x, const V &v)
bool operator==(const Array< T, A > &x1, const Array< T, A > &x2) noexcept
bool operator<(const Array< T, A > &x1, const Array< T, A > &x2) noexcept
Complex< T1 > operator*(const Complex< T1 > &c1, const Complex< T2 > &c2) noexcept
Complex< T1 > operator+(const Complex< T1 > &c1, const Complex< T2 > &c2) noexcept
T Abs(const Complex< T > &c) noexcept
constexpr bool operator<=(const T1 &a, const T2 &b)
constexpr bool operator>(const T1 &a, const T2 &b)
constexpr bool operator>=(const T1 &a, const T2 &b)
uint64 Hash64(const void *data, size_type size, uint64 seed=0) noexcept
uint32 Hash32(const void *data, size_type size, uint32 seed=0) noexcept
void Swap(GenericPoint< T > &p1, GenericPoint< T > &p2) noexcept
unsigned long long uint64
double SexagesimalToDouble(const IsoString &separator=':') const
bool TryParseSexagesimal(int &sign, int &s1, int &s2, double &s3, const String &separator=':') const noexcept
bool TrySexagesimalToDouble(double &value, const Array< char_type > &separators) const noexcept
static IsoString ToSexagesimal(double d, const SexagesimalConversionOptions &options=SexagesimalConversionOptions())
void ParseSexagesimal(int &sign, int &s1, int &s2, double &s3, const Array< char_type > &separators) const
double SexagesimalToDouble(const Array< char_type > &separators) const
bool TryParseSexagesimal(int &sign, int &s1, int &s2, double &s3, const IsoString &separator=':') const noexcept
double SexagesimalToDouble(const String &separator=':') const
void ParseSexagesimal(int &sign, int &s1, int &s2, double &s3, const Array< char_type > &separators) const
bool TrySexagesimalToDouble(double &value, const Array< char_type > &separators) const noexcept
bool TryParseSexagesimal(int &sign, int &s1, int &s2, double &s3, const Array< char_type > &separators) const noexcept
static IsoString ToSexagesimal(int sign, double s1, double s2, double s3, const SexagesimalConversionOptions &options=SexagesimalConversionOptions())
double SexagesimalToDouble(const Array< char_type > &separators) const
bool TrySexagesimalToDouble(double &value, const String &separator=':') const noexcept
void ParseSexagesimal(int &sign, int &s1, int &s2, double &s3, const String &separator=':') const
bool TrySexagesimalToDouble(double &value, const IsoString &separator=':') const noexcept
void ParseSexagesimal(int &sign, int &s1, int &s2, double &s3, const IsoString &separator=':') const
constexpr const T & Min(const T &a, const T &b) noexcept
int Compare(FI1 i1, FI1 j1, FI2 i2, FI2 j2) noexcept
constexpr const T & Max(const T &a, const T &b) noexcept
A set of options specific for string representations of angles.
constexpr AngleConversionOptions(unsigned precision=2, unsigned width=3, char padding=' ')
A set of options specific for string representations of declination angles.
constexpr DecConversionOptions(unsigned precision=2, unsigned width=3, char padding=' ')
Formatting options for string representations of dates and times in ISO 8601 format....
constexpr ISO8601ConversionOptionsNoTimeZone(unsigned timeItems_=3, unsigned precision_=3)
Formatting options for string representations of dates and times in ISO 8601 format.
ISO8601ConversionOptions(const ISO8601ConversionOptions &)=default
constexpr ISO8601ConversionOptions(unsigned timeItems_=3, unsigned precision_=3, bool timeZone_=true, bool zuluTime_=true)
A set of options specific for string representations of latitude angles.
constexpr LatitudeConversionOptions(unsigned precision=2, unsigned width=3, char padding=' ')
A set of options specific for string representations of longitude angles.
constexpr LongitudeConversionOptions(unsigned precision=2, unsigned width=4, char padding=' ')
A set of options specific for string representations of right ascensions.
constexpr RAConversionOptions(unsigned precision=3, unsigned width=2, char padding=' ')
Formatting options for string sexagesimal representations.
constexpr SexagesimalConversionOptions(unsigned items_=3, unsigned precision_=2, bool sign_=false, unsigned width_=0, char separator_=':', char padding_=' ')
SexagesimalConversionOptions(const SexagesimalConversionOptions &)=default