-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdlist.h
More file actions
executable file
·59 lines (53 loc) · 2.4 KB
/
dlist.h
File metadata and controls
executable file
·59 lines (53 loc) · 2.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
//
// dlist.h
// Project 3 Spring 14
//
// Created by Ibrahima Niang on 4/18/14.
// Copyright (c) 2014 Ibrahima Niang. All rights reserved.
//
#ifndef __Project_3_Spring_14__dlist__
#define __Project_3_Spring_14__dlist__
#include <iostream>
using namespace std;
template <class xtype>
struct node
{
xtype info;
node *next;
node *back;
};
template <class xtype>
class dlist
{
private:
node<xtype> *head; //head of the link list
node<xtype> *last; // tail of the likn list
node<xtype> *temp; // a pointer used to step through the list
node<xtype> *current; // // another pointer used to step through the list needed for the LargeInt class
int length; //length of the list
public:
dlist(); // constructor
~dlist(); // destructor
dlist ( const dlist<xtype> & other); //copy constructor
dlist<xtype>& operator= ( const dlist<xtype> & other); ///assignment operator overloading
void copyList( const dlist<xtype> & other); // copy function called by the copy constructor and the assignment operator overloading
bool isFull(); // return true if the list is full else return false
bool isEmpty(); // return true if the list is empty else return false
void makeEmpty(); // function to destroy the list called by the destructor
void insertFront ( xtype ); // insert a the front of the list
void insertBack ( xtype ); // insert a the back of the list
int getlength(); //return the length of the list
xtype getCurrentInfo(); // return the data hold by *current
xtype getTempInfo(); // return the data hold by *Temp
void resetTempHead(); // will set *Temp to head if needed
void resetTempLast(); // will set *Temp to last if needed
void backIterator(); //iterator-based interface for the user from back to front using temp
void frontIterator(); //iterator-based interface for the user from front to back using temp
void resetCurrent(); // will set *Current to temp
void currentBackIterator(); //iterator-based interface for the user from back to front using current
void currentFrontIterator(); //iterator-based interface for the user from front to back using current
void printList (); // print the list
void deleteItem(xtype); // delete item in the list
bool searchItem(xtype); // look the item and return true if find else return true
};
#endif /* defined(__Project_3_Spring_14__dlist__) */