#include <mfcstl/string/grab_cstring_buffer.hpp>
This class is used to scope the aquisition and release of a CString buffer ensuring that ReleaseBuffer() is called on the given CString object.
Public Member Functions | |
grab_cstring_buffer (CString &str, int length) throw ( CMemoryException * ) | |
Acquires the requested length on the given managed string. | |
~grab_cstring_buffer () throw () | |
Releases the managed string. | |
LPCTSTR | c_str () const |
Returns a pointer to a nul-terminated string. | |
operator LPTSTR () | |
Provides mutating access to the managed string's internal buffer. | |
operator LPCTSTR () const | |
Provides non-mutating access to the managed string's internal buffer. | |
int | length () const |
Returns the length of the managed string. | |
int | original_length () const |
Returns the original length of the managed string. |
grab_cstring_buffer | ( | CString & | str, | |
int | length | |||
) | throw ( CMemoryException * ) [inline] |
Acquires the requested length on the given managed string.
Calls GetBuffer(length)
on the given string, after recording the original length. If acquisition fails then a CMemoryException is thrown.
~grab_cstring_buffer | ( | ) | throw () [inline] |
LPCTSTR c_str | ( | ) | const [inline] |
Returns a pointer to a nul-terminated string.
operator LPTSTR | ( | ) | [inline] |
Provides mutating access to the managed string's internal buffer.
operator LPCTSTR | ( | ) | const [inline] |
Provides non-mutating access to the managed string's internal buffer.
int length | ( | ) | const [inline] |
Returns the length of the managed string.
int original_length | ( | ) | const [inline] |
Returns the original length of the managed string.