#include <listItem.h>
Inheritance diagram for ListItem::
Public Methods | |
ListItem () | |
Default constructor. | |
virtual | ~ListItem () |
Destructor. | |
ListItem * | next () const |
Next item in the list. More... | |
ListItem * | add (ListItem **list) |
Adds self to the head of list. More... | |
ListItem * | remove () |
Removes self from a list. More... | |
Private Attributes | |
ListItem * | _next |
pointer to next ListItem object in the list. | |
ListItem * | _prev |
pointer to previous ListItem object in the list. | |
ListItem ** | _list |
pointer where pointer to head of list is stored. |
This class implements one item of the list. In truth it implements the list itself. This class has all needed methods to make the useful list, a small problem is a head of list you must store somewhere and manage by yourself. Another problem: in the same list there can be items of different types, all inherited from ListItem class. There is no typechecking, too. It is better to use List template for list of items of concrete type. Direct descendants, same classes as ListItem class but with different names, are L1, LI2 etc. classes. They are usually used when inheriting a descendant from two or more ListItem classes (eg. if you want to use one object in two different lists).
Definition at line 56 of file listItem.h.
|
Adds self to the head of list.
Definition at line 37 of file listItem.cpp. |
|
Next item in the list. This method returns pointer to next ListItem object in the dynamic list or NULL.
Definition at line 86 of file listItem.h. |
|
Removes self from a list.
Definition at line 51 of file listItem.cpp. |