Download Special Edition Using Visual C++ 6
Transcript
Special Edition Using Visual C++ 6 -- Appendix F -- Useful Classes FIG. F.7 A linked list has a head and a tail, with the remaining nodes in between. MFC provides three list classes that you can use to create your lists. These classes are CObList (which represents a list of objects), CPtrList (which represents a list of pointers), and CStringList (which represents a list of strings). Each of these classes has similar member functions, and the classes differ in the type of data that they can hold in their lists. Table F.2 lists and describes the member functions of the list classes. Table F.2 Member Functions of the List Classes Function AddHead() AddTail() Find() Description Adds a node to the head of the list, making the node the new head Adds a node to the tail of the list, making the node the new tail Searches the list sequentially to find the given object pointer and returns a POSITION value FindIndex() Scans the list sequentially, stopping at the node indicated by the given index, and returns a POSITION value for the node GetAt() Gets the node at the specified position GetCount() Gets the number of nodes in the list GetHead() Gets the list's head node GetHeadPosition() Gets the head node's position GetNext() Gets the next node in the list when iterating over a list GetPrev() Gets the previous node in the list when iterating over a list GetTail() Gets the list's tail node GetTailPosition() Gets the tail node's position InsertAfter() Inserts a new node after the specified position InsertBefore() Inserts a new node before the specified position IsEmpty() Returns TRUE if the list is empty and returns FALSE otherwise RemoveAll() Removes all nodes from a list RemoveAt() Removes a single node from a list RemoveHead() Removes the list's head node RemoveTail() Removes the list's tail node SetAt() Sets the node at the specified position List Templates Linked lists are another good use for templates. There is a list and a deque (double-ended queue) in the Standard Template Library, discussed in Chapter 26, "Exceptions and Templates." Many developers find the MFC list classes much easier to use than templates. http://www.pbs.mcp.com/ebooks/0789715392/apf/apf.htm (8 of 23) [7/29/1999 4:01:17 PM]
Related documents
Oracle Health Insurance Back Office
PDF file - EMME/2 Support Center
IMK-571R Software and Programming Guides
General Terms and Conditions for bank accounts and payment
coen-2003-project-24.. - Computer Engineering
User Guide
User manual - UK Free TV
Cortex-M3 107 Development Board User`s Manual
WinCON - Getting Started Manual
KALOS 2 USER MANUAL
WinCon-8000 Getting Started
Visual C++ 6.0 Tutorial