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 41 of file strings/fwds.hpp.
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 2090 of file tastring.inl.
|
protected |
The The original length of the string.
Definition at line 2091 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 2112 of file tastring.inl.
|
inline |
Destructor. Restores the string's original length.
Definition at line 2118 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 2130 of file tastring.inl.
|
inline |
Resets the strings to the original length before destruction of this object.
Definition at line 2125 of file tastring.inl.