OpenBarnyard
 
Loading...
Searching...
No Matches
T2String.h
Go to the documentation of this file.
1#pragma once
2#include "T2CharTraits.h"
3#include "T2StringTraits.h"
4#include "T2String8.h"
5#include "T2String16.h"
6
8
9//-----------------------------------------------------------------------------
10// Purpose: Template wrapper for constant strings that allows using an interface
11// instead of static methods from T2String8 or T2String16.
12//
13// Use T2StringView to work with TCHAR strings
14// Use T2ConstString16 to work with TWCHAR strings
15// Note: To support other encodings, pass your own StringTraits class.
16//-----------------------------------------------------------------------------
17template <class StringTraits = T2StringTraits<TCHAR>>
19{
20public:
21 using CharType = typename StringTraits::CharType;
22
23public:
24 TFORCEINLINE constexpr T2StringViewBase( const CharType* a_pszString )
25 : m_pszString( a_pszString )
26 {}
27
29 : m_pszString( TNULL )
30 {}
31
32 TFORCEINLINE constexpr T2StringViewBase( const T2StringViewBase& a_rOther )
33 : m_pszString( a_rOther.m_pszString )
34 {}
35
36 TFORCEINLINE TSIZE Length() const { return StringTraits::Length( m_pszString ); }
37 TFORCEINLINE TBOOL IsLowerCase() const { return StringTraits::IsLowerCase( m_pszString ); }
38 TFORCEINLINE TBOOL IsUpperCase() const { return StringTraits::IsUpperCase( m_pszString ); }
39 TFORCEINLINE TBOOL IsEqual( T2StringViewBase a_otherString ) { return StringTraits::Compare( m_pszString, a_otherString.m_pszString ) == 0; }
40 TFORCEINLINE TBOOL IsEqualNoCase( T2StringViewBase a_otherString ) { return StringTraits::CompareNoCase( m_pszString, a_otherString.m_pszString ) == 0; }
41
42 TFORCEINLINE const CharType* FindChar( CharType a_cCharacter ) { return StringTraits::FindChar( m_pszString, a_cCharacter ); }
43 TFORCEINLINE const CharType* FindString( const CharType* a_pszSubstr ) { return StringTraits::FindString( m_pszString, a_pszSubstr ); }
44 TFORCEINLINE const CharType* SkipSpaces() { return StringTraits::SkipSpaces( m_pszString ); }
45
46 TFORCEINLINE constexpr T2StringViewBase& operator=( const CharType* a_pszString )
47 {
48 m_pszString = a_pszString;
49 return *this;
50 }
51
52 TFORCEINLINE constexpr T2StringViewBase operator+( int a_iSize ) const { return T2StringViewBase( m_pszString + a_iSize ); }
53 TFORCEINLINE constexpr T2StringViewBase operator-( int a_iSize ) const { return T2StringViewBase( m_pszString - a_iSize ); }
54 TFORCEINLINE constexpr T2StringViewBase operator+=( int a_iSize )
55 {
56 m_pszString += a_iSize;
57 return *this;
58 }
59 TFORCEINLINE constexpr T2StringViewBase operator-=( int a_iSize )
60 {
61 m_pszString -= a_iSize;
62 return *this;
63 }
64
66 {
67 return StringTraits::Compare( m_pszString, a_otherString.m_pszString ) == 0;
68 }
69
70 TFORCEINLINE constexpr const CharType* Get() const { return m_pszString; }
71 TFORCEINLINE constexpr operator const CharType*() const { return m_pszString; }
72
73private:
74 const CharType* m_pszString;
75};
76
79
80//-----------------------------------------------------------------------------
81// Purpose: Wrapper for a constant size string that has an interface.
82// Note: To support other encodings, pass your own StringTraits class.
83//-----------------------------------------------------------------------------
84template <TSIZE Size, typename TStringTraits = T2StringTraits<TCHAR>>
86{
87public:
88 TSTATICASSERT( Size > 0 );
89
90 using StringTraits = TStringTraits;
91 using CharTraits = typename StringTraits::CharTraits;
92 using CharType = typename StringTraits::CharType;
93 using UCharType = typename StringTraits::UCharType;
94
95public:
96 constexpr T2FormatString()
97 {
98 m_szBuffer[ 0 ] = CharTraits::NullChar;
99 }
100
101 T2FormatString( const CharType* a_szString )
102 {
103 Copy( a_szString );
104 }
105
106 void Copy( const CharType* a_szString )
107 {
108 StringTraits::CopySafe( m_szBuffer, a_szString, Size );
109 }
110
119 TINT ParseLine( const CharType* a_szString, TINT a_uiSize = -1, TINT* a_pStringLength = TNULL, TBOOL a_bTrimStartSpaces = TTRUE, TBOOL a_bTrimEndSpaces = TTRUE )
120 {
121 TINT uiPos = 0;
122 TINT uiStringPos = 0;
123 TBOOL bTextStarted = TFALSE;
124
125 if ( a_uiSize == -1 )
126 a_uiSize = INT_MAX;
127
128 while ( uiPos < Size && uiStringPos < a_uiSize && a_szString[ uiStringPos ] != '\0' )
129 {
130 if ( a_szString[ uiStringPos ] != '\n' )
131 {
132 // Trim spaced at the start of the string
133 if ( !bTextStarted && a_bTrimStartSpaces )
134 {
135 bTextStarted = !CharTraits::IsSpace( (UCharType)a_szString[ uiStringPos ] );
136
137 if ( !bTextStarted )
138 {
139 uiStringPos++;
140 continue;
141 }
142 }
143
144 m_szBuffer[ uiPos++ ] = a_szString[ uiStringPos++ ];
145 }
146 else
147 {
148 break;
149 }
150 }
151
152 uiPos -= 1;
153
154 if ( a_bTrimEndSpaces )
155 {
156 while ( uiPos >= 0 && m_szBuffer[ uiPos ] != '\n' && CharTraits::IsSpace( (UCharType)m_szBuffer[ uiPos ] ) )
157 {
158 uiPos--;
159 }
160 }
161
162 m_szBuffer[ uiPos + 1 ] = CharTraits::NullChar;
163
164 if ( a_pStringLength )
165 {
166 *a_pStringLength = uiPos + 1;
167 }
168
169 return uiStringPos + 1;
170 }
171
172 void Format( const CharType* a_szFormat, ... )
173 {
174 va_list args;
175
176 va_start( args, a_szFormat );
177 StringTraits::FormatV( m_szBuffer, Size, a_szFormat, args );
178 va_end( args );
179
180 m_szBuffer[ Size - 1 ] = CharTraits::NullChar;
181 }
182
183 void FormatV( const CharType* a_szFormat, va_list a_Args )
184 {
185 StringTraits::FormatV( m_szBuffer, Size, a_szFormat, a_Args );
186 m_szBuffer[ Size - 1 ] = CharTraits::NullChar;
187 }
188
189 void Append( const CharType* a_szString )
190 {
191 StringTraits::Concat( m_szBuffer, a_szString );
192 }
193
194 void Clear()
195 {
196 m_szBuffer[ 0 ] = CharTraits::NullChar;
197 }
198
200 {
201 return StringTraits::Length( m_szBuffer );
202 }
203
204 constexpr CharType* Get()
205 {
206 return m_szBuffer;
207 }
208
209 constexpr const CharType* Get() const
210 {
211 return m_szBuffer;
212 }
213
214 constexpr CharType* Get( TUINT a_uiIndex )
215 {
216 TASSERT( a_uiIndex < Size );
217 return &m_szBuffer[ a_uiIndex ];
218 }
219
220 constexpr const CharType* Get( TUINT a_uiIndex ) const
221 {
222 TASSERT( a_uiIndex < Size );
223 return &m_szBuffer[ a_uiIndex ];
224 }
225
226 constexpr CharType& operator[]( TUINT a_uiIndex )
227 {
228 return *Get( a_uiIndex );
229 }
230
231 constexpr const CharType& operator[]( TUINT a_uiIndex ) const
232 {
233 return *Get( a_uiIndex );
234 }
235
236private:
237 CharType m_szBuffer[ Size ];
238};
239
248
257
258//-----------------------------------------------------------------------------
259// Purpose: Wrapper class that makes parsing text data easier.
260// Note: To support other encodings, pass your own StringTraits class.
261//-----------------------------------------------------------------------------
262template <class StringTraits = T2StringTraits<TCHAR>>
264{
265public:
266 using CharType = typename StringTraits::CharType;
268
269public:
270 T2StringParser( ConstString a_pchBuffer, TSIZE a_uiBufferSize = -1 )
271 {
272 SetBuffer( a_pchBuffer, a_uiBufferSize );
273 }
274
276 {
277 m_uiBufferSize = 0;
278 }
279
280 void SetBuffer( ConstString a_pchBuffer, TSIZE a_uiBufferSize = -1 )
281 {
282 m_Buffer = a_pchBuffer;
283 m_BufferPos = a_pchBuffer;
284
285 if ( a_pchBuffer )
286 m_uiBufferSize = ( a_uiBufferSize == -1 ) ? a_pchBuffer.Length() : a_uiBufferSize;
287 else
288 m_uiBufferSize = 0;
289
290 m_BufferEnd = m_Buffer + m_uiBufferSize;
291 }
292
293 void Reset()
294 {
295 m_BufferPos = m_Buffer;
296 }
297
298 TSIZE Tell() const
299 {
300 return m_BufferPos - m_Buffer;
301 }
302
303 void Set( TSIZE a_uiPos )
304 {
305 m_BufferPos = m_Buffer + a_uiPos;
306 }
307
308 TBOOL PeekToken( CharType* a_pszToken, TSIZE a_uiTokenMaxSize )
309 {
310 TASSERT( TNULL != a_pszToken );
311 TASSERT( a_uiTokenMaxSize > 1 );
312
313 TSIZE uiSizeLeft = a_uiTokenMaxSize;
314 CharType* pchCopyCursor = a_pszToken;
315 ConstString cursor = m_BufferPos.SkipSpaces();
316
317 TBOOL bIsInQuotes = TFALSE;
318 TBOOL bIsPrevCharEscape = TFALSE;
319 TBOOL bIsValid = TFALSE;
320
321 // Copy until we have the last byte for the \0 character or the buffer is over
322 while ( uiSizeLeft > 1 && cursor < m_BufferEnd )
323 {
324 CharType cChar = *cursor;
325 TBOOL bIsEscapeChar = cChar == '\\';
326 TBOOL bIsBreakToken = isspace( cChar );
327
328 if ( !bIsPrevCharEscape && ( cChar == '"' || cChar == '\'' ) )
329 {
330 bIsInQuotes = !bIsInQuotes;
331
332 if ( !bIsInQuotes )
333 {
334 // The quotes are closed so the token is over
335 cursor += 1;
336 bIsValid = TTRUE;
337 break;
338 }
339 }
340 else if ( !bIsInQuotes && bIsBreakToken )
341 {
342 // Break (stop) character is found and it's not in quotes
343 cursor += 1;
344 bIsValid = TTRUE;
345 break;
346 }
347 else
348 {
349 // Copy the character
350 *( pchCopyCursor++ ) = cChar;
351 }
352
353 cursor += 1;
354 bIsPrevCharEscape = bIsEscapeChar;
355 }
356
357 if ( cursor >= m_BufferEnd && !bIsInQuotes )
358 bIsValid = TTRUE;
359
360 m_BufferLastPeek = cursor;
361 *pchCopyCursor = '\0';
362 return bIsValid;
363 }
364
365 TBOOL ReadToken( CharType* a_pszToken, TSIZE a_uiTokenMaxSize )
366 {
367 TBOOL bResult = PeekToken( a_pszToken, a_uiTokenMaxSize );
368 m_BufferPos = m_BufferLastPeek;
369
370 return bResult;
371 }
372
373 TBOOL IsOver() const
374 {
375 return m_BufferPos >= m_BufferEnd;
376 }
377
378private:
379 ConstString m_Buffer;
380 ConstString m_BufferPos;
381 ConstString m_BufferEnd;
382 ConstString m_BufferLastPeek;
383 TSIZE m_uiBufferSize;
384};
385
388
389//-----------------------------------------------------------------------------
390// Purpose: Wrapper class that allows other classes to compare strings.
391// Note: To support other encodings, pass your own StringTraits class.
392//-----------------------------------------------------------------------------
393template <class StringTraits = T2StringTraits<TCHAR>>
395{
396public:
397 using CharType = typename StringTraits::CharType;
398
399public:
400 static TBOOL IsEqual( const CharType* a, const CharType* b )
401 {
402 return StringTraits::Compare( a, b ) == 0;
403 }
404
405 static TBOOL IsGreater( const CharType* a, const CharType* b )
406 {
407 return StringTraits::Compare( a, b ) > 0;
408 }
409
410 static TBOOL IsLess( const CharType* a, const CharType* b )
411 {
412 return StringTraits::Compare( a, b ) < 0;
413 }
414
415 static TBOOL IsLessOrEqual( const CharType* a, const CharType* b )
416 {
417 return StringTraits::Compare( a, b ) <= 0;
418 }
419
420 static TBOOL IsGreaterOrEqual( const CharType* a, const CharType* b )
421 {
422 return StringTraits::Compare( a, b ) >= 0;
423 }
424};
425
428
429template <TINT Size, typename TStringTraits = T2StringTraits<TCHAR>>
431{
432public:
433 TSTATICASSERT( Size > 0 );
434
435 using StringTraits = TStringTraits;
436 using CharTraits = typename StringTraits::CharTraits;
437 using CharType = typename StringTraits::CharType;
438
439public:
440 constexpr T2StringBuffer()
441 {
442 m_szBuffer[ 0 ] = CharTraits::NullChar;
443 m_iPosition = 0;
444 }
445
446 T2StringBuffer( const CharType* a_szString )
447 {
448 Copy( a_szString );
449 }
450
451 void Copy( const CharType* a_szString )
452 {
453 StringTraits::CopySafe( m_szBuffer, a_szString, Size );
454 m_iPosition = StringTraits::Length( a_szString );
455 }
456
457 void Format( const CharType* a_szFormat, ... )
458 {
459 va_list args;
460
461 va_start( args, a_szFormat );
462 m_iPosition = StringTraits::FormatV( m_szBuffer, Size, a_szFormat, args );
463 va_end( args );
464
465 m_szBuffer[ Size - 1 ] = CharTraits::NullChar;
466 }
467
468 void FormatV( const CharType* a_szFormat, va_list a_Args )
469 {
470 m_iPosition = StringTraits::FormatV( m_szBuffer, Size, a_szFormat, a_Args );
471 m_szBuffer[ Size - 1 ] = CharTraits::NullChar;
472 }
473
474 void AppendFormat( const CharType* a_szFormat, ... )
475 {
476 if ( Size - m_iPosition - 1 <= 0 ) return;
477
478 va_list args;
479
480 va_start( args, a_szFormat );
481 m_iPosition += StringTraits::FormatV( m_szBuffer + m_iPosition, Size - m_iPosition, a_szFormat, args );
482 va_end( args );
483 }
484
485 void AppendFormatV( const CharType* a_szFormat, va_list a_Args )
486 {
487 if ( Size - m_iPosition - 1 <= 0 ) return;
488 m_iPosition += StringTraits::FormatV( m_szBuffer + m_iPosition, Size - m_iPosition, a_szFormat, a_Args );
489 }
490
491 void Append( const CharType* a_szString )
492 {
493 TINT iStringLength = StringTraits::Length( a_szString );
494 if ( Size - m_iPosition - iStringLength - 1 <= 0 ) return;
495
496 StringTraits::Concat( m_szBuffer + m_iPosition, a_szString, iStringLength );
497 m_iPosition += StringTraits::Length( a_szString );
498 }
499
500 constexpr void Clear()
501 {
502 m_szBuffer[ 0 ] = CharTraits::NullChar;
503 m_iPosition = 0;
504 }
505
506 constexpr TINT Length()
507 {
508 return m_iPosition;
509 }
510
511 constexpr CharType* Get()
512 {
513 return m_szBuffer;
514 }
515
516 constexpr const CharType* Get() const
517 {
518 return m_szBuffer;
519 }
520
521 constexpr CharType* Get( TUINT a_uiIndex )
522 {
523 TASSERT( a_uiIndex < Size );
524 return &m_szBuffer[ a_uiIndex ];
525 }
526
527 constexpr const CharType* Get( TUINT a_uiIndex ) const
528 {
529 TASSERT( a_uiIndex < Size );
530 return &m_szBuffer[ a_uiIndex ];
531 }
532
533 constexpr CharType& operator[]( TUINT a_uiIndex )
534 {
535 return *Get( a_uiIndex );
536 }
537
538 constexpr const CharType& operator[]( TUINT a_uiIndex ) const
539 {
540 return *Get( a_uiIndex );
541 }
542
543 T2StringBuffer& operator+=( const CharType* a_szString )
544 {
545 Append( a_szString );
546 return *this;
547 }
548
549private:
550 CharType m_szBuffer[ Size ];
551 TINT m_iPosition;
552};
553
#define TASSERT(X,...)
Definition Defines.h:138
#define TOSHI_NAMESPACE_START
Definition Defines.h:47
#define TFORCEINLINE
Definition Defines.h:74
#define TOSHI_NAMESPACE_END
Definition Defines.h:50
T2FormatString< 256, T2StringTraits< TWCHAR > > T2FormatWString256
Definition T2String.h:252
T2FormatString< 512, T2StringTraits< TCHAR > > T2FormatString512
Definition T2String.h:244
T2FormatString< 512, T2StringTraits< TWCHAR > > T2FormatWString512
Definition T2String.h:253
T2FormatString< 1024, T2StringTraits< TCHAR > > T2FormatString1024
Definition T2String.h:245
T2StringParser< T2StringTraits< TWCHAR > > T2String16Parser
Definition T2String.h:387
T2StringComparator< T2StringTraits< TCHAR > > T2String8Comparator
Definition T2String.h:426
T2StringParser< T2StringTraits< TCHAR > > T2String8Parser
Definition T2String.h:386
T2StringComparator< T2StringTraits< TWCHAR > > T2String16Comparator
Definition T2String.h:427
T2FormatString< 4096, T2StringTraits< TCHAR > > T2FormatString4096
Definition T2String.h:247
T2FormatString< 2048, T2StringTraits< TWCHAR > > T2FormatWString2048
Definition T2String.h:255
T2StringViewBase< T2StringTraits< TWCHAR > > T2StringView16
Definition T2String.h:78
T2FormatString< 128, T2StringTraits< TCHAR > > T2FormatString128
Definition T2String.h:242
T2FormatString< 128, T2StringTraits< TWCHAR > > T2FormatWString128
Definition T2String.h:251
T2FormatString< 256, T2StringTraits< TCHAR > > T2FormatString256
Definition T2String.h:243
T2FormatString< 1024, T2StringTraits< TWCHAR > > T2FormatWString1024
Definition T2String.h:254
T2FormatString< 32, T2StringTraits< TCHAR > > T2FormatString32
Definition T2String.h:240
T2FormatString< 2048, T2StringTraits< TCHAR > > T2FormatString2048
Definition T2String.h:246
T2FormatString< 32, T2StringTraits< TWCHAR > > T2FormatWString32
Definition T2String.h:249
T2FormatString< 64, T2StringTraits< TWCHAR > > T2FormatWString64
Definition T2String.h:250
T2FormatString< 4096, T2StringTraits< TWCHAR > > T2FormatWString4096
Definition T2String.h:256
T2StringViewBase< T2StringTraits< TCHAR > > T2StringView
Definition T2String.h:77
T2FormatString< 64, T2StringTraits< TCHAR > > T2FormatString64
Definition T2String.h:241
unsigned int TUINT
Definition Typedefs.h:8
size_t TSIZE
Definition Typedefs.h:9
#define TNULL
Definition Typedefs.h:23
int TINT
Definition Typedefs.h:7
#define TFALSE
Definition Typedefs.h:24
#define TTRUE
Definition Typedefs.h:25
bool TBOOL
Definition Typedefs.h:6
TFORCEINLINE constexpr const CharType * Get() const
Definition T2String.h:70
TFORCEINLINE TSIZE Length() const
Definition T2String.h:36
TFORCEINLINE TBOOL IsEqualNoCase(T2StringViewBase a_otherString)
Definition T2String.h:40
TFORCEINLINE constexpr T2StringViewBase & operator=(const CharType *a_pszString)
Definition T2String.h:46
TFORCEINLINE constexpr T2StringViewBase operator-=(int a_iSize)
Definition T2String.h:59
TFORCEINLINE constexpr T2StringViewBase operator+=(int a_iSize)
Definition T2String.h:54
TFORCEINLINE constexpr T2StringViewBase operator+(int a_iSize) const
Definition T2String.h:52
TFORCEINLINE TBOOL operator==(T2StringViewBase a_otherString)
Definition T2String.h:65
TFORCEINLINE const CharType * SkipSpaces()
Definition T2String.h:44
TFORCEINLINE TBOOL IsEqual(T2StringViewBase a_otherString)
Definition T2String.h:39
TFORCEINLINE const CharType * FindString(const CharType *a_pszSubstr)
Definition T2String.h:43
TFORCEINLINE constexpr T2StringViewBase(const CharType *a_pszString)
Definition T2String.h:24
TFORCEINLINE const CharType * FindChar(CharType a_cCharacter)
Definition T2String.h:42
typename StringTraits::CharType CharType
Definition T2String.h:21
TFORCEINLINE constexpr T2StringViewBase()
Definition T2String.h:28
TFORCEINLINE constexpr T2StringViewBase operator-(int a_iSize) const
Definition T2String.h:53
TFORCEINLINE TBOOL IsLowerCase() const
Definition T2String.h:37
TFORCEINLINE TBOOL IsUpperCase() const
Definition T2String.h:38
TFORCEINLINE constexpr T2StringViewBase(const T2StringViewBase &a_rOther)
Definition T2String.h:32
void Format(const CharType *a_szFormat,...)
Definition T2String.h:172
constexpr const CharType & operator[](TUINT a_uiIndex) const
Definition T2String.h:231
void Copy(const CharType *a_szString)
Definition T2String.h:106
TStringTraits StringTraits
Definition T2String.h:90
constexpr CharType * Get()
Definition T2String.h:204
void Append(const CharType *a_szString)
Definition T2String.h:189
constexpr CharType & operator[](TUINT a_uiIndex)
Definition T2String.h:226
typename StringTraits::CharTraits CharTraits
Definition T2String.h:91
T2FormatString(const CharType *a_szString)
Definition T2String.h:101
constexpr const CharType * Get() const
Definition T2String.h:209
constexpr const CharType * Get(TUINT a_uiIndex) const
Definition T2String.h:220
TUINT Length()
Definition T2String.h:199
constexpr T2FormatString()
Definition T2String.h:96
TINT ParseLine(const CharType *a_szString, TINT a_uiSize=-1, TINT *a_pStringLength=nullptr, TBOOL a_bTrimStartSpaces=true, TBOOL a_bTrimEndSpaces=true)
Parses a line from specified buffer and saves it.
Definition T2String.h:119
TSTATICASSERT(Size > 0)
void FormatV(const CharType *a_szFormat, va_list a_Args)
Definition T2String.h:183
typename StringTraits::CharType CharType
Definition T2String.h:92
constexpr CharType * Get(TUINT a_uiIndex)
Definition T2String.h:214
typename StringTraits::UCharType UCharType
Definition T2String.h:93
typename T2StringViewBase< StringTraits > ConstString
Definition T2String.h:267
typename StringTraits::CharType CharType
Definition T2String.h:266
TBOOL PeekToken(CharType *a_pszToken, TSIZE a_uiTokenMaxSize)
Definition T2String.h:308
void SetBuffer(ConstString a_pchBuffer, TSIZE a_uiBufferSize=-1)
Definition T2String.h:280
TBOOL IsOver() const
Definition T2String.h:373
TBOOL ReadToken(CharType *a_pszToken, TSIZE a_uiTokenMaxSize)
Definition T2String.h:365
T2StringParser(ConstString a_pchBuffer, TSIZE a_uiBufferSize=-1)
Definition T2String.h:270
void Set(TSIZE a_uiPos)
Definition T2String.h:303
TSIZE Tell() const
Definition T2String.h:298
static TBOOL IsEqual(const CharType *a, const CharType *b)
Definition T2String.h:400
static TBOOL IsGreater(const CharType *a, const CharType *b)
Definition T2String.h:405
static TBOOL IsLessOrEqual(const CharType *a, const CharType *b)
Definition T2String.h:415
static TBOOL IsLess(const CharType *a, const CharType *b)
Definition T2String.h:410
static TBOOL IsGreaterOrEqual(const CharType *a, const CharType *b)
Definition T2String.h:420
typename StringTraits::CharType CharType
Definition T2String.h:397
void Copy(const CharType *a_szString)
Definition T2String.h:451
T2StringBuffer(const CharType *a_szString)
Definition T2String.h:446
constexpr const CharType * Get() const
Definition T2String.h:516
constexpr TINT Length()
Definition T2String.h:506
TSTATICASSERT(Size > 0)
void Append(const CharType *a_szString)
Definition T2String.h:491
void AppendFormat(const CharType *a_szFormat,...)
Definition T2String.h:474
void Format(const CharType *a_szFormat,...)
Definition T2String.h:457
TStringTraits StringTraits
Definition T2String.h:435
constexpr void Clear()
Definition T2String.h:500
constexpr const CharType & operator[](TUINT a_uiIndex) const
Definition T2String.h:538
constexpr CharType & operator[](TUINT a_uiIndex)
Definition T2String.h:533
constexpr T2StringBuffer()
Definition T2String.h:440
void FormatV(const CharType *a_szFormat, va_list a_Args)
Definition T2String.h:468
constexpr const CharType * Get(TUINT a_uiIndex) const
Definition T2String.h:527
typename StringTraits::CharTraits CharTraits
Definition T2String.h:436
void AppendFormatV(const CharType *a_szFormat, va_list a_Args)
Definition T2String.h:485
constexpr CharType * Get()
Definition T2String.h:511
T2StringBuffer & operator+=(const CharType *a_szString)
Definition T2String.h:543
typename StringTraits::CharType CharType
Definition T2String.h:437
constexpr CharType * Get(TUINT a_uiIndex)
Definition T2String.h:521
static CharType * Concat(CharType *dst, const CharType *src, TSIZE size=-1)
static TSIZE Length(const CharType *str)
static TINT FormatV(CharType *a_pcString, TINT size, const CharType *a_pcFormat, va_list args)
static CharType * CopySafe(CharType *dst, const CharType *src, TSIZE size)