CStrBufT Class
This class provides automatic resource cleanup for GetBuffer and ReleaseBuffer calls on an existing CStringT object.
template<
typename TCharType
>
class CStrBufT
Parameters
TCharType
The character type of the CStrBufT class. Can be one of the following:char (for ANSI character strings)
wchar_t (for Unicode character strings)
TCHAR (for both ANSI and Unicode character strings)
Members
Public Typedefs
Name |
Description |
---|---|
PCXSTR |
A pointer to a constant string. |
PXSTR |
A pointer to a string. |
StringType |
The string type whose buffer is to be manipulated by specializations of this class template. |
Public Constructors
Name |
Description |
---|---|
The constructor for the string buffer object. |
Public Methods
Name |
Description |
---|---|
Sets the character buffer length of the associated string object. |
Public Operators
Name |
Description |
---|---|
Retrieves a const pointer to the character buffer of the associated string object. |
|
Retrieves a pointer to the character buffer of the associated string object. |
Public Constants
Name |
Description |
---|---|
Automatically determine the new length of the string at release. |
|
Set the length of the string object at GetBuffer time |
Remarks
This class is used as a wrapper class for replacing calls to GetBuffer and ReleaseBuffer, or GetBufferSetLength and ReleaseBuffer.
Primarily designed as a helper class, CStrBufT provides a convenient way for a developer to work with the character buffer of a string object without worrying about how or when to call ReleaseBuffer. This is possible because the wrapper object goes out of scope naturally in the case of an exception or multiple exiting code paths; causing its destructor to free the string resource.
Requirements
Header: atlsimpstr.h