-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdisplay.cpp
More file actions
55 lines (47 loc) · 1.54 KB
/
Copy pathdisplay.cpp
File metadata and controls
55 lines (47 loc) · 1.54 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
//---------------------------------------------------------------------------
// display.cpp
//---------------------------------------------------------------------------
// Subclass of command.
// Displays the contents of the library.
//
// Assumptions:
// -- Will display all items stored in the library
// -- will only be called on a valid library object
//
// Implementation:
// -- calls display on library object
//---------------------------------------------------------------------------
#include "display.h"
#include "Library.h"
//---------------------------------------------------------------------------
// constructor
Display::Display() {
commType_ = 'D';
item_ = nullptr;
patron_ = nullptr;
libraryPtr_ = nullptr;
}
//---------------------------------------------------------------------------
// destructor
Display::~Display() {}
//---------------------------------------------------------------------------
// buildCommand
bool Display::buildCommand(istream &inStream, Library *&library) {
libraryPtr_ = library;
return true;
}
//---------------------------------------------------------------------------
// execute
bool Display::execute() {
if (libraryPtr_ != nullptr) {
libraryPtr_->displayItems();
return true;
}
return false;
}
//---------------------------------------------------------------------------
// display
void Display::display() { execute(); }
//---------------------------------------------------------------------------
// create
Command *Display::create() { return new Display(); }