Rudiments
Main Page
Classes
include
rudiments
linkedlist.h
1
// Copyright (c) 2003 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
10
template
<
class
valuetype>
11
class
linkedlistnode
{
12
public
:
15
linkedlistnode
(valuetype value);
16
20
virtual
~linkedlistnode
();
21
23
void
setValue
(valuetype value);
24
26
valuetype
getValue
()
const
;
27
31
int32_t
compare
(valuetype value)
const
;
32
34
void
setPrevious
(
linkedlistnode<valuetype>
*previous);
35
37
void
setNext
(
linkedlistnode<valuetype>
*next);
38
40
linkedlistnode<valuetype>
*
getPrevious
();
41
43
linkedlistnode<valuetype>
*
getNext
();
44
46
void
print
()
const
;
47
48
#include <rudiments/private/linkedlistnode.h>
49
};
50
57
template
<
class
valuetype >
58
class
linkedlist
{
59
public
:
61
linkedlist
();
62
66
virtual
~linkedlist
();
67
70
void
append
(valuetype value);
71
74
void
append
(
linkedlistnode<valuetype>
*node);
75
80
bool
insert
(uint64_t index, valuetype value);
81
86
bool
insert
(uint64_t index,
linkedlistnode<valuetype>
*node);
87
91
bool
removeByIndex
(uint64_t index);
92
96
bool
removeByValue
(valuetype value);
97
101
bool
removeAllByValue
(valuetype value);
102
106
bool
removeNode
(
linkedlistnode<valuetype>
*node);
107
112
bool
setValueByIndex
(uint64_t index, valuetype value);
113
118
bool
getValueByIndex
(uint64_t index, valuetype *value);
119
121
uint64_t
getLength
()
const
;
122
124
linkedlistnode<valuetype>
*
getFirstNode
();
125
127
linkedlistnode<valuetype>
*
getLastNode
();
128
130
linkedlistnode<valuetype>
131
*
getNodeByIndex
(uint64_t index);
132
135
linkedlistnode<valuetype>
136
*
getNodeByValue
(valuetype value);
137
140
linkedlistnode<valuetype>
141
*
getNodeByValue
(
linkedlistnode<valuetype>
*startnode,
142
valuetype value);
143
147
void
clear
();
148
150
void
print
()
const
;
151
152
#include <rudiments/private/linkedlist.h>
153
};
154
155
156
// ideally I'd use typdefs for these but older compilers can't handle them
157
#define stringlistnode linkedlistnode< char * >
158
#define stringlist linkedlist< char * >
159
#define conststringlistnode linkedlistnode< const char * >
160
#define conststringlist linkedlist< const char * >
161
162
#include <rudiments/private/linkedlistinlines.h>
163
164
#endif
Generated on Fri Mar 7 2014 14:08:54 for Rudiments by
1.8.3.1