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 );
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 );
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 );
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 );
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 );
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 );
3683 return R::CompareCodePoints( m_data->string, Length(), t, R::Length( t ), caseSensitive );
3715 return R::CompareCodePoints( m_data->string, Length(), &c, 1, caseSensitive );
3744 template <
class R1,
class A1>
3746 bool caseSensitive =
true,
bool localeAware =
true ) const noexcept
3748 return R::Compare( m_data->string, Length(), s.m_data->string, s.
Length(), caseSensitive, localeAware );
3780 return R::Compare( m_data->string, Length(), t, R::Length( t ), caseSensitive, localeAware );
3814 return R::Compare( m_data->string, Length(), &c, 1, caseSensitive, localeAware );
3837 template <
class R1,
class A1>
3840 return R::Compare( m_data->string, Length(), s.m_data->string, s.
Length(),
false, localeAware );
3866 return R::Compare( m_data->string, Length(), t, R::Length( t ),
false, localeAware );
3895 return R::Compare( m_data->string, Length(), &c, 1,
false, localeAware );
3913 template <
class R1,
class A1>
3916 return R::WildMatch( m_data->string, Length(), pattern.m_data->string, pattern.
Length(), caseSensitive );
3932 template <
class R1,
class A1>
3935 return R::WildMatch( m_data->string, Length(), pattern.m_data->string, pattern.Length(),
false );
3955 return R::WildMatch( m_data->string, Length(), pattern, R::Length( pattern ), caseSensitive );
3974 return R::WildMatch( m_data->string, Length(), pattern, R::Length( pattern ),
false );
3983 for (
iterator i = m_data->string; i < m_data->end; ++i )
3984 if ( R::IsWildcard( *i ) )
3999 R::ToCaseFolded( m_data->string, len );
4013 R::ToLowercase( m_data->string, len );
4027 R::ToUppercase( m_data->string, len );
4074 for (
iterator i = m_data->string, j = m_data->end; i < --j; ++i )
4097 pcl::Sort( m_data->string, m_data->end );
4123 pcl::Sort( m_data->string, m_data->end, p );
4157 char_type c = *R::SearchTrimLeft( m_data->string, m_data->end );
4158 return R::IsDigit( c ) || R::IsSign( c ) || R::IsDecimalSeparator( c );
4179 char_type c = *R::SearchTrimLeft( m_data->string, m_data->end );
4180 return R::IsSymbolDigit( c );
4206 if ( R::IsStartingSymbolDigit( *i ) )
4209 if ( ++i == m_data->end )
4211 if ( !R::IsSymbolDigit( *i ) )
4214 pos = i - m_data->string;
4232 if ( R::IsStartingSymbolDigit( *m_data->string ) )
4235 if ( !R::IsSymbolDigit( *i ) )
4252 return pcl::Hash64( m_data->string, Size(), seed );
4265 return pcl::Hash32( m_data->string, Size(), seed );
4286 return Data::DeleteFreeList();
4297 void DetachFromData()
4299 if ( !m_data->Detach() )
4300 Data::Dispose( m_data );
4318 if ( m_data->ShouldReallocate( len ) )
4320 m_data->Deallocate();
4321 m_data->Allocate( len );
4324 m_data->SetLength( len );
4328 Data* newData = Data::New( len );
4352 if (
size_type( m_data->capacity - m_data->string ) < newLen+1 )
4354 iterator old = m_data->string;
4355 m_data->Allocate( newLen );
4356 if ( old !=
nullptr )
4359 R::Copy( m_data->string, old, i );
4361 R::Copy( m_data->string+i+n, old+i, len-i );
4362 m_data->alloc.Deallocate( old );
4368 R::CopyOverlapped( m_data->string+i+n, m_data->string+i, len-i );
4369 m_data->SetLength( newLen );
4374 Data* newData = Data::New( newLen );
4376 R::Copy( newData->string, m_data->string, i );
4378 R::Copy( newData->string+i+n, m_data->string+i, len-i );
4389 void Trim( const_iterator left,
size_type len )
4395 if ( m_data->ShouldReallocate( len ) )
4397 iterator old = m_data->string;
4398 m_data->Allocate( len );
4399 R::Copy( m_data->string, left, len );
4400 if ( old !=
nullptr )
4401 m_data->alloc.Deallocate( old );
4405 if ( left != m_data->string )
4406 R::CopyOverlapped( m_data->string, left, len );
4407 m_data->SetLength( len );
4412 Data* newData = Data::New( len );
4413 R::Copy( newData->string, left, len );
4426 void ReplaceChar( char_type c1, char_type c2,
size_type i,
size_type n,
bool caseSensitive )
4434 if ( caseSensitive )
4436 for ( iterator p = m_data->string + i, p1 = p + n; p < p1; ++p )
4441 p = m_data->string + d;
4443 for ( iterator p1 = m_data->string + i + n; ++p < p1; )
4451 c1 = R::ToCaseFolded( c1 );
4452 for ( iterator p = m_data->string + i, p1 = p + n; p < p1; ++p )
4453 if ( R::ToCaseFolded( *p ) == c1 )
4457 p = m_data->string + d;
4459 for ( iterator p1 = m_data->string + i + n; ++p < p1; )
4460 if ( R::ToCaseFolded( *p ) == c1 )
4480 SearchEngine S( t1, n1, caseSensitive );
4484 for (
size_type p = i; (p = S( m_data->string, p, len )) < len; p += n1 )
4485 R::Copy( m_data->string + p, t2, n2 );
4490 for (
size_type p = i; (p = S( m_data->string, p, len )) < len; p += n1 )
4496 newLen += P.Length()*(n2 - n1);
4498 newLen -= P.Length()*(n1 - n2);
4502 Data* newData = Data::New( newLen );
4509 R::Copy( newData->string+targetIndex, m_data->string+sourceIndex, n );
4510 R::Copy( newData->string+targetIndex+n, t2, n2 );
4511 targetIndex += n + n2;
4512 sourceIndex = p + n1;
4514 if ( sourceIndex < len )
4515 R::Copy( newData->string+targetIndex, m_data->string+sourceIndex, len-sourceIndex );
4544 class PCL_CLASS SearchEngine
4558 SearchEngine( const_iterator pattern,
size_type patternLength,
4559 bool caseSensitive =
true,
bool searchLast =
false,
bool useBoyerMoore =
true )
4560 : m_pattern( pattern )
4561 , m_patternLength( int( patternLength ) )
4562 , m_caseSensitive( caseSensitive )
4563 , m_searchLast( searchLast )
4564 , m_useBoyerMoore( useBoyerMoore && m_patternLength > 3 )
4566 if ( m_useBoyerMoore )
4584 if ( endIndex <= startIndex
4585 || m_patternLength <= 0
4586 || endIndex-startIndex <
size_type( m_patternLength )
4588 || m_pattern ==
nullptr )
4591 if ( m_caseSensitive )
4593 if ( m_useBoyerMoore )
4597 for (
size_type i = startIndex, r = endIndex-m_patternLength; i <= r; )
4600 const_iterator t = text + r - i;
4601 const_iterator p = m_pattern;
4602 for (
int j = m_patternLength; --j >= 0; )
4607 skip = j - m_skipList[
uint8( c )];
4620 for (
size_type i = startIndex, r = endIndex-m_patternLength; i <= r; )
4623 const_iterator t = text + i + m_patternLength;
4624 const_iterator p = m_pattern + m_patternLength;
4625 for (
int j = m_patternLength; --j >= 0; )
4631 skip = j - m_skipList[
uint8( c )];
4648 for (
size_type i = endIndex-m_patternLength; ; --i )
4650 const_iterator t = text + i;
4651 const_iterator p = m_pattern;
4652 for (
int j = m_patternLength; ; ++t, ++p )
4659 if ( i == startIndex )
4665 for (
size_type i = startIndex, r = endIndex-m_patternLength; ; ++i )
4667 const_iterator t = text + i;
4668 const_iterator p = m_pattern;
4669 for (
int j = m_patternLength; ; ++t, ++p )
4684 if ( m_useBoyerMoore )
4688 for (
size_type i = startIndex, r = endIndex-m_patternLength; i <= r; )
4691 const_iterator t = text + r - i;
4692 const_iterator p = m_pattern;
4693 for (
int j = m_patternLength; --j >= 0; )
4695 char_type c = R::ToCaseFolded( *t++ );
4696 if ( c != R::ToCaseFolded( *p++ ) )
4698 skip = j - m_skipList[
uint8( c )];
4711 for (
size_type i = startIndex, r = endIndex-m_patternLength; i <= r; )
4714 const_iterator t = text + i + m_patternLength;
4715 const_iterator p = m_pattern + m_patternLength;
4716 for (
int j = m_patternLength; --j >= 0; )
4718 char_type c = R::ToCaseFolded( *--t );
4719 if ( c != R::ToCaseFolded( *--p ) )
4722 skip = j - m_skipList[
uint8( c )];
4739 for (
size_type i = endIndex-m_patternLength; ; --i )
4741 const_iterator t = text + i;
4742 const_iterator p = m_pattern;
4743 for (
int j = m_patternLength; ; ++t, ++p )
4745 if ( R::ToCaseFolded( *t ) != R::ToCaseFolded( *p ) )
4750 if ( i == startIndex )
4756 for (
size_type i = startIndex, r = endIndex-m_patternLength; ; ++i )
4758 const_iterator t = text + i;
4759 const_iterator p = m_pattern;
4760 for (
int j = m_patternLength; ; ++t, ++p )
4762 if ( R::ToCaseFolded( *t ) != R::ToCaseFolded( *p ) )
4778 int m_skipList[ 256 ];
4779 const_iterator m_pattern;
4780 int m_patternLength;
4781 bool m_caseSensitive : 1;
4782 bool m_searchLast : 1;
4783 bool m_useBoyerMoore : 1;
4785 void InitSkipList() noexcept
4787 ::memset( m_skipList, 0xff,
sizeof( m_skipList ) );
4790 const_iterator p = m_pattern + m_patternLength;
4791 if ( m_caseSensitive )
4792 for (
int i = 0; i < m_patternLength; ++i )
4793 m_skipList[
uint8( *--p )] = i;
4795 for (
int i = 0; i < m_patternLength; ++i )
4796 m_skipList[
uint8( R::ToCaseFolded( *--p ) )] = i;
4800 const_iterator p = m_pattern;
4801 if ( m_caseSensitive )
4802 for (
int i = 0; i < m_patternLength; ++i )
4803 m_skipList[
uint8( *p++ )] = i;
4805 for (
int i = 0; i < m_patternLength; ++i )
4806 m_skipList[
uint8( R::ToCaseFolded( *p++ ) )] = i;
4818 class PCL_CLASS Data :
public ReferenceCounter
4822 #ifndef __PCL_NO_STRING_FREE_LIST
4823 static Data* freeList;
4824 static AtomicInt freeLock;
4829 iterator
string =
nullptr;
4830 iterator end =
nullptr;
4831 iterator capacity =
nullptr;
4853 Allocate( len, total );
4876 total = (len <= total) ? alloc.PagedLength( total+1 ) : len+1;
4877 string = alloc.Allocate( total );
4878 capacity =
string + total;
4888 Allocate( len, len );
4901 PCL_PRECONDITION( len <= total )
4902 string = alloc.Allocate( total+1 );
4903 capacity =
string + total+1;
4904 SetLength(
pcl::Min( len, total ) );
4912 PCL_CHECK( (
string ==
nullptr) ? end ==
nullptr :
string < end )
4913 if (
string !=
nullptr )
4915 alloc.Deallocate(
string );
4924 bool ShouldReallocate(
size_type len )
const noexcept
4927 return m <= len || alloc.ReallocatedLength( m, len+1 ) < (m >> 1);
4934 void SetLength(
size_type len ) noexcept
4936 *(end = (
string + len)) = R::Null();
4942 void Reset() noexcept
4944 string = end = capacity =
nullptr;
4953 #ifndef __PCL_NO_STRING_FREE_LIST
4954 static Data* NextFree() noexcept
4956 if ( freeLock.TestAndSet( 0, 1 ) )
4958 Data* data = freeList;
4959 if ( data !=
nullptr )
4960 freeList =
reinterpret_cast<Data*
>( data->string );
4961 freeLock.Store( 0 );
4977 #ifndef __PCL_NO_STRING_FREE_LIST
4978 Data* data = NextFree();
4979 if ( data !=
nullptr )
4981 data->string =
nullptr;
4997 #ifndef __PCL_NO_STRING_FREE_LIST
4998 Data* data = NextFree();
4999 if ( data !=
nullptr )
5001 data->Allocate( len );
5005 return new Data( len );
5017 #ifndef __PCL_NO_STRING_FREE_LIST
5018 Data* data = NextFree();
5019 if ( data !=
nullptr )
5021 data->Allocate( len, total );
5025 return new Data( len, total );
5035 static void Dispose( Data* data )
5037 PCL_PRECONDITION( data !=
nullptr )
5038 PCL_CHECK( data->RefCount() == 0 )
5039 #ifndef __PCL_NO_STRING_FREE_LIST
5040 if ( freeLock.TestAndSet( 0, 1 ) )
5044 data->string =
reinterpret_cast<iterator
>( freeList );
5046 freeLock.Store( 0 );
5063 #ifndef __PCL_NO_STRING_FREE_LIST
5064 while ( freeList !=
nullptr )
5066 Data* data = freeList;
5067 freeList =
reinterpret_cast<Data*
>( data->string );
5068 data->string =
nullptr;
5080 Data* m_data =
nullptr;
5083 #ifndef __PCL_NO_STRING_FREE_LIST
5085 template <
class T,
class R,
class A>
5086 typename GenericString<T,R,A>::Data* GenericString<T,R,A>::Data::freeList =
nullptr;
5088 template <
class T,
class R,
class A>
5089 AtomicInt GenericString<T,R,A>::Data::freeLock;
5096 template <
class T,
class R,
class A>
inline
5114 template <
class T,
class R1,
class A1,
class R2,
class A2>
inline
5117 return s1.CompareCodePoints( s2 ) == 0;
5127 template <
class T,
class R1,
class A1,
class R2,
class A2>
inline
5130 return s1.CompareCodePoints( s2 ) < 0;
5140 template <
class T,
class R1,
class A1,
class R2,
class A2>
inline
5143 return s1.CompareCodePoints( s2 ) <= 0;
5153 template <
class T,
class R1,
class A1,
class R2,
class A2>
inline
5156 return s1.CompareCodePoints( s2 ) > 0;
5166 template <
class T,
class R1,
class A1,
class R2,
class A2>
inline
5169 return s1.CompareCodePoints( s2 ) >= 0;
5178 template <
class T,
class R,
class A>
inline
5181 return s1.CompareCodePoints( t2 ) == 0;
5191 template <
class T,
class R,
class A>
inline
5194 return s1.CompareCodePoints( t2 ) < 0;
5204 template <
class T,
class R,
class A>
inline
5207 return s1.CompareCodePoints( t2 ) <= 0;
5217 template <
class T,
class R,
class A>
inline
5220 return s1.CompareCodePoints( t2 ) > 0;
5230 template <
class T,
class R,
class A>
inline
5233 return s1.CompareCodePoints( t2 ) >= 0;
5242 template <
class T,
class R,
class A>
inline
5245 return s2.CompareCodePoints( t1 ) == 0;
5255 template <
class T,
class R,
class A>
inline
5258 return s2.CompareCodePoints( t1 ) > 0;
5268 template <
class T,
class R,
class A>
inline
5271 return s2.CompareCodePoints( t1 ) >= 0;
5281 template <
class T,
class R,
class A>
inline
5284 return s2.CompareCodePoints( t1 ) < 0;
5294 template <
class T,
class R,
class A>
inline
5297 return s2.CompareCodePoints( t1 ) <= 0;
5306 template <
class T,
class R,
class A>
inline
5309 return s1.CompareCodePoints( c2 ) == 0;
5319 template <
class T,
class R,
class A>
inline
5322 return s1.CompareCodePoints( c2 ) < 0;
5332 template <
class T,
class R,
class A>
inline
5335 return s1.CompareCodePoints( c2 ) <= 0;
5345 template <
class T,
class R,
class A>
inline
5348 return s1.CompareCodePoints( c2 ) > 0;
5358 template <
class T,
class R,
class A>
inline
5361 return s1.CompareCodePoints( c2 ) >= 0;
5370 template <
class T,
class R,
class A>
inline
5373 return s2.CompareCodePoints( c1 ) == 0;
5383 template <
class T,
class R,
class A>
inline
5386 return s2.CompareCodePoints( c1 ) > 0;
5396 template <
class T,
class R,
class A>
inline
5399 return s2.CompareCodePoints( c1 ) >= 0;
5409 template <
class T,
class R,
class A>
inline
5412 return s2.CompareCodePoints( c1 ) < 0;
5422 template <
class T,
class R,
class A>
inline
5425 return s2.CompareCodePoints( c1 ) <= 0;
5598 (void)
operator =( s );
5660 (void)
operator =( t );
5704 (void)Format(
"%hd", x );
5714 (void)Format(
"%hu", x );
5724 (void)Format(
"%i", x );
5734 (void)Format(
"%u", x );
5744 (void)Format(
"%ld", x );
5754 (void)Format(
"%lu", x );
5764 (void)Format(
"%lli", x );
5774 (void)Format(
"%llu", x );
5784 (void)Format(
"%.7g", x );
5794 (void)Format(
"%.16g", x );
5805 (void)Format(
"%.16Lg", x );
5807 (void)Format(
"%.18Lg", x );
5811 #ifndef __PCL_NO_STRING_COMPLEX
5820 (void)Format(
"{%.7g,%.7g}", x.
Real(), x.
Imag() );
5830 (void)Format(
"{%.16g,%.16g}", x.
Real(), x.
Imag() );
5841 (void)Format(
"{%.16Lg,%.16Lg}", x.
Real(), x.
Imag() );
5843 (void)Format(
"{%.18Lg,%.18Lg}", x.
Real(), x.
Imag() );
5849 #ifdef __PCL_QT_INTERFACE
5853 : string_base( qs.isEmpty() ? iterator( nullptr ) : iterator( PCL_GET_CHARPTR_FROM_QSTRING( qs ) ) )
5858 IsoString(
const QAnyStringView& qv )
5859 : string_base( qv.isEmpty() ? iterator( nullptr ) : iterator( PCL_GET_CHARPTR_FROM_QSTRINGVIEW( qv ) ) )
5864 IsoString(
const QByteArray& qb )
5865 : string_base( qb.isEmpty() ? iterator( nullptr ) : iterator( PCL_GET_CHARPTR_FROM_QBYTEARRAY( qb ) ) )
5870 IsoString(
const QDate& qd )
5871 : string_base( iterator( PCL_GET_CHARPTR_FROM_QSTRING( qd.toString( PCL_QDATE_FMT_STR ) ) ) )
5876 IsoString(
const QDateTime& qdt )
5877 : string_base( iterator( PCL_GET_CHARPTR_FROM_QSTRING( qdt.toString( PCL_QDATETIME_FMT_STR ) ) ) )
5935 return operator =( s.
Begin() );
5968 IsoString& operator =( const_c_ustring t );
5970 #ifdef __PCL_QT_INTERFACE
5972 IsoString& operator =(
const QString& qs )
5977 Assign( PCL_GET_CHARPTR_FROM_QSTRING( qs ) );
5981 IsoString& operator =(
const QByteArray& qb )
5986 Assign( PCL_GET_CHARPTR_FROM_QBYTEARRAY( qb ) );
5990 IsoString& operator =(
const QDate& qd )
5992 Assign( PCL_GET_CHARPTR_FROM_QSTRING( qd.toString( PCL_QDATE_FMT_STR ) ) );
5996 IsoString& operator =(
const QDateTime& qdt )
5998 Assign( PCL_GET_CHARPTR_FROM_QSTRING( qdt.toString( PCL_QDATETIME_FMT_STR ) ) );
6006 IsoString SetToLength(
size_type n )
const
6008 return string_base::SetToLength( n );
6011 IsoString ResizedToNullTerminated()
const
6013 return string_base::ResizedToNullTerminated();
6016 IsoString Squeezed()
const
6018 return string_base::Squeezed();
6025 return string_base::Substring( i, n );
6030 return string_base::Left( n );
6035 return string_base::Right( n );
6040 return string_base::Suffix( i );
6045 return string_base::Prefix( i );
6050 IsoString Trimmed()
const
6052 return string_base::Trimmed();
6055 IsoString TrimmedLeft()
const
6057 return string_base::TrimmedLeft();
6060 IsoString TrimmedRight()
const
6062 return string_base::TrimmedRight();
6069 return string_base::LeftJustified( width, fill );
6074 return string_base::RightJustified( width, fill );
6079 return string_base::CenterJustified( width, fill );
6084 IsoString Enclosed( char_type c )
const
6086 return string_base::Enclosed( c );
6089 IsoString SingleQuoted()
const
6091 return string_base::SingleQuoted();
6094 IsoString DoubleQuoted()
const
6096 return string_base::DoubleQuoted();
6099 IsoString Unquoted()
const
6101 return string_base::Unquoted();
6106 IsoString CaseFolded()
const
6108 return string_base::CaseFolded();
6111 IsoString Lowercase()
const
6113 return string_base::Lowercase();
6116 IsoString Uppercase()
const
6118 return string_base::Uppercase();
6123 IsoString Reversed()
const
6125 return string_base::Reversed();
6128 IsoString Sorted()
const
6130 return string_base::Sorted();
6134 IsoString Sorted( BP p )
const
6136 return string_base::Sorted( p );
6154 return c.ToSeparated( *
this, separator );
6173 template <
class C,
class AF>
6177 return c.ToSeparated( *
this, separator, append );
6193 return c.ToSeparated( *
this, separator );
6212 template <
class C,
class AF>
6216 return c.ToSeparated( *
this, separator, append );
6231 return ToSeparated( c,
IsoString( separator ) );
6250 template <
class C,
class AF>
6253 return ToSeparated( c,
IsoString( separator ), append );
6447 return ToURLEncoded( c.Begin(), c.Length()*
sizeof( *c.Begin() ) );
6495 return FromURLEncoded( c.Begin(), c.Length()*
sizeof( *c.Begin() ) );
6511 return FromURLEncoded( Begin(), Length() );
6536 return ToURLDecoded( c.Begin(), c.Length()*
sizeof( *c.Begin() ) );
6563 #ifdef __PCL_QT_INTERFACE
6565 operator QString()
const
6567 return QString( c_str() );
6570 operator QAnyStringView()
const
6572 return QAnyStringView( c_str() );
6575 operator QByteArray()
const
6577 return QByteArray( c_str() );
6580 operator QDate()
const
6582 return QDate::fromString( c_str(), PCL_QDATE_FMT_STR );
6585 operator QDateTime()
const
6587 return QDateTime::fromString( c_str(), PCL_QDATETIME_FMT_STR );
6606 va_start( paramList, fmt );
6608 (void)VFormat( fmt, paramList );
6610 va_end( paramList );
6628 va_start( paramList, fmt );
6630 (void)AppendVFormat( fmt, paramList );
6632 va_end( paramList );
6680 for (
const_iterator i = m_data->string; i < m_data->end; ++p, ++i )
6711 #ifdef __PCL_QT_INTERFACE
6713 QString ToQString()
const
6715 return operator QString();
6718 QByteArray ToQByteArray()
const
6720 return operator QByteArray();
6723 QDate ToQDate()
const
6725 return operator QDate();
6728 QDateTime ToQDateTime()
const
6730 return operator QDateTime();
6882 return TryToInt( value, 0 );
6979 return TryToUInt( value, 0 );
7035 return ToInt64( 0 );
7064 return TryToInt64( value, 0 );
7118 return ToUInt64( 0 );
7147 return TryToUInt64( value, 0 );
7183 bool TryToUInt64(
unsigned long long& value,
int base )
const noexcept;
7251 #ifndef __PCL_NO_STRING_VECTOR
7302 int sign, s1, s2;
double s3;
7303 ParseSexagesimal( sign, s1, s2, s3, separator );
7304 return sign*(s1 + (s2 + s3/60)/60);
7307 double SexagesimalToDouble(
char separator )
const
7309 return SexagesimalToDouble(
IsoString( separator ) );
7312 double SexagesimalToDouble(
const ustring_base& separator )
const
7314 return SexagesimalToDouble( IsoString( separator ) );
7332 int sign, s1, s2;
double s3;
7333 ParseSexagesimal( sign, s1, s2, s3, separators );
7334 return sign*(s1 + (s2 + s3/60)/60);
7356 int sign, s1, s2;
double s3;
7357 if ( TryParseSexagesimal( sign, s1, s2, s3, separator ) )
7359 value = sign*(s1 + (s2 + s3/60)/60);
7365 bool TrySexagesimalToDouble(
double& value,
char separator )
const noexcept
7367 return TrySexagesimalToDouble( value,
IsoString( separator ) );
7370 bool TrySexagesimalToDouble(
double& value,
const ustring_base& separator )
const noexcept
7372 return TrySexagesimalToDouble( value, IsoString( separator ) );
7389 int sign, s1, s2;
double s3;
7390 if ( TryParseSexagesimal( sign, s1, s2, s3, separators ) )
7392 value = sign*(s1 + (s2 + s3/60)/60);
7426 void ParseSexagesimal(
int& sign,
int& s1,
int& s2,
double& s3,
char separator )
const
7428 ParseSexagesimal( sign, s1, s2, s3,
IsoString( separator ) );
7431 void ParseSexagesimal(
int& sign,
int& s1,
int& s2,
double& s3,
const ustring_base& separator )
const
7433 ParseSexagesimal( sign, s1, s2, s3,
IsoString( separator ) );
7468 bool TryParseSexagesimal(
int& sign,
int& s1,
int& s2,
double& s3,
char separator ) const noexcept
7470 return TryParseSexagesimal( sign, s1, s2, s3,
IsoString( separator ) );
7473 bool TryParseSexagesimal(
int& sign,
int& s1,
int& s2,
double& s3,
const ustring_base& separator )
const noexcept
7475 return TryParseSexagesimal( sign, s1, s2, s3,
IsoString( separator ) );
7532 return ToSexagesimal( (d < 0) ? -1 : +1,
Abs( d ), 0, 0, options );
7649 return ToHex( c.Begin(), c.Length()*
sizeof( *c.Begin() ) );
7681 return ToBase64( c.Begin(), c.Length()*
sizeof( *c.Begin() ) );
7700 IsoString b64 = ToBase64( data, length );
7705 else if ( c ==
'/' )
7724 return ToBase64URL( c.Begin(), c.Length()*
sizeof( *c.Begin() ) );
7782 else if ( c ==
'_' )
7845 return std::move( s1 );
7867 return std::move( s2 );
7889 return std::move( s1 );
7911 return std::move( s1 );
7947 return std::move( s1 );
7981 return std::move( s2 );
8017 return std::move( s1 );
8051 return std::move( s2 );
8124 #ifndef __PCL_NO_STRING_OSTREAM
8126 inline std::ostream&
operator <<( std::ostream& o,
const IsoString& s )
8128 return o << s.c_str();
8202 using c16_string = char16_t*;
8207 using const_c16_string =
const char16_t*;
8355 :
String( l.begin(), l.end() )
8449 String( std::initializer_list<char8_type> l )
8450 :
String( l.begin(), l.end() )
8469 Assign( x ?
"true" :
"false" );
8479 (void)Format( L
"%hd", x );
8489 (void)Format( L
"%hu", x );
8499 (void)Format( L
"%i", x );
8509 (void)Format( L
"%u", x );
8519 (void)Format( L
"%ld", x );
8529 (void)Format( L
"%lu", x );
8539 (void)Format( L
"%lli", x );
8549 (void)Format( L
"%llu", x );
8559 (void)Format( L
"%.7g", x );
8569 (void)Format( L
"%.16g", x );
8580 (void)Format( L
"%.16Lg", x );
8582 (void)Format( L
"%.18Lg", x );
8586 #ifndef __PCL_NO_STRING_COMPLEX
8594 (void)Format( L
"{%.7g,%.7g}", x.
Real(), x.
Imag() );
8603 (void)Format( L
"{%.16g,%.16g}", x.
Real(), x.
Imag() );
8613 (void)Format( L
"{%.16Lg,%.16Lg}", x.
Real(), x.
Imag() );
8615 (void)Format( L
"{%.18Lg,%.18Lg}", x.
Real(), x.
Imag() );
8621 #ifdef __PCL_QT_INTERFACE
8624 String(
const QString& qs )
8625 : string_base( qs.isEmpty() ? iterator( nullptr ) : iterator( PCL_GET_CHAR16PTR_FROM_QSTRING( qs ) ) )
8630 String(
const QDate& qd )
8631 : string_base( iterator( PCL_GET_CHAR16PTR_FROM_QSTRING( qd.toString( PCL_QDATE_FMT_STR ) ) ) )
8636 String(
const QDateTime& qdt )
8637 : string_base( iterator( PCL_GET_CHAR16PTR_FROM_QSTRING( qdt.toString( PCL_QDATETIME_FMT_STR ) ) ) )
8650 string_base::Assign( s );
8659 string_base::Transfer( s );
8669 string_base::Assign( s );
8679 string_base::Transfer( s );
8699 string_base::Assign( t );
8709 string_base::Assign( c );
8773 #ifdef __PCL_QT_INTERFACE
8775 String& operator =(
const QString& qs )
8780 string_base::Assign( PCL_GET_CHAR16PTR_FROM_QSTRING( qs ) );
8784 String& operator =(
const QDate& qd )
8786 string_base::Assign( PCL_GET_CHAR16PTR_FROM_QSTRING( qd.toString( PCL_QDATE_FMT_STR ) ) );
8790 String& operator =(
const QDateTime& qdt )
8792 string_base::Assign( PCL_GET_CHAR16PTR_FROM_QSTRING( qdt.toString( PCL_QDATETIME_FMT_STR ) ) );
8805 string_base::Assign( s );
8814 string_base::Assign( s, i, n );
8822 string_base::Assign( t );
8831 string_base::Assign( i, j );
8840 void Assign( std::initializer_list<char_type> l )
8842 Assign( l.begin(), l.end() );
8852 string_base::Assign( t, i, n );
8860 string_base::Assign( c, n );
8878 string_base::Assign(
reinterpret_cast<const_iterator>( t ), i, n );
8886 string_base::Assign(
char_type( c ), n );
8906 string_base::Assign(
char_type( c ), n );
8917 MaybeReallocate( n );
8920 for (
iterator i = m_data->string; i < m_data->end; ++i, ++t )
8933 size_type n = char8_traits::Length( t );
8936 MaybeReallocate( n );
8938 for (
iterator i = m_data->string; i < m_data->end; ++i, ++t )
8952 size_type len = char8_traits::Length( t );
8956 MaybeReallocate( n );
8959 for (
iterator i = m_data->string; i < m_data->end; ++i, ++t )
8974 MaybeReallocate( q - p );
8976 for (
iterator i = m_data->string; i < m_data->end; ++i, ++p )
8990 void Assign( std::initializer_list<char8_type> l )
8992 Assign( l.begin(), l.end() );
9000 string_base::Assign(
char_type( c ), n );
9007 string_base::Insert( i, s );
9010 void Insert(
size_type i, const_iterator p, const_iterator q )
9012 string_base::Insert( i, p, q );
9015 void Insert(
size_type i, const_iterator t )
9017 string_base::Insert( i, t );
9022 string_base::Insert( i, t, n );
9027 string_base::Insert( i, c, n );
9030 void Insert(
size_type i,
const char16_t* t )
9032 string_base::Insert( i,
reinterpret_cast<const_iterator
>( t ) );
9037 string_base::Insert( i, String( c, n ) );
9040 void Insert(
size_type i,
const wchar_t* t )
9042 #ifdef __PCL_WINDOWS
9043 string_base::Insert( i,
reinterpret_cast<const_iterator
>( t ) );
9045 string_base::Insert( i, String( t ) );
9051 string_base::Insert( i, String( c, n ) );
9059 UninitializedGrow( i, n );
9060 const_char8_iterator t = s.Begin();
9062 for ( iterator p = m_data->string+i, q = p+n; p < q; ++p, ++t )
9063 *p = char_type(
uint8( *t ) );
9067 void Insert(
size_type i,
const string8_base& s )
9072 UninitializedGrow( i, n );
9073 const_char8_iterator t = s.Begin();
9075 for ( iterator p = m_data->string+i, q = p+n; p < q; ++p, ++t )
9076 *p = char_type(
uint8( *t ) );
9080 void Insert(
size_type i, const_c_string8 t )
9082 size_type n = char8_traits::Length( t );
9085 UninitializedGrow( i, n );
9087 for ( iterator p = m_data->string+i, q = p+n; p < q; ++p, ++t )
9088 *p = char_type(
uint8( *t ) );
9094 n =
pcl::Min( n, char8_traits::Length( t ) );
9097 UninitializedGrow( i, n );
9099 for ( iterator p = m_data->string+i, q = p+n; p < q; ++p, ++t )
9100 *p = char_type(
uint8( *t ) );
9104 void Insert(
size_type i, const_char8_iterator p, const_char8_iterator q )
9109 UninitializedGrow( i, n );
9111 for ( iterator r = m_data->string+i, s = r+n; r < s; ++r, ++p )
9112 *r = char_type(
uint8( *p ) );
9118 string_base::Insert( i, char_type( c ), n );
9123 void Append(
const String& s )
9125 string_base::Append( s );
9128 String& operator +=(
const String& s )
9134 void Append( const_iterator i, const_iterator j )
9136 string_base::Append( i, j );
9139 void Append( const_iterator t )
9141 string_base::Append( t );
9144 String& operator +=( const_iterator t )
9150 void Append( const_iterator t,
size_type n )
9152 string_base::Append( t, n );
9155 void Append( char_type c,
size_type n = 1 )
9157 string_base::Append( c, n );
9160 String& operator +=( char_type c )
9166 void Append(
const char16_t* t )
9168 string_base::Append(
reinterpret_cast<const_iterator
>( t ) );
9171 String& operator +=(
const char16_t* t )
9177 void Append( char16_t c,
size_type n = 1 )
9179 string_base::Append( char_type( c ), n );
9182 String& operator +=( char16_t c )
9188 void Append(
const wchar_t* t )
9190 #ifdef __PCL_WINDOWS
9191 string_base::Append(
reinterpret_cast<const_iterator
>( t ) );
9193 string_base::Append( String( t ) );
9197 String& operator +=(
const wchar_t* t )
9203 void Append(
wchar_t c,
size_type n = 1 )
9205 string_base::Append( char_type( c ), n );
9208 String& operator +=(
wchar_t c )
9214 void Append(
const string8_base& s )
9216 Insert( maxPos, s );
9219 String& operator +=(
const string8_base& s )
9225 void Append(
const string8_base& s,
size_type n )
9227 Insert( maxPos, s, n );
9230 void Append( const_c_string8 t )
9232 Insert( maxPos, t );
9235 String& operator +=( const_c_string8 t )
9241 void Append( const_c_string8 t,
size_type n )
9243 Insert( maxPos, t, n );
9246 void Append( const_char8_iterator p, const_char8_iterator q )
9248 Insert( maxPos, p, q );
9251 void Append( char8_type c,
size_type n = 1 )
9253 string_base::Append( char_type( c ), n );
9256 String& operator +=( char8_type c )
9262 void Add(
const String& s )
9267 void Add( const_iterator i, const_iterator j )
9272 void Add( const_iterator t )
9277 void Add( const_iterator t,
size_type n )
9282 void Add( char_type c,
size_type n = 1 )
9287 void Add(
const char16_t* t )
9297 void Add(
const wchar_t* t )
9307 void Add(
const string8_base& s )
9312 void Add(
const string8_base& s,
size_type n )
9317 void Add( const_c_string8 t )
9322 void Add( const_c_string8 t,
size_type n )
9327 void Add( const_char8_iterator p, const_char8_iterator q )
9332 void Add( char8_type c,
size_type n = 1 )
9339 void Prepend(
const String& s )
9341 string_base::Prepend( s );
9344 String& operator -=(
const String& s )
9350 void Prepend( const_iterator i, const_iterator j )
9352 string_base::Prepend( i, j );
9355 void Prepend( const_iterator t )
9357 string_base::Prepend( t );
9360 String& operator -=( const_iterator t )
9366 void Prepend( const_iterator t,
size_type n )
9368 string_base::Prepend( t, n );
9371 void Prepend( char_type c,
size_type n = 1 )
9373 string_base::Prepend( c, n );
9376 String& operator -=( char_type c )
9382 void Prepend(
const char16_t* t )
9384 string_base::Prepend(
reinterpret_cast<const_iterator
>( t ) );
9387 String& operator -=(
const char16_t* t )
9393 void Prepend( char16_t c,
size_type n = 1 )
9395 string_base::Prepend( char_type( c ), n );
9398 String& operator -=( char16_t c )
9404 void Prepend(
const wchar_t* t )
9406 #ifdef __PCL_WINDOWS
9407 string_base::Prepend(
reinterpret_cast<const_iterator
>( t ) );
9409 string_base::Prepend( String( t ) );
9413 String& operator -=(
const wchar_t* t )
9419 void Prepend(
wchar_t c,
size_type n = 1 )
9421 string_base::Prepend( char_type( c ), n );
9424 String& operator -=(
wchar_t c )
9430 void Prepend(
const string8_base& s )
9435 String& operator -=(
const string8_base& s )
9441 void Prepend(
const string8_base& s,
size_type n )
9446 void Prepend( const_c_string8 t )
9451 String& operator -=( const_c_string8 t )
9457 void Prepend( const_c_string8 t,
size_type n )
9462 void Prepend( const_char8_iterator p, const_char8_iterator q )
9467 void Prepend( char8_type c,
size_type n = 1 )
9469 string_base::Prepend( String( c, n ) );
9472 String& operator -=( char8_type c )
9482 string_base::Replace( i, n, s );
9487 string_base::Replace( i, n, t );
9492 string_base::Replace( i, n, c, nc );
9497 string_base::Replace( i, n,
reinterpret_cast<const_iterator
>( t ) );
9502 string_base::Replace( i, n, char_type( c ), nc );
9507 #ifdef __PCL_WINDOWS
9508 string_base::Replace( i, n,
reinterpret_cast<const_iterator
>( t ) );
9510 string_base::Replace( i, n, String( t ) );
9516 string_base::Replace( i, n, char_type( c ), nc );
9531 size_type nt = char8_traits::Length( t );
9535 UninitializedGrow( i, nt-n );
9542 for ( iterator p = m_data->string+i, q = p+nt; p < q; ++p, ++t )
9543 *p = char_type( *t );
9554 string_base::Replace( i, n, char_type( c ), nc );
9559 void ReplaceChar( char_type c1, char_type c2,
size_type i = 0,
size_type n = maxPos )
9561 string_base::ReplaceChar( c1, c2, i, n );
9564 void ReplaceCharIC( char_type c1, char_type c2,
size_type i = 0,
size_type n = maxPos )
9566 string_base::ReplaceCharIC( c1, c2, i, n );
9571 string_base::ReplaceChar( char_type( c1 ), char_type( c2 ), i, n );
9574 void ReplaceCharIC( char16_t c1, char16_t c2,
size_type i = 0,
size_type n = maxPos )
9576 string_base::ReplaceCharIC( char_type( c1 ), char_type( c2 ), i, n );
9581 string_base::ReplaceChar( char_type( c1 ), char_type( c2 ), i, n );
9586 string_base::ReplaceCharIC( char_type( c1 ), char_type( c2 ), i, n );
9589 void ReplaceChar( char8_type c1, char8_type c2,
size_type i = 0,
size_type n = maxPos )
9591 string_base::ReplaceChar( char_type( c1 ), char_type( c2 ), i, n );
9594 void ReplaceCharIC( char8_type c1, char8_type c2,
size_type i = 0,
size_type n = maxPos )
9596 string_base::ReplaceCharIC( char_type( c1 ), char_type( c2 ), i, n );
9601 void ReplaceString(
const String& s1,
const String& s2,
size_type i = 0 )
9603 string_base::ReplaceString( s1, s2, i );
9606 void ReplaceStringIC(
const String& s1,
const String& s2,
size_type i = 0 )
9608 string_base::ReplaceStringIC( s1, s2, i );
9611 void ReplaceString( const_iterator t1, const_iterator t2,
size_type i = 0 )
9613 string_base::ReplaceString( t1, t2, i );
9616 void ReplaceStringIC( const_iterator t1, const_iterator t2,
size_type i = 0 )
9618 string_base::ReplaceStringIC( t1, t2, i );
9621 void ReplaceString(
const char16_t* t1,
const char16_t* t2,
size_type i = 0 )
9623 string_base::ReplaceString(
reinterpret_cast<const_iterator
>( t1 ),
9624 reinterpret_cast<const_iterator
>( t2 ), i );
9627 void ReplaceStringIC(
const char16_t* t1,
const char16_t* t2,
size_type i = 0 )
9629 string_base::ReplaceStringIC(
reinterpret_cast<const_iterator
>( t1 ),
9630 reinterpret_cast<const_iterator
>( t2 ), i );
9633 void ReplaceString(
const wchar_t* t1,
const wchar_t* t2,
size_type i = 0 )
9635 #ifdef __PCL_WINDOWS
9636 string_base::ReplaceString(
reinterpret_cast<const_iterator
>( t1 ),
9637 reinterpret_cast<const_iterator
>( t2 ), i );
9639 string_base::ReplaceString( String( t1 ), String( t2 ), i );
9643 void ReplaceStringIC(
const wchar_t* t1,
const wchar_t* t2,
size_type i = 0 )
9645 #ifdef __PCL_WINDOWS
9646 string_base::ReplaceStringIC(
reinterpret_cast<const_iterator
>( t1 ),
9647 reinterpret_cast<const_iterator
>( t2 ), i );
9649 string_base::ReplaceStringIC( String( t1 ), String( t2 ), i );
9653 void ReplaceString( const_c_string8 t1, const_c_string8 t2,
size_type i = 0 )
9655 string_base::ReplaceString( String( t1 ), String( t2 ), i );
9658 void ReplaceStringIC( const_c_string8 t1, const_c_string8 t2,
size_type i = 0 )
9660 string_base::ReplaceStringIC( String( t1 ), String( t2 ), i );
9665 void DeleteChar( char_type c,
size_type i = 0 )
9667 string_base::DeleteChar( c, i );
9670 void DeleteCharIC( char_type c,
size_type i = 0 )
9672 string_base::DeleteCharIC( c, i );
9675 void DeleteChar( char16_t c,
size_type i = 0 )
9677 string_base::DeleteChar( char_type( c ), i );
9680 void DeleteCharIC( char16_t c,
size_type i = 0 )
9682 string_base::DeleteCharIC( char_type( c ), i );
9685 void DeleteChar(
wchar_t c,
size_type i = 0 )
9687 string_base::DeleteChar( char_type( c ), i );
9690 void DeleteCharIC(
wchar_t c,
size_type i = 0 )
9692 string_base::DeleteCharIC( char_type( c ), i );
9695 void DeleteChar( char8_type c,
size_type i = 0 )
9697 string_base::DeleteChar( char_type( c ), i );
9700 void DeleteCharIC( char8_type c,
size_type i = 0 )
9702 string_base::DeleteCharIC( char_type( c ), i );
9707 void DeleteString(
const String& s,
size_type i = 0 )
9709 string_base::DeleteString( s, i );
9712 void DeleteStringIC(
const String& s,
size_type i = 0 )
9714 string_base::DeleteStringIC( s, i );
9717 void DeleteString( const_iterator t,
size_type i = 0 )
9719 string_base::DeleteString( t, i );
9722 void DeleteStringIC( const_iterator t,
size_type i = 0 )
9724 string_base::DeleteStringIC( t, i );
9727 void DeleteString(
const char16_t* t,
size_type i = 0 )
9729 string_base::DeleteString(
reinterpret_cast<const_iterator
>( t ), i );
9732 void DeleteStringIC(
const char16_t* t,
size_type i = 0 )
9734 string_base::DeleteStringIC(
reinterpret_cast<const_iterator
>( t ), i );
9737 void DeleteString(
const wchar_t* t,
size_type i = 0 )
9739 #ifdef __PCL_WINDOWS
9740 string_base::DeleteString(
reinterpret_cast<const_iterator
>( t ), i );
9742 string_base::DeleteString( String( t ), i );
9746 void DeleteStringIC(
const wchar_t* t,
size_type i = 0 )
9748 #ifdef __PCL_WINDOWS
9749 string_base::DeleteStringIC(
reinterpret_cast<const_iterator
>( t ), i );
9751 string_base::DeleteStringIC( String( t ), i );
9755 void DeleteString( const_c_string8 t,
size_type i = 0 )
9757 string_base::DeleteString( String( t ), i );
9760 void DeleteStringIC( const_c_string8 t,
size_type i = 0 )
9762 string_base::DeleteStringIC( String( t ), i );
9767 bool StartsWith(
const String& s )
const noexcept
9769 return string_base::StartsWith( s );
9772 bool StartsWith( const_iterator t )
const noexcept
9774 return string_base::StartsWith( t );
9777 bool StartsWith( char_type c )
const noexcept
9779 return string_base::StartsWith( c );
9782 bool StartsWithIC(
const String& s )
const noexcept
9784 return string_base::StartsWithIC( s );
9787 bool StartsWithIC( const_iterator t )
const noexcept
9789 return string_base::StartsWithIC( t );
9792 bool StartsWithIC( char_type c )
const noexcept
9794 return string_base::StartsWithIC( c );
9797 bool StartsWith(
const char16_t* t )
const noexcept
9799 return string_base::StartsWith(
reinterpret_cast<const_iterator
>( t ) );
9802 bool StartsWith( char16_t c )
const noexcept
9804 return string_base::StartsWith( char_type( c ) );
9807 bool StartsWithIC(
const char16_t* t )
const noexcept
9809 return string_base::StartsWithIC(
reinterpret_cast<const_iterator
>( t ) );
9812 bool StartsWithIC( char16_t c )
const noexcept
9814 return string_base::StartsWithIC( char_type( c ) );
9817 bool StartsWith(
const wchar_t* t )
const noexcept
9819 #ifdef __PCL_WINDOWS
9820 return string_base::StartsWith(
reinterpret_cast<const_iterator
>( t ) );
9822 return string_base::StartsWith( String( t ) );
9826 bool StartsWith(
wchar_t c )
const noexcept
9828 return string_base::StartsWith( char_type( c ) );
9831 bool StartsWithIC(
const wchar_t* t )
const noexcept
9833 #ifdef __PCL_WINDOWS
9834 return string_base::StartsWithIC(
reinterpret_cast<const_iterator
>( t ) );
9836 return string_base::StartsWithIC( String( t ) );
9840 bool StartsWithIC(
wchar_t c )
const noexcept
9842 return string_base::StartsWithIC( char_type( c ) );
9845 bool StartsWith( const_c_string8 t )
const noexcept
9847 size_type n = char8_traits::Length( t );
9848 if ( n == 0 || Length() < n )
9850 for ( const_iterator p = m_data->string, q = p+n; p < q; ++p, ++t )
9851 if ( *p != char_type( *t ) )
9856 bool StartsWith( char8_type c )
const noexcept
9858 return string_base::StartsWith( char_type( c ) );
9861 bool StartsWithIC( const_c_string8 t )
const noexcept
9863 size_type n = char8_traits::Length( t );
9864 if ( n == 0 || Length() < n )
9866 for ( const_iterator p = m_data->string, q = p+n; p < q; ++p, ++t )
9867 if ( char_traits::ToCaseFolded( *p ) != char_type( char8_traits::ToCaseFolded( *t ) ) )
9872 bool StartsWithIC( char8_type c )
const noexcept
9874 return string_base::StartsWithIC( char_type( c ) );
9879 bool EndsWith(
const String& s )
const noexcept
9881 return string_base::EndsWith( s );
9884 bool EndsWith( const_iterator t )
const noexcept
9886 return string_base::EndsWith( t );
9889 bool EndsWith( char_type c )
const noexcept
9891 return string_base::EndsWith( c );
9894 bool EndsWithIC(
const String& s )
const noexcept
9896 return string_base::EndsWithIC( s );
9899 bool EndsWithIC( const_iterator t )
const noexcept
9901 return string_base::EndsWithIC( t );
9904 bool EndsWithIC( char_type c )
const noexcept
9906 return string_base::EndsWithIC( c );
9909 bool EndsWith(
const char16_t* t )
const noexcept
9911 return string_base::EndsWith(
reinterpret_cast<const_iterator
>( t ) );
9914 bool EndsWith( char16_t c )
const noexcept
9916 return string_base::EndsWith( char_type( c ) );
9919 bool EndsWithIC(
const char16_t* t )
const noexcept
9921 return string_base::EndsWithIC(
reinterpret_cast<const_iterator
>( t ) );
9924 bool EndsWithIC( char16_t c )
const noexcept
9926 return string_base::EndsWithIC( char_type( c ) );
9929 bool EndsWith(
const wchar_t* t )
const noexcept
9931 #ifdef __PCL_WINDOWS
9932 return string_base::EndsWith(
reinterpret_cast<const_iterator
>( t ) );
9934 return string_base::EndsWith( String( t ) );
9938 bool EndsWith(
wchar_t c )
const noexcept
9940 return string_base::EndsWith( char_type( c ) );
9943 bool EndsWithIC(
const wchar_t* t )
const noexcept
9945 #ifdef __PCL_WINDOWS
9946 return string_base::EndsWithIC(
reinterpret_cast<const_iterator
>( t ) );
9948 return string_base::EndsWithIC( String( t ) );
9952 bool EndsWithIC(
wchar_t c )
const noexcept
9954 return string_base::EndsWithIC( char_type( c ) );
9957 bool EndsWith( const_c_string8 t )
const noexcept
9959 size_type n = char8_traits::Length( t );
9960 if ( n == 0 || Length() < n )
9962 for ( const_iterator p = m_data->end-n; p < m_data->end; ++p, ++t )
9963 if ( *p != char_type( *t ) )
9968 bool EndsWith( char8_type c )
const noexcept
9970 return string_base::EndsWith( char_type( c ) );
9973 bool EndsWithIC( const_c_string8 t )
const noexcept
9975 size_type n = char8_traits::Length( t );
9976 if ( n == 0 || Length() < n )
9978 for ( const_iterator p = m_data->end-n; p < m_data->end; ++p, ++t )
9979 if ( char_traits::ToCaseFolded( *p ) != char_type( char8_traits::ToCaseFolded( *t ) ) )
9984 bool EndsWithIC( char8_type c )
const noexcept
9986 return string_base::EndsWithIC( char_type( c ) );
9993 return string_base::FindFirst( s, i );
9998 return string_base::FindFirst( t, i );
10003 return string_base::FindFirst( c, i );
10008 return string_base::FindFirstIC( s, i );
10013 return string_base::FindFirstIC( t, i );
10018 return string_base::FindFirstIC( c, i );
10023 return string_base::FindFirst(
reinterpret_cast<const_iterator
>( t ), i );
10028 return string_base::FindFirst( char_type( c ), i );
10033 return string_base::FindFirstIC(
reinterpret_cast<const_iterator
>( t ), i );
10038 return string_base::FindFirstIC( char_type( c ), i );
10043 #ifdef __PCL_WINDOWS
10044 return string_base::FindFirst(
reinterpret_cast<const_iterator
>( t ), i );
10046 return string_base::FindFirst( String( t ), i );
10052 return string_base::FindFirst( char_type( c ), i );
10057 #ifdef __PCL_WINDOWS
10058 return string_base::FindFirstIC(
reinterpret_cast<const_iterator
>( t ), i );
10060 return string_base::FindFirstIC( String( t ), i );
10066 return string_base::FindFirstIC( char_type( c ), i );
10071 return string_base::FindFirst( String( t ), i );
10076 return string_base::FindFirst( char_type( c ), i );
10081 return string_base::FindFirstIC( String( t ), i );
10086 return string_base::FindFirstIC( char_type( c ), i );
10093 return FindFirst( s, i );
10098 return FindFirst( t, i );
10103 return FindFirst( c, i );
10108 return FindFirst( t, i );
10113 return FindFirst( c, i );
10118 return FindFirst( t, i );
10123 return FindFirst( c, i );
10128 return FindFirst( t, i );
10133 return FindFirst( c, i );
10138 return FindFirstIC( s, i );
10143 return FindFirstIC( t, i );
10148 return FindFirstIC( c, i );
10153 return FindFirstIC( t, i );
10158 return FindFirstIC( c, i );
10163 return FindFirstIC( t, i );
10168 return FindFirstIC( c, i );
10173 return FindFirstIC( t, i );
10178 return FindFirstIC( c, i );
10185 return string_base::FindLast( s, r );
10190 return string_base::FindLast( t, r );
10195 return string_base::FindLast( c, r );
10200 return string_base::FindLastIC( s, r );
10205 return string_base::FindLastIC( t, r );
10210 return string_base::FindLastIC( c, r );
10215 return string_base::FindLast(
reinterpret_cast<const_iterator
>( t ), r );
10220 return string_base::FindLast( char_type( c ), r );
10225 return string_base::FindLastIC(
reinterpret_cast<const_iterator
>( t ), r );
10230 return string_base::FindLastIC( char_type( c ), r );
10235 #ifdef __PCL_WINDOWS
10236 return string_base::FindLast(
reinterpret_cast<const_iterator
>( t ), r );
10238 return string_base::FindLast( String( t ), r );
10244 return string_base::FindLast( char_type( c ), r );
10249 #ifdef __PCL_WINDOWS
10250 return string_base::FindLastIC(
reinterpret_cast<const_iterator
>( t ), r );
10252 return string_base::FindLastIC( String( t ), r );
10258 return string_base::FindLastIC( char_type( c ), r );
10263 return string_base::FindLast( String( t ), r );
10268 return string_base::FindLast( char_type( c ), r );
10273 return string_base::FindLastIC( String( t ), r );
10278 return string_base::FindLastIC( char_type( c ), r );
10283 bool Contains(
const String& s )
const noexcept
10285 return string_base::Contains( s );
10288 bool Contains( const_iterator t )
const noexcept
10290 return string_base::Contains( t );
10293 bool Contains( char_type c )
const noexcept
10295 return string_base::Contains( c );
10298 bool ContainsIC(
const String& s )
const noexcept
10300 return string_base::ContainsIC( s );
10303 bool ContainsIC( const_iterator t )
const noexcept
10305 return string_base::ContainsIC( t );
10308 bool ContainsIC( char_type c )
const noexcept
10310 return string_base::ContainsIC( c );
10313 bool Contains(
const char16_t* t )
const noexcept
10315 return string_base::Contains(
reinterpret_cast<const_iterator
>( t ) );
10318 bool Contains( char16_t c )
const noexcept
10320 return string_base::Contains( char_type( c ) );
10323 bool ContainsIC(
const char16_t* t )
const noexcept
10325 return string_base::ContainsIC(
reinterpret_cast<const_iterator
>( t ) );
10328 bool ContainsIC( char16_t c )
const noexcept
10330 return string_base::ContainsIC( char_type( c ) );
10333 bool Contains(
const wchar_t* t )
const noexcept
10335 #ifdef __PCL_WINDOWS
10336 return string_base::Contains(
reinterpret_cast<const_iterator
>( t ) );
10338 return string_base::Contains( String( t ) );
10342 bool Contains(
wchar_t c )
const noexcept
10344 return string_base::Contains( char_type( c ) );
10347 bool ContainsIC(
const wchar_t* t )
const noexcept
10349 #ifdef __PCL_WINDOWS
10350 return string_base::ContainsIC(
reinterpret_cast<const_iterator
>( t ) );
10352 return string_base::ContainsIC( String( t ) );
10356 bool ContainsIC(
wchar_t c )
const noexcept
10358 return string_base::ContainsIC( char_type( c ) );
10361 bool Contains( const_c_string8 t )
const noexcept
10363 return string_base::Contains( String( t ) );
10366 bool Contains( char8_type c )
const noexcept
10368 return string_base::Contains( char_type( c ) );
10371 bool ContainsIC( const_c_string8 t )
const noexcept
10373 return string_base::ContainsIC( String( t ) );
10376 bool ContainsIC( char8_type c )
const noexcept
10378 return string_base::ContainsIC( char_type( c ) );
10383 int CompareCodePoints(
const String& s,
bool caseSensitive =
true ) const noexcept
10385 return string_base::CompareCodePoints( s, caseSensitive );
10388 int CompareCodePoints( const_iterator t,
bool caseSensitive =
true ) const noexcept
10390 return string_base::CompareCodePoints( t, caseSensitive );
10393 int CompareCodePoints( char_type c,
bool caseSensitive =
true ) const noexcept
10395 return string_base::CompareCodePoints( c, caseSensitive );
10398 int CompareCodePoints(
const char16_t* t,
bool caseSensitive =
true ) const noexcept
10400 return string_base::CompareCodePoints(
reinterpret_cast<const_iterator
>( t ), caseSensitive );
10403 int CompareCodePoints( char16_t c,
bool caseSensitive =
true ) const noexcept
10405 return string_base::CompareCodePoints( char_type( c ), caseSensitive );
10408 int CompareCodePoints(
const wchar_t* t,
bool caseSensitive =
true ) const noexcept
10410 #ifdef __PCL_WINDOWS
10411 return string_base::CompareCodePoints(
reinterpret_cast<const_iterator
>( t ), caseSensitive );
10413 return string_base::CompareCodePoints( String( t ), caseSensitive );
10417 int CompareCodePoints(
wchar_t c,
bool caseSensitive =
true ) const noexcept
10419 return string_base::CompareCodePoints( char_type( c ), caseSensitive );
10422 int CompareCodePoints( const_c_string8 t,
bool caseSensitive =
true ) const noexcept
10424 return string_base::CompareCodePoints( String( t ), caseSensitive );
10427 int CompareCodePoints( char8_type c,
bool caseSensitive =
true ) const noexcept
10429 return string_base::CompareCodePoints( char_type( c ), caseSensitive );
10434 int Compare(
const String& s,
bool caseSensitive =
true,
bool localeAware =
true ) const noexcept
10439 int Compare( const_iterator t,
bool caseSensitive =
true,
bool localeAware =
true ) const noexcept
10444 int Compare( char_type c,
bool caseSensitive =
true,
bool localeAware =
true ) const noexcept
10449 int CompareIC(
const String& s,
bool localeAware =
true ) const noexcept
10451 return string_base::CompareIC( s, localeAware );
10454 int CompareIC( const_iterator t,
bool localeAware =
true ) const noexcept
10456 return string_base::CompareIC( t, localeAware );
10459 int CompareIC( char_type c,
bool localeAware =
true ) const noexcept
10461 return string_base::CompareIC( c, localeAware );
10464 int Compare(
const char16_t* t,
bool caseSensitive =
true,
bool localeAware =
true ) const noexcept
10466 return string_base::Compare(
reinterpret_cast<const_iterator
>( t ), caseSensitive, localeAware );
10469 int Compare( char16_t c,
bool caseSensitive =
true,
bool localeAware =
true ) const noexcept
10474 int CompareIC(
const char16_t* t,
bool localeAware =
true ) const noexcept
10476 return string_base::CompareIC(
reinterpret_cast<const_iterator
>( t ), localeAware );
10479 int CompareIC( char16_t c,
bool localeAware =
true ) const noexcept
10481 return string_base::CompareIC( char_type( c ), localeAware );
10484 int Compare(
const wchar_t* t,
bool caseSensitive =
true,
bool localeAware =
true ) const noexcept
10486 #ifdef __PCL_WINDOWS
10487 return string_base::Compare(
reinterpret_cast<const_iterator
>( t ), caseSensitive, localeAware );
10493 int Compare(
wchar_t c,
bool caseSensitive =
true,
bool localeAware =
true ) const noexcept
10498 int CompareIC(
const wchar_t* t,
bool localeAware =
true ) const noexcept
10500 #ifdef __PCL_WINDOWS
10501 return string_base::CompareIC(
reinterpret_cast<const_iterator
>( t ), localeAware );
10503 return string_base::CompareIC( String( t ), localeAware );
10507 int CompareIC(
wchar_t c,
bool localeAware =
true ) const noexcept
10509 return string_base::CompareIC( char_type( c ), localeAware );
10512 int Compare( const_c_string8 t,
bool caseSensitive =
true,
bool localeAware =
true ) const noexcept
10517 int Compare( char8_type c,
bool caseSensitive =
true,
bool localeAware =
true ) const noexcept
10522 int CompareIC( const_c_string8 t,
bool localeAware =
true ) const noexcept
10524 return string_base::CompareIC( String( t ), localeAware );
10527 int CompareIC( char8_type c,
bool localeAware =
true ) const noexcept
10529 return string_base::CompareIC( char_type( c ), localeAware );
10534 bool WildMatch(
const String& pattern,
bool caseSensitive =
true ) const noexcept
10536 return string_base::WildMatch( pattern, caseSensitive );
10539 bool WildMatchIC(
const String& pattern )
const noexcept
10541 return string_base::WildMatchIC( pattern );
10544 bool WildMatch( const_iterator pattern,
bool caseSensitive =
true ) const noexcept
10546 return string_base::WildMatch( pattern, caseSensitive );
10549 bool WildMatchIC( const_iterator pattern )
const noexcept
10551 return string_base::WildMatchIC( pattern );
10554 bool WildMatch(
const string8_base& pattern,
bool caseSensitive =
true ) const noexcept
10556 return char_traits::WildMatch( m_data->string, Length(), pattern.Begin(), pattern.Length(), caseSensitive );
10559 bool WildMatchIC(
const string8_base& pattern )
const noexcept
10561 return char_traits::WildMatch( m_data->string, Length(), pattern.Begin(), pattern.Length(),
false );
10564 bool WildMatch( const_c_string8 pattern,
bool caseSensitive =
true ) const noexcept
10566 return char_traits::WildMatch( m_data->string, Length(), pattern, char8_traits::Length( pattern ), caseSensitive );
10569 bool WildMatchIC( const_c_string8 pattern )
const noexcept
10571 return char_traits::WildMatch( m_data->string, Length(), pattern, char8_traits::Length( pattern ),
false );
10576 String SetToLength(
size_type n )
const
10578 return string_base::SetToLength( n );
10581 String ResizedToNullTerminated()
const
10583 return string_base::ResizedToNullTerminated();
10586 String Squeezed()
const
10588 return string_base::Squeezed();
10595 return string_base::Substring( i, n );
10600 return string_base::Left( n );
10605 return string_base::Right( n );
10610 return string_base::Suffix( i );
10615 return string_base::Prefix( i );
10621 size_type Break( C& list,
const String& s,
bool trim =
false,
size_type i = 0 )
const
10623 return string_base::Break( list, s, trim, i );
10627 size_type Break( C& list,
const string8_base& s,
bool trim =
false,
size_type i = 0 )
const
10629 return string_base::Break( list, String( s ), trim, i );
10633 size_type Break( C& list, const_c_string8 s,
bool trim =
false,
size_type i = 0 )
const
10635 return string_base::Break( list, String( s ), trim, i );
10641 return string_base::Break( list, c, trim, i );
10647 return string_base::Break( list, char_type( c ), trim, i );
10650 template <
class C,
typename S>
10651 size_type Break( C& list,
const Array<S>& ca,
bool trim =
false,
size_type i = 0 )
const
10653 return string_base::Break( list, ca, trim, i );
10659 size_type BreakIC( C& list,
const String& s,
bool trim =
false,
size_type i = 0 )
const
10661 return string_base::BreakIC( list, s, trim, i );
10665 size_type BreakIC( C& list,
const string8_base& s,
bool trim =
false,
size_type i = 0 )
const
10667 return string_base::BreakIC( list, String( s ), trim, i );
10671 size_type BreakIC( C& list, const_c_string8 s,
bool trim =
false,
size_type i = 0 )
const
10673 return string_base::BreakIC( list, String( s ), trim, i );
10679 return string_base::BreakIC( list, c, trim, i );
10683 size_type BreakIC( C& list, char8_type c,
bool trim =
false,
size_type i = 0 )
const
10685 return string_base::BreakIC( list, char_type( c ), trim, i );
10690 String Trimmed()
const
10692 return string_base::Trimmed();
10695 String TrimmedLeft()
const
10697 return string_base::TrimmedLeft();
10700 String TrimmedRight()
const
10702 return string_base::TrimmedRight();
10709 return string_base::LeftJustified( width, fill );
10714 return string_base::RightJustified( width, fill );
10719 return string_base::CenterJustified( width, fill );
10724 String Enclosed( char_type c )
const
10726 return string_base::Enclosed( c );
10729 String SingleQuoted()
const
10731 return string_base::SingleQuoted();
10734 String DoubleQuoted()
const
10736 return string_base::DoubleQuoted();
10739 String Unquoted()
const
10741 return string_base::Unquoted();
10746 String CaseFolded()
const
10748 return string_base::CaseFolded();
10751 String Lowercase()
const
10753 return string_base::Lowercase();
10756 String Uppercase()
const
10758 return string_base::Uppercase();
10763 String Reversed()
const
10765 return string_base::Reversed();
10768 String Sorted()
const
10770 return string_base::Sorted();
10773 template <
class BP>
10774 String Sorted( BP p )
const
10776 return string_base::Sorted( p );
10794 return c.ToSeparated( *
this, separator );
10813 template <
class C,
class AF>
10817 return c.ToSeparated( *
this, separator, append );
10833 return c.ToSeparated( *
this, separator );
10852 template <
class C,
class AF>
10856 return c.ToSeparated( *
this, separator, append );
10871 return ToSeparated( c,
String( separator ) );
10890 template <
class C,
class AF>
10893 return ToSeparated( c,
String( separator ), append );
10909 return ToSeparated( c,
String( separator ) );
10928 template <
class C,
class AF>
10931 return ToSeparated( c,
String( separator ), append );
11099 #ifdef __PCL_QT_INTERFACE
11101 operator QString()
const
11103 return PCL_GET_QSTRING_FROM_CHAR16PTR( c_str() );
11106 operator QDate()
const
11108 return QDate::fromString(
operator QString(), PCL_QDATE_FMT_STR );
11111 operator QDateTime()
const
11113 return QDateTime::fromString(
operator QString(), PCL_QDATETIME_FMT_STR );
11132 va_start( paramList, fmt );
11134 (void)VFormat( fmt, paramList );
11136 va_end( paramList );
11154 va_start( paramList, fmt );
11156 (void)AppendVFormat( fmt, paramList );
11158 va_end( paramList );
11177 int count = s.
VFormat( fmt, paramList );
11197 int count = s.
VFormat( fmt, paramList );
11217 va_start( paramList, fmt );
11219 (void)VFormat( fmt, paramList );
11221 va_end( paramList );
11240 va_start( paramList, fmt );
11242 (void)AppendVFormat( fmt, paramList );
11244 va_end( paramList );
11357 return UTF16ToUTF8( Begin(), i, n );
11387 #ifdef __PCL_WINDOWS
11423 #ifdef __PCL_WINDOWS
11424 char_traits::Copy(
reinterpret_cast<iterator>( a.Begin() ), m_data->string+i, n );
11427 for (
const_iterator s = m_data->string+i, e = s+n; s < e; ++w, ++s )
11428 *w = wchar_t( *s );
11447 return UTF16ToUTF32( Begin(), i, n );
11450 #ifdef __PCL_QT_INTERFACE
11452 QString ToQString()
const
11454 return operator QString();
11457 QDate ToQDate()
const
11459 return operator QDate();
11462 QDateTime ToQDateTime()
const
11464 return operator QDateTime();
11615 return TryToInt( value, 0 );
11684 return ToUInt( 0 );
11712 return TryToUInt( value, 0 );
11768 return ToInt64( 0 );
11797 return TryToInt64( value, 0 );
11851 return ToUInt64( 0 );
11880 return TryToUInt64( value, 0 );
11984 #ifndef __PCL_NO_STRING_VECTOR
12035 int sign, s1, s2;
double s3;
12036 ParseSexagesimal( sign, s1, s2, s3, separator );
12037 return sign*(s1 + (s2 + s3/60)/60);
12055 int sign, s1, s2;
double s3;
12056 ParseSexagesimal( sign, s1, s2, s3, separators );
12057 return sign*(s1 + (s2 + s3/60)/60);
12079 int sign, s1, s2;
double s3;
12080 if ( TryParseSexagesimal( sign, s1, s2, s3, separator ) )
12082 value = sign*(s1 + (s2 + s3/60)/60);
12102 int sign, s1, s2;
double s3;
12103 if ( TryParseSexagesimal( sign, s1, s2, s3, separators ) )
12105 value = sign*(s1 + (s2 + s3/60)/60);
12184 bool TryParseSexagesimal(
int& sign,
int& s1,
int& s2,
double& s3, const
Array<
char_type>& separators ) const noexcept;
12210 static
String ToSexagesimal(
int sign,
double s1,
double s2,
double s3,
12225 return ToSexagesimal( (d < 0) ? -1 : +1,
Abs( d ), 0, 0, options );
12348 m_data->Allocate( n =
pcl::Min( n, len-p ) );
12350 for (
iterator i = m_data->string; i < m_data->
end; ++i, ++t )
12360 MaybeReallocate( len );
12361 for (
iterator i = m_data->string; i < m_data->
end; ++i, ++t )
12401 return String( std::move( s1 ) );
12412 return std::move( s1 );
12423 return String( std::move( s2 ) );
12434 return std::move( s2 );
12445 return String( std::move( s1 ) );
12456 return std::move( s1 );
12467 return String( std::move( s1 ) );
12478 return std::move( s1 );
12503 return String( std::move( s1 ) );
12514 return std::move( s1 );
12537 return String( std::move( s2 ) );
12548 return std::move( s2 );
12573 return String( std::move( s1 ) );
12584 return std::move( s1 );
12607 return String( std::move( s2 ) );
12618 return std::move( s2 );
12642 String s = std::move( s1 );
12655 return std::move( s1 );
12677 String s = std::move( s2 );
12690 return std::move( s2 );
12714 String s = std::move( s1 );
12727 return std::move( s1 );
12749 String s = std::move( s2 );
12762 return std::move( s2 );
12786 String s = std::move( s1 );
12799 return std::move( s1 );
12821 String s = std::move( s2 );
12834 return std::move( s2 );
12858 String s = std::move( s1 );
12871 return std::move( s1 );
12893 String s = std::move( s2 );
12906 return std::move( s2 );
12930 String s = std::move( s1 );
12943 return std::move( s1 );
12965 String s = std::move( s2 );
12978 return std::move( s2 );
13002 String s = std::move( s1 );
13015 return std::move( s1 );
13037 String s = std::move( s2 );
13050 return std::move( s2 );
13075 return String( std::move( s1 ) );
13086 return std::move( s1 );
13109 return String( std::move( s2 ) );
13120 return std::move( s2 );
13357 return s1.CompareCodePoints( t2 ) == 0;
13368 return s1.CompareCodePoints( t2 ) < 0;
13379 return s1.CompareCodePoints( t2 ) <= 0;
13390 return s1.CompareCodePoints( t2 ) > 0;
13401 return s1.CompareCodePoints( t2 ) >= 0;
13412 return s2.CompareCodePoints( t1 ) == 0;
13423 return s2.CompareCodePoints( t1 ) > 0;
13434 return s2.CompareCodePoints( t1 ) >= 0;
13445 return s2.CompareCodePoints( t1 ) < 0;
13456 return s2.CompareCodePoints( t1 ) <= 0;
13467 return s1.CompareCodePoints( c2 ) == 0;
13478 return s1.CompareCodePoints( c2 ) < 0;
13489 return s1.CompareCodePoints( c2 ) <= 0;
13500 return s1.CompareCodePoints( c2 ) > 0;
13511 return s1.CompareCodePoints( c2 ) >= 0;
13522 return s2.CompareCodePoints( c1 ) == 0;
13533 return s2.CompareCodePoints( c1 ) > 0;
13544 return s2.CompareCodePoints( c1 ) >= 0;
13555 return s2.CompareCodePoints( c1 ) < 0;
13566 return s2.CompareCodePoints( c1 ) <= 0;
13577 return s1.CompareCodePoints( t2 ) == 0;
13588 return s1.CompareCodePoints( t2 ) < 0;
13599 return s1.CompareCodePoints( t2 ) <= 0;
13610 return s1.CompareCodePoints( t2 ) > 0;
13621 return s1.CompareCodePoints( t2 ) >= 0;
13632 return s2.CompareCodePoints( t1 ) == 0;
13643 return s2.CompareCodePoints( t1 ) > 0;
13654 return s2.CompareCodePoints( t1 ) >= 0;
13665 return s2.CompareCodePoints( t1 ) < 0;
13676 return s2.CompareCodePoints( t1 ) <= 0;
13687 return s1.CompareCodePoints( c2 ) == 0;
13698 return s1.CompareCodePoints( c2 ) < 0;
13709 return s1.CompareCodePoints( c2 ) <= 0;
13720 return s1.CompareCodePoints( c2 ) > 0;
13731 return s1.CompareCodePoints( c2 ) >= 0;
13742 return s2.CompareCodePoints( c1 ) == 0;
13753 return s2.CompareCodePoints( c1 ) > 0;
13764 return s2.CompareCodePoints( c1 ) >= 0;
13775 return s2.CompareCodePoints( c1 ) < 0;
13786 return s2.CompareCodePoints( c1 ) <= 0;
13797 return s1.CompareCodePoints( t2 ) == 0;
13808 return s1.CompareCodePoints( t2 ) < 0;
13819 return s1.CompareCodePoints( t2 ) <= 0;
13830 return s1.CompareCodePoints( t2 ) > 0;
13841 return s1.CompareCodePoints( t2 ) >= 0;
13852 return s2.CompareCodePoints( t1 ) == 0;
13863 return s2.CompareCodePoints( t1 ) > 0;
13874 return s2.CompareCodePoints( t1 ) >= 0;
13885 return s2.CompareCodePoints( t1 ) < 0;
13896 return s2.CompareCodePoints( t1 ) <= 0;
13907 return s1.CompareCodePoints( c2 ) == 0;
13918 return s1.CompareCodePoints( c2 ) < 0;
13929 return s1.CompareCodePoints( c2 ) <= 0;
13940 return s1.CompareCodePoints( c2 ) > 0;
13951 return s1.CompareCodePoints( c2 ) >= 0;
13962 return s2.CompareCodePoints( c1 ) == 0;
13973 return s2.CompareCodePoints( c1 ) > 0;
13984 return s2.CompareCodePoints( c1 ) >= 0;
13995 return s2.CompareCodePoints( c1 ) < 0;
14006 return s2.CompareCodePoints( c1 ) <= 0;
14011 #ifndef __PCL_NO_STRING_OSTREAM
14013 inline std::wostream&
operator <<( std::wostream& o,
const String& s )
14015 #ifdef __PCL_WINDOWS
14016 return o << reinterpret_cast<const wchar_t*>( s.c_str() );
14018 Array<wchar_t> w = s.ToWCharArray();
14019 return o << w.Begin();
14023 inline std::ostream&
operator <<( std::ostream& o,
const String& s )
14025 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