Share via


CSimpleStringT Class

This class represents a CSimpleStringT object.

template <typename BaseType> 
class CSimpleStringT

Parameters

  • BaseType
    The character type of the string 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

CSimpleStringT::PCXSTR

A pointer to a constant string.

CSimpleStringT::PXSTR

A pointer to a string.

Public Constructors

Name

Description

CSimpleStringT::CSimpleStringT

Constructs CSimpleStringT objects in various ways.

CSimpleStringT::~CSimpleStringT

Destructor.

Public Methods

Name

Description

CSimpleStringT::Append

Appends a CSimpleStringT object to an existing CSimpleStringT object.

CSimpleStringT::AppendChar

Appends a character to an existing CSimpleStringT object.

CSimpleStringT::CopyChars

Copies a character or characters to another string.

CSimpleStringT::CopyCharsOverlapped

Copies a character or characters to another string in which the buffers overlap.

CSimpleStringT::Empty

Forces a string to have a length of zero.

CSimpleStringT::FreeExtra

Frees any extra memory previously allocated by the string object.

CSimpleStringT::GetAllocLength

Retrieves the allocated length of a CSimpleStringT object.

CSimpleStringT::GetAt

Returns the character at a given position.

CSimpleStringT::GetBuffer

Returns a pointer to the characters in a CSimpleStringT.

CSimpleStringT::GetBufferSetLength

Returns a pointer to the characters in a CSimpleStringT, truncating to the specified length.

CSimpleStringT::GetLength

Returns the number of characters in a CSimpleStringT object.

CSimpleStringT::GetManager

Retrieves the memory manager of the CSimpleStringT object.

CSimpleStringT::GetString

Retrieves the character string

CSimpleStringT::IsEmpty

Tests whether a CSimpleStringT object contains no characters.

CSimpleStringT::LockBuffer

Disables reference counting and protects the string in the buffer.

CSimpleStringT::Preallocate

Allocates a specific amount of memory for the character buffer.

CSimpleStringT::ReleaseBuffer

Releases control of the buffer returned by GetBuffer.

CSimpleStringT::ReleaseBufferSetLength

Releases control of the buffer returned by GetBuffer.

CSimpleStringT::SetAt

Sets a character at a given position.

CSimpleStringT::SetManager

Sets the memory manager of a CSimpleStringT object.

CSimpleStringT::SetString

Sets the string of a CSimpleStringT object.

CSimpleStringT::StringLength

Returns the number of characters in the specified string.

CSimpleStringT::Truncate

Truncates the string to a specified length.

CSimpleStringT::UnlockBuffer

Enables reference counting and releases the string in the buffer.

Public Operators

Name

Description

CSimpleStringT::operator PCXSTR

Directly accesses characters stored in a CSimpleStringT object as a C-style string.

CSimpleStringT::operator []

Returns the character at a given position — operator substitution for GetAt.

CSimpleStringT::operator +=

Concatenates a new string to the end of an existing string.

CSimpleStringT::operator =

Assigns a new value to a CSimpleStringT object.

Remarks

CSimpleStringT is the base class for the various string classes supported by Visual C++. It provides minimal support for memory management of the string object and basic buffer manipulation. For more advanced string objects, see CStringT Class.

Requirements

Header: atlsimpstr.h

See Also

Reference

Hierarchy Chart

Other Resources

ATL/MFC Shared Classes