CStringList Class
Collapse the table of content
Expand the table of content
Important This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here. ArchiveDisclaimer

CStringList Class

Supports lists of CString objects.

class CStringList : public CObject

All comparisons are done by value, meaning that the characters in the string are compared instead of the addresses of the strings.

The member functions of CStringList are similar to the member functions of class CObList. Because of this similarity, you can use the CObList reference documentation for member function specifics. Wherever you see a CObject pointer as a return value, substitute a CString (not a CString pointer). Wherever you see a CObject pointer as a function parameter, substitute an LPCTSTR.

CObject*& CObList::GetHead() const;

for example, translates to

CString& CStringList::GetHead() const;


POSITION AddHead( CObject* <newElement> );

translates to

POSITION AddHead( LPCTSTR <newElement> );

CStringList incorporates the IMPLEMENT_SERIAL macro to support serialization and dumping of its elements. If a list of CString objects is stored to an archive, either with an overloaded insertion operator or with the Serialize member function, each CString element is serialized in turn.

If you need a dump of individual CString elements, you must set the depth of the dump context to 1 or greater.

When a CStringList object is deleted, or when its elements are removed, the CString objects are deleted as appropriate.

For more information on using CStringList, see the article Collections.

Header: afxcoll.h

© 2015 Microsoft