Rudiments
listcollection.h
1// Copyright (c) 1999-2018 David Muse
2// See the COPYING file for more information.
3
4#ifndef RUDIMENTS_LISTCOLLECTION_H
5#define RUDIMENTS_LISTCOLLECTION_H
6
7#include <rudiments/nodecollection.h>
8
11template <class valuetype>
12class listnode : public nodecollectionnode<valuetype> {
13 public:
15 virtual void setValue(valuetype value)=0;
16
18 virtual valuetype getValue()=0;
19
21 virtual valuetype &getReference()=0;
22
26
30
31 #include <rudiments/private/listnode.h>
32};
33
36template <class valuetype>
37class listcollection : public nodecollection<valuetype> {
38 public:
41
45
47 virtual const char *getType();
48
51 virtual void prepend(valuetype value)=0;
52
55 virtual void prepend(valuetype *values, uint64_t count);
56
59 virtual void prepend(listnode<valuetype> *node)=0;
60
63 virtual void append(valuetype value)=0;
64
67 virtual void append(valuetype *values, uint64_t count);
68
71 virtual void append(listnode<valuetype> *node)=0;
72
76 valuetype value)=0;
77
81 virtual void insertBefore(listnode<valuetype> *node,
82 valuetype *values, uint64_t count);
83
87 listnode<valuetype> *newnode)=0;
88
91 virtual void insertAfter(listnode<valuetype> *node,
92 valuetype value)=0;
93
97 virtual void insertAfter(listnode<valuetype> *node,
98 valuetype *values, uint64_t count);
99
103 listnode<valuetype> *newnode)=0;
104
107 virtual void moveBefore(listnode<valuetype> *node,
108 listnode<valuetype> *nodetomove)=0;
109
112 virtual void moveAfter(listnode<valuetype> *node,
113 listnode<valuetype> *nodetomove)=0;
114
116 virtual void detach(listnode<valuetype> *node)=0;
117
128 virtual bool remove(valuetype value)=0;
129
140 virtual bool removeAll(valuetype value)=0;
141
153 virtual bool remove(listnode<valuetype> *node)=0;
154
157
162 listnode<valuetype> *node)=0;
163
166 virtual listnode<valuetype> *find(valuetype value)=0;
167
172 listnode<valuetype> *startnode,
173 valuetype value)=0;
174
188 virtual void sortInexpensively()=0;
189
204 virtual void sortQuickly()=0;
205
208 virtual ssize_t write();
209
211 virtual ssize_t write(output *out);
212
215 virtual ssize_t writeJson();
216
223 virtual ssize_t writeJson(bool indent);
224
227 virtual ssize_t writeJson(output *out);
228
235 virtual ssize_t writeJson(output *out, bool indent);
236};
237
238#include <rudiments/private/listcollectioninlines.h>
239
240#endif
Definition listcollection.h:37
virtual bool remove(listnode< valuetype > *node)=0
virtual void prepend(valuetype value)=0
virtual void append(listnode< valuetype > *node)=0
virtual ssize_t write()
Definition listcollectioninlines.h:57
virtual listnode< valuetype > * getFirst()=0
virtual listnode< valuetype > * find(listnode< valuetype > *startnode, valuetype value)=0
virtual void detach(listnode< valuetype > *node)=0
virtual void insertBefore(listnode< valuetype > *node, listnode< valuetype > *newnode)=0
virtual void insertBefore(listnode< valuetype > *node, valuetype value)=0
virtual bool remove(valuetype value)=0
virtual void prepend(listnode< valuetype > *node)=0
virtual void insertAfter(listnode< valuetype > *node, listnode< valuetype > *newnode)=0
virtual ssize_t writeJson()
Definition listcollectioninlines.h:69
virtual void insertAfter(listnode< valuetype > *node, valuetype value)=0
virtual void sortQuickly()=0
virtual void sortInexpensively()=0
virtual void moveAfter(listnode< valuetype > *node, listnode< valuetype > *nodetomove)=0
virtual void moveBefore(listnode< valuetype > *node, listnode< valuetype > *nodetomove)=0
virtual void append(valuetype value)=0
virtual bool removeAll(valuetype value)=0
listcollection()
Definition listcollectioninlines.h:6
virtual listnode< valuetype > * getNext(listnode< valuetype > *node)=0
virtual const char * getType()
Definition listcollectioninlines.h:17
virtual listnode< valuetype > * find(valuetype value)=0
Definition listcollection.h:12
virtual listnode< valuetype > * getPrevious()=0
virtual valuetype & getReference()=0
virtual void setValue(valuetype value)=0
virtual listnode< valuetype > * getNext()=0
virtual valuetype getValue()=0
Definition nodecollection.h:31
Definition nodecollection.h:12
Definition output.h:11