1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
3 * list.h: a non-sucky linked list implementation
6 * Moonlight List (moonlight-list@lists.ximian.com)
8 * Copyright 2007 Novell, Inc. (http://www.novell.com)
10 * See the LICENSE file included with the distribution for details.
32 typedef bool (* NodeAction
) (Node
*node
, void *data
);
51 void Clear (bool freeNodes
);
53 Node
*Append (Node
*node
);
54 Node
*Prepend (Node
*node
);
55 Node
*Insert (Node
*node
, int index
);
56 Node
*InsertAfter (Node
*node
, Node
*after
);
57 Node
*InsertBefore (Node
*node
, Node
*before
);
59 Node
*Replace (Node
*node
, int index
);
61 Node
*Find (NodeAction find
, void *data
);
62 void Remove (NodeAction find
, void *data
);
63 void Remove (Node
*node
);
64 void RemoveAt (int index
);
65 void Unlink (Node
*node
);
67 Node
*Index (int index
);
69 int IndexOf (Node
*node
);
70 int IndexOf (NodeAction find
, void *data
);
72 void ForEach (NodeAction action
, void *data
);
84 // convenience properties
88 // convenience methods
89 void Clear (bool freeNodes
);
91 void Push (List::Node
*node
);
97 // accessing the internal linked list directly requires manual Locking/Unlocking.
104 int size
; // size of array
105 int count
; // # of items in the array
112 void SetCount (int value
);
115 void SetCapacity (int value
);
117 void EnsureCapacity (int capacity
);
118 int Add (void *item
);
119 void *& operator [] (int index
);
122 #endif /* __LIST_H__ */