1
<html><head><TITLE>List</TITLE></head>
3
<H2><A HREF ="#DOC.DOCU" > <IMG BORDER=0 SRC=down.gif></A> template <class T> class List </H2><BLOCKQUOTE>
4
lists of objects of arbitrary type T.
8
<APPLET CODE="ClassGraph.class" WIDTH=600 HEIGHT=155>
9
<param name=classes value="CList,MList.html,CSubjects,MSubjects.html,CShapes,MShapes.html,CProperties,MProperties.html,CAssocList,MAssocList.html">
10
<param name=before value="M,M|_,MR_,MR_,Mr_">
11
<param name=after value="M,M,M,M,M">
12
<param name=indent value="0,0,0,0,0">
13
<param name=arrowdir value="down">
19
<DT><h3>Public Methods</h3><DD><TR><TD VALIGN=top><A HREF="#DOC.218.1"> <IMG BORDER=0 SRC=icon1.gif></A> </TD><TD><B>List</B> ()<br>
20
<I> create an empty list.</I>
21
</TD></TR><TR><TD VALIGN=top><A HREF="#DOC.218.2"> <IMG BORDER=0 SRC=icon1.gif></A> virtual </TD><TD><B>~List</B> ()<br>
22
<I> delete entire list (but not the elements of the list).</I>
23
</TD></TR><TR><TD VALIGN=top><A HREF="#DOC.218.3"> <IMG BORDER=0 SRC=icon1.gif></A> </TD><TD><B>List</B> (const <!2><A HREF="List.html#DOC.218.1">List</A><T> &l)<br>
24
<I> create list, initialized by elements of l.</I>
25
</TD></TR><TR><TD VALIGN=top><A HREF="#DOC.218.4"> <IMG BORDER=0 SRC=icon1.gif></A> <!2><A HREF="List.html#DOC.218.1">List</A> <T> & </TD><TD><B>operator=</B> (const <!2><A HREF="List.html#DOC.218.1">List</A><T> &l)<br>
26
<I> copy list into an other, elements are copied too (e.g. l2 = l1).</I>
27
</TD></TR><TR><TD VALIGN=top><A HREF="#DOC.218.5"> <IMG BORDER=0 SRC=icon1.gif></A> void </TD><TD><B>add</B> (const T &e)<br>
28
<I> add e to the end of the list.</I>
29
</TD></TR><TR><TD VALIGN=top><A HREF="#DOC.218.6"> <IMG BORDER=0 SRC=icon1.gif></A> void </TD><TD><B>insert</B> (const T &e, const unsigned i)<br>
30
<I> insert e to i+1'th position of the list. </I>
31
</TD></TR><TR><TD VALIGN=top><A HREF="#DOC.218.7"> <IMG BORDER=0 SRC=icon1.gif></A> int </TD><TD><B>find</B> (const T &e) const <br>
32
<I> return index of first element equal to e, if not found, return -1.</I>
33
</TD></TR><TR><TD VALIGN=top><A HREF="#DOC.218.8"> <IMG BORDER=0 SRC=icon1.gif></A> bool </TD><TD><B>isSet</B> () const <br>
34
<I> return list is set</I>
35
</TD></TR><TR><TD VALIGN=top><A HREF="#DOC.218.9"> <IMG BORDER=0 SRC=icon1.gif></A> int </TD><TD><B>count</B> (const T &e) const <br>
36
<I> count the number of times e occurs in the list</I>
37
</TD></TR><TR><TD VALIGN=top><A HREF="#DOC.218.10"> <IMG BORDER=0 SRC=icon1.gif></A> bool </TD><TD><B>contains</B> (<!2><A HREF="List.html#DOC.218.1">List</A><T> *l) const <br>
38
<I> return if list contains list l</I>
39
</TD></TR><TR><TD VALIGN=top><A HREF="#DOC.218.11"> <IMG BORDER=0 SRC=icon1.gif></A> bool </TD><TD><B>contains</B> (const T &e) const <br>
40
<I> return if list contains e.</I>
41
</TD></TR><TR><TD VALIGN=top><A HREF="#DOC.218.12"> <IMG BORDER=0 SRC=icon1.gif></A> void </TD><TD><B>remove</B> (const T &e)<br>
42
<I> remove all elements equal to e.</I>
43
</TD></TR><TR><TD VALIGN=top><A HREF="#DOC.218.13"> <IMG BORDER=0 SRC=icon1.gif></A> void </TD><TD><B>removei</B> (const unsigned i = 0)<br>
44
<I> removes i+1'th element (0 <= i <= count()-1).</I>
45
</TD></TR><TR><TD VALIGN=top><A HREF="#DOC.218.14"> <IMG BORDER=0 SRC=icon1.gif></A> bool </TD><TD><B>removecur</B> ()<br>
46
<I> removes current element and advances the current to the next one.</I>
47
</TD></TR><TR><TD VALIGN=top><A HREF="#DOC.218.15"> <IMG BORDER=0 SRC=icon1.gif></A> void </TD><TD><B>empty</B> ()<br>
48
<I> removes all elements from list.</I>
49
</TD></TR><TR><TD VALIGN=top><A HREF="#DOC.218.16"> <IMG BORDER=0 SRC=icon1.gif></A> virtual void </TD><TD><B>clear</B> ()<br>
50
<I> removes all elements + free elements (which should be pointers).</I>
51
</TD></TR><TR><TD VALIGN=top><A HREF="#DOC.218.17"> <IMG BORDER=0 SRC=icon1.gif></A> T& </TD><TD><B>operator[] </B> (const unsigned i) const <br>
52
<I> returns ref. to i+1'th element, like array index (e.g. e = l[5]).</I>
53
</TD></TR><TR><TD VALIGN=top><A HREF="#DOC.218.18"> <IMG BORDER=0 SRC=icon1.gif></A> T& </TD><TD><B>elem</B> (const unsigned i) const <br>
54
<I> same as [] (different syntax).</I>
55
</TD></TR><TR><TD VALIGN=top><A HREF="#DOC.218.19"> <IMG BORDER=0 SRC=icon1.gif></A> unsigned </TD><TD><B>count</B> () const <br>
56
<I> returns number of elements in list.</I>
57
</TD></TR><TR><TD VALIGN=top><A HREF="#DOC.218.20"> <IMG BORDER=0 SRC=icon1.gif></A> void </TD><TD><B>replace</B> (const T &old, const T &fresh)<br>
58
<I> replaces all elements equal to old by new.</I>
59
</TD></TR><TR><TD VALIGN=top><A HREF="#DOC.218.21"> <IMG BORDER=0 SRC=icon1.gif></A> void </TD><TD><B>sort</B> (int (*cmp)(T, T))<br>
60
<I> sort all elements according to cmp function.</I>
61
</TD></TR><TR><TD VALIGN=top><A HREF="#DOC.218.22"> <IMG BORDER=0 SRC=icon1.gif></A> void </TD><TD><B>reverse</B> ()<br>
62
<I> reverse all elements in list.</I>
63
</TD></TR><TR><TD VALIGN=top><A HREF="#DOC.218.23"> <IMG BORDER=0 SRC=icon1.gif></A> int </TD><TD><B>first</B> ()<br>
64
<I> return if there is a first element + sets current to first element. </I>
65
</TD></TR><TR><TD VALIGN=top><A HREF="#DOC.218.24"> <IMG BORDER=0 SRC=icon1.gif></A> int </TD><TD><B>last</B> ()<br>
66
<I> sets current to last element + returns if there is a last element.</I>
67
</TD></TR><TR><TD VALIGN=top><A HREF="#DOC.218.25"> <IMG BORDER=0 SRC=icon1.gif></A> int </TD><TD><B>next</B> ()<br>
68
<I> sets current to next element + returns if there is a next element.</I>
69
</TD></TR><TR><TD VALIGN=top><A HREF="#DOC.218.26"> <IMG BORDER=0 SRC=icon1.gif></A> int </TD><TD><B>prev</B> ()<br>
70
<I> sets current to prev. element + returns if there is a prev. element.</I>
71
</TD></TR><TR><TD VALIGN=top><A HREF="#DOC.218.27"> <IMG BORDER=0 SRC=icon1.gif></A> T& </TD><TD><B>cur</B> () const <br>
72
<I> returns current element (Check first with 'done'!)</I>
73
</TD></TR><TR><TD VALIGN=top><A HREF="#DOC.218.28"> <IMG BORDER=0 SRC=icon1.gif></A> bool </TD><TD><B>done</B> () const <br>
74
<I> returns if current is out of list.</I>
75
</TD></TR><TR><TD VALIGN=top><A HREF="#DOC.218.29"> <IMG BORDER=0 SRC=icon1.gif></A> int </TD><TD><B>setcur</B> (const T &)<br>
76
<I> returns if T is in list + sets current to that element. </I>
77
</TD></TR></TABLE></DL>
80
<h2> Documentation </h2>
82
lists of objects of arbitrary type T.
89
<DT><IMG BORDER=0 SRC=icon2.gif><TT><B> List()</B></TT>
90
<DD> create an empty list.
94
<DT><IMG BORDER=0 SRC=icon2.gif><TT><B> virtual ~List()</B></TT>
95
<DD> delete entire list (but not the elements of the list).
99
<DT><IMG BORDER=0 SRC=icon2.gif><TT><B> List(const <!2><A HREF="List.html#DOC.218.1">List</A><T> &l)</B></TT>
100
<DD> create list, initialized by elements of l.
103
<A NAME ="DOC.218.4">
104
<DT><IMG BORDER=0 SRC=icon2.gif><TT><B> <!2><A HREF="List.html#DOC.218.1">List</A> <T> & operator=(const <!2><A HREF="List.html#DOC.218.1">List</A><T> &l)</B></TT>
105
<DD> copy list into an other, elements are copied too (e.g. l2 = l1).
108
<A NAME ="DOC.218.5">
109
<DT><IMG BORDER=0 SRC=icon2.gif><TT><B> void add(const T &e)</B></TT>
110
<DD> add e to the end of the list.
113
<A NAME ="DOC.218.6">
114
<DT><IMG BORDER=0 SRC=icon2.gif><TT><B> void insert(const T &e, const unsigned i)</B></TT>
115
<DD> insert e to i+1'th position of the list.
118
<A NAME ="DOC.218.7">
119
<DT><IMG BORDER=0 SRC=icon2.gif><TT><B> int find(const T &e) const </B></TT>
120
<DD> return index of first element equal to e, if not found, return -1.
123
<A NAME ="DOC.218.8">
124
<DT><IMG BORDER=0 SRC=icon2.gif><TT><B> bool isSet() const </B></TT>
125
<DD> return list is set
128
<A NAME ="DOC.218.9">
129
<DT><IMG BORDER=0 SRC=icon2.gif><TT><B> int count(const T &e) const </B></TT>
130
<DD> count the number of times e occurs in the list
133
<A NAME ="DOC.218.10">
134
<DT><IMG BORDER=0 SRC=icon2.gif><TT><B> bool contains(<!2><A HREF="List.html#DOC.218.1">List</A><T> *l) const </B></TT>
135
<DD> return if list contains list l
138
<A NAME ="DOC.218.11">
139
<DT><IMG BORDER=0 SRC=icon2.gif><TT><B> bool contains(const T &e) const </B></TT>
140
<DD> return if list contains e.
143
<A NAME ="DOC.218.12">
144
<DT><IMG BORDER=0 SRC=icon2.gif><TT><B> void remove(const T &e)</B></TT>
145
<DD> remove all elements equal to e.
148
<A NAME ="DOC.218.13">
149
<DT><IMG BORDER=0 SRC=icon2.gif><TT><B> void removei(const unsigned i = 0)</B></TT>
150
<DD> removes i+1'th element (0 <= i <= count()-1).
153
<A NAME ="DOC.218.14">
154
<DT><IMG BORDER=0 SRC=icon2.gif><TT><B> bool removecur()</B></TT>
155
<DD> removes current element and advances the current to the next one.
158
<A NAME ="DOC.218.15">
159
<DT><IMG BORDER=0 SRC=icon2.gif><TT><B> void empty()</B></TT>
160
<DD> removes all elements from list.
163
<A NAME ="DOC.218.16">
164
<DT><IMG BORDER=0 SRC=icon2.gif><TT><B> virtual void clear()</B></TT>
165
<DD> removes all elements + free elements (which should be pointers).
167
<A NAME="operator[] ">
168
<A NAME ="DOC.218.17">
169
<DT><IMG BORDER=0 SRC=icon2.gif><TT><B> T& operator[] (const unsigned i) const </B></TT>
170
<DD> returns ref. to i+1'th element, like array index (e.g. e = l[5]).
173
<A NAME ="DOC.218.18">
174
<DT><IMG BORDER=0 SRC=icon2.gif><TT><B> T& elem(const unsigned i) const </B></TT>
175
<DD> same as [] (different syntax).
178
<A NAME ="DOC.218.19">
179
<DT><IMG BORDER=0 SRC=icon2.gif><TT><B> unsigned count() const </B></TT>
180
<DD> returns number of elements in list.
183
<A NAME ="DOC.218.20">
184
<DT><IMG BORDER=0 SRC=icon2.gif><TT><B> void replace(const T &old, const T &fresh)</B></TT>
185
<DD> replaces all elements equal to old by new.
188
<A NAME ="DOC.218.21">
189
<DT><IMG BORDER=0 SRC=icon2.gif><TT><B> void sort(int (*cmp)(T, T))</B></TT>
190
<DD> sort all elements according to cmp function.
193
<A NAME ="DOC.218.22">
194
<DT><IMG BORDER=0 SRC=icon2.gif><TT><B> void reverse()</B></TT>
195
<DD> reverse all elements in list.
198
<A NAME ="DOC.218.23">
199
<DT><IMG BORDER=0 SRC=icon2.gif><TT><B> int first()</B></TT>
200
<DD> return if there is a first element + sets current to first element.
203
<A NAME ="DOC.218.24">
204
<DT><IMG BORDER=0 SRC=icon2.gif><TT><B> int last()</B></TT>
205
<DD> sets current to last element + returns if there is a last element.
208
<A NAME ="DOC.218.25">
209
<DT><IMG BORDER=0 SRC=icon2.gif><TT><B> int next()</B></TT>
210
<DD> sets current to next element + returns if there is a next element.
213
<A NAME ="DOC.218.26">
214
<DT><IMG BORDER=0 SRC=icon2.gif><TT><B> int prev()</B></TT>
215
<DD> sets current to prev. element + returns if there is a prev. element.
218
<A NAME ="DOC.218.27">
219
<DT><IMG BORDER=0 SRC=icon2.gif><TT><B> T& cur() const </B></TT>
220
<DD> returns current element (Check first with 'done'!)
223
<A NAME ="DOC.218.28">
224
<DT><IMG BORDER=0 SRC=icon2.gif><TT><B> bool done() const </B></TT>
225
<DD> returns if current is out of list.
228
<A NAME ="DOC.218.29">
229
<DT><IMG BORDER=0 SRC=icon2.gif><TT><B> int setcur(const T &)</B></TT>
230
<DD> returns if T is in list + sets current to that element.
233
<DL><DT><B>Direct child classes:
234
</B><DD><A HREF="Subjects.html"> Subjects </A><br>
235
<A HREF="Shapes.html"> Shapes </A><br>
236
<A HREF="Properties.html"> Properties </A><br>
237
<A HREF="AssocList.html"> AssocList </A><br>
239
<DL></DL><P><I><A HREF="aindex.html"> alphabetic index</A></I> <I><A HREF="HIER.html"> hierarchy of classes</A></I><P><hr>
240
<A HREF="http://www.zib.de/Visual/software/doc++/index.html"><IMG BORDER=0 ALIGN=RIGHT SRC=logo.gif></A>
241
<P Align=Center><I>this page has been generated automatically by doc++</I>
242
<P Align=Center><I>(c)opyright by <A HREF="http://www.zib.de/zoeckler/"> Malte Zöckler</A>, <A HREF="mailto:wunderling@zib.de"> Roland Wunderling </A><br>contact: <A HREF="mailto:doc++@zib.de"> doc++@zib.de</a></I>