Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
BitchX
GitHub Repository: BitchX/BitchX1.3
Path: blob/master/dll/europa/cse476/list.h
1074 views
1
#ifndef _LIST_H_
2
#define _LIST_H_
3
4
#include "gnode.h"
5
6
struct listNode;
7
typedef struct listNode {
8
char *item;
9
List *itemList;
10
genericNode *itemNode;
11
12
listNode *nextPtr; // pointer to next option
13
listNode *prevPtr;
14
};
15
16
class List {
17
public:
18
List();
19
~List();
20
void InsertBefore(char *item);
21
void InsertBefore(List *item);
22
void InsertBefore(genericNode *item);
23
void InsertAfter(char *item);
24
void InsertAfter(List *item);
25
void InsertAfter(genericNode *item);
26
27
// returns true if everything is good, false if operation failed
28
bool GoTop(void); // GOOD
29
bool GoNext(void); // GOOD
30
bool GoPrev(void);
31
bool GoItem(int n);
32
bool empty(void); // GOOD
33
int length(void); // GOOD
34
35
char *currItem(void);
36
List *currItemList(void);
37
genericNode *currItemNode(void);
38
void Print(void);
39
40
friend List *MakeFeatList(char *text);
41
42
friend List *makeFeatureList(char *text); // GOOD
43
friend ostream &operator<<(ostream &out_file, const List &l); // GOOD
44
friend List *substitute(List *old, List *assign);
45
46
private:
47
listNode *rootPtr;
48
listNode *currPtr;
49
};
50
51
List *MakeList(char *text);
52
53
#endif
54
55