This is a simple utility class that can be used in situations where a AString is intermediately extended and later shortened back to its original length. With the use of this class, C++ stack-unwinding is used to ensure that the length is reset in all execution paths including exception handling, etc.
| TChar | The character type of the AString that is to be reset. |
| TAllocator | The allocator type of the AString, as prototyped with Allocator. |
Definition at line 2222 of file tastring.inl.
Public Method Index: | |
| TStringLengthResetter (TAString< TChar, TAllocator > &pAString) | |
| ~TStringLengthResetter () | |
| Destructor. Restores the string's original length. | |
| integer | OriginalLength () |
| void | ResetNow () |
Protected Field Index: | |
| TAString< TChar, TAllocator > & | aString |
| The AString to reset. | |
| integer | originalLength |
| The The original length of the string. | |
Private Method Index: | |
| void * | operator new (size_t) |
| void * | operator new (size_t, void *) |
| void * | operator new[] (size_t) |
| void * | operator new[] (size_t, void *) |
| void | operator= (const TStringLengthResetter &) |
| Private assignment operator. | |
|
protected |
The AString to reset.
Definition at line 2225 of file tastring.inl.
|
protected |
The The original length of the string.
Definition at line 2226 of file tastring.inl.
|
inline |
Constructor taking the string. Stores the current length in field originalLength.
| pAString | The String to take the length of and reset on destruction. |
Definition at line 2247 of file tastring.inl.
|
inline |
Destructor. Restores the string's original length.
Definition at line 2252 of file tastring.inl.
|
private |
Private new to disallow heap allocation.
|
private |
Private new to disallow heap allocation.
|
private |
Private new to disallow heap allocation.
|
private |
Private new to disallow heap allocation.
|
inline |
Returns the original length.
Definition at line 2262 of file tastring.inl.
|
inline |
Resets the strings to the original length before destruction of this object.
Definition at line 2258 of file tastring.inl.