CStringList
Class
Supports lists of CString
objects.
Syntax
class CStringList : public CObject
Members
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;
and
POSITION AddHead( CObject* <newElement> );
translates to
POSITION AddHead( LPCTSTR <newElement> );
Public Constructors
Name | Description |
---|---|
CStringList::CStringList |
Constructs an empty list. |
Public Methods
Name | Description |
---|---|
CStringList::AddHead |
Adds an element (or all the elements in another list) to the head of the list (makes a new head). |
CStringList::AddTail |
Adds an element (or all the elements in another list) to the tail of the list (makes a new tail). |
CStringList::Find |
Gets the position of an element specified by pointer value. |
CStringList::FindIndex |
Gets the position of an element specified by a zero-based index. |
CStringList::GetAt |
Gets the element at a given position. |
CStringList::GetCount |
Returns the number of elements in this list. |
CStringList::GetHead |
Returns the head element of the list (can't be empty). |
CStringList::GetHeadPosition |
Returns the position of the head element of the list. |
CStringList::GetNext |
Gets the next element for iterating. |
CStringList::GetPrev |
Gets the previous element for iterating. |
CStringList::GetSize |
Returns the number of elements in this list. |
CStringList::GetTail |
Returns the tail element of the list (can't be empty). |
CStringList::GetTailPosition |
Returns the position of the tail element of the list. |
CStringList::InsertAfter |
Inserts a new element after a given position. |
CStringList::InsertBefore |
Inserts a new element before a given position. |
CStringList::IsEmpty |
Tests for the empty list condition (no elements). |
CStringList::RemoveAll |
Removes all the elements from this list. |
CStringList::RemoveAt |
Removes an element from this list, specified by position. |
CStringList::RemoveHead |
Removes the element from the head of the list. |
CStringList::RemoveTail |
Removes the element from the tail of the list. |
CStringList::SetAt |
Sets the element at a given position. |
Remarks
All comparisons are done by value, meaning that the characters in the string are compared instead of the addresses of the strings.
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.
For more information on using CStringList
, see the article Collections.
Inheritance Hierarchy
CStringList
Requirements
Header: afxcoll.h