Rudiments
linkedlist.h
1// Copyright (c) 1999-2018 David Muse
2// See the COPYING file for more information.
3
4#ifndef RUDIMENTS_LINKEDLIST_H
5#define RUDIMENTS_LINKEDLIST_H
6
7#include <rudiments/private/linkedlistincludes.h>
8
10template <class valuetype>
11class linkedlistnode : public listnode<valuetype> {
12 public:
15 linkedlistnode(valuetype value);
16
19
21 void setValue(valuetype value);
22
24 valuetype getValue();
25
27 valuetype &getReference();
28
32
36
37 #include <rudiments/private/linkedlistnode.h>
38};
39
46template <class valuetype>
47class linkedlist : public listcollection<valuetype> {
48 public:
50 linkedlist();
51
55
59
64
69
77
80 void prepend(valuetype value);
81
84 void prepend(listnode<valuetype> *node);
85
88 void append(valuetype value);
89
92 void append(listnode<valuetype> *node);
93
97 valuetype value);
98
102 listnode<valuetype> *newnode);
103
107 valuetype value);
108
112 listnode<valuetype> *newnode);
113
117 listnode<valuetype> *nodetomove);
118
122 listnode<valuetype> *nodetomove);
123
125 void detach(listnode<valuetype> *node);
126
137 bool remove(valuetype value);
138
149 bool removeAll(valuetype value);
150
162 bool remove(listnode<valuetype> *node);
163
165 uint64_t getCount();
166
169
172
177 listnode<valuetype> *node);
178
183 listnode<valuetype> *node);
184
187 listnode<valuetype> *find(valuetype value);
188
193 valuetype value);
194
208 void sortInexpensively();
209
224 void sortQuickly();
225
233 bool clear();
234
235 #include <rudiments/private/linkedlist.h>
236};
237
238#include <rudiments/private/linkedlistinlines.h>
239
240#endif
Definition linkedlist.h:47
listnode< valuetype > * getPrevious(listnode< valuetype > *node)
Definition linkedlistinlines.h:316
listnode< valuetype > * find(valuetype value)
Definition linkedlistinlines.h:330
bool clear()
Definition linkedlistinlines.h:606
void insertBefore(listnode< valuetype > *node, valuetype value)
Definition linkedlistinlines.h:146
void moveAfter(listnode< valuetype > *node, listnode< valuetype > *nodetomove)
Definition linkedlistinlines.h:201
bool removeAll(valuetype value)
Definition linkedlistinlines.h:254
void sortQuickly()
Definition linkedlistinlines.h:465
void detach(listnode< valuetype > *node)
Definition linkedlistinlines.h:226
uint64_t getCount()
Definition linkedlistinlines.h:298
void insertAfter(listnode< valuetype > *node, valuetype value)
Definition linkedlistinlines.h:170
listnode< valuetype > * getFirst()
Definition linkedlistinlines.h:304
void sortInexpensively()
Definition linkedlistinlines.h:351
void append(valuetype value)
Definition linkedlistinlines.h:124
linkedlist< valuetype > & operator=(linkedlist< valuetype > &a)
Definition linkedlistinlines.h:57
void prepend(valuetype value)
Definition linkedlistinlines.h:102
listnode< valuetype > * getLast()
Definition linkedlistinlines.h:310
void moveBefore(listnode< valuetype > *node, listnode< valuetype > *nodetomove)
Definition linkedlistinlines.h:194
linkedlist()
Definition linkedlistinlines.h:9
~linkedlist()
Definition linkedlistinlines.h:96
listnode< valuetype > * getNext(listnode< valuetype > *node)
Definition linkedlistinlines.h:323
bool remove(valuetype value)
Definition linkedlistinlines.h:247
Definition linkedlist.h:11
listnode< valuetype > * getPrevious()
Definition linkedlistinlines.h:658
valuetype getValue()
Definition linkedlistinlines.h:646
void setValue(valuetype value)
Definition linkedlistinlines.h:640
listnode< valuetype > * getNext()
Definition linkedlistinlines.h:664
~linkedlistnode()
Definition linkedlistinlines.h:635
linkedlistnode(valuetype value)
Definition linkedlistinlines.h:626
valuetype & getReference()
Definition linkedlistinlines.h:652
Definition listcollection.h:37
Definition listcollection.h:12
Definition nodecollection.h:31