Microsoft Foundation Classes (mfc.hlp) (Table of Contents; Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software, purely for historical purposes. If you're looking for up-to-date documentation, particularly for programming, you should not rely on the information found here, as it will be woefully out of date.
class CObList
CObject                                     Up Contents Index Back
──Microsoft Foundation Classes──────────────────────────────────────────────
 
  Description
 
  The CObList class supports ordered lists of nonunique CObject pointers
  accessible sequentially or by pointer value. CObList lists behave like
  doubly linked lists.
 
  A variable of type POSITION is a kind of key for the list. You can use a
  POSITION variable as an iterator to sequentially traverse a list and as
  a bookmark to hold a place. A position is not the same as an index,
  however.
 
  Element insertion is very fast at the list head, at the tail, and at a
  known POSITION. A sequential search is necessary in order to look up an
  element by value or index. This search can be slow if the list is long.
 
  CObList incorporates the IMPLEMENT_SERIAL macro to support serialization
  and dumping of its elements. If a list of CObject pointers is stored to
  an archive, either with the overloaded insertion operator or with the
  Serialize member function, each CObject element is, in turn,
  serialized.
 
  If you need a dump of individual CObject elements in the list, you must
  set the depth of the dump context to 1 or greater.
 
  When a CObList object is deleted, or when its elements are removed, only
  the CObject pointers are removed, not the objects they reference.
 
  #include <afxcoll.h>
 
  See Also
 
  CStringList, CPtrList
 
  Derivation
 
  The tutorial in the <Class Library User's Guide> illustrates the
  derivation of a CPersonList class from CObList. This new list class,
  designed to hold pointers to CPerson objects, adds a new data member and
  new member functions. Note that the resulting list is not strictly "type
  safe" because it allows insertion of any CObject pointer.
 
  NOTE: You must use the IMPLEMENT_SERIAL macro in the implementation of
        your derived class if you intend to serialize the list.
 
  Public Members
 
  Construction/Destruction
 
  CObList   Constructs an empty list for CObject pointers.
 
  ~CObList   Destroys a CObList object.
 
  Head/Tail Access
 
  GetHead   Returns the head element of the list (cannot be empty).
 
  GetTail   Returns the tail element of the list (cannot be empty).
 
  Operations
 
  RemoveHead   Removes the element from the head of the list.
 
  RemoveTail   Removes the element from the tail of the list.
 
  AddHead      Adds an element (or all the elements in another list) to
                 the head of the list (makes a new head).
 
  AddTail      Adds an element (or all the elements in another list) to
                 the tail of the list (makes a new tail).
 
  RemoveAll    Removes all the elements from this list.
 
  Iteration
 
  GetHeadPosition   Returns the position of the head element of the
                      list.
 
  GetTailPosition   Returns the position of the tail element of the
                      list.
 
  GetNext           Gets the next element for iterating.
 
  GetPrev           Gets the previous element for iterating.
 
  Retrieval/Modification
 
  GetAt      Gets the element at a given position.
 
  SetAt      Sets the element at a given position.
 
  RemoveAt   Removes an element from this list, specified by position.
 
  Insertion
 
  InsertBefore   Inserts a new element before a given position.
 
  InsertAfter    Inserts a new element after a given position.
 
  Searching
 
  Find        Gets the position of an element specified by pointer
                value.
 
  FindIndex   Gets the position of an element specified by a zero-based
                index.
 
  Status
 
  GetCount   Returns the number of elements in this list.
 
  IsEmpty    Tests for the empty list condition (no elements).
 
 
                                     -♦-