-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcommand.h
More file actions
60 lines (46 loc) · 1.52 KB
/
Copy pathcommand.h
File metadata and controls
60 lines (46 loc) · 1.52 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
60
// Parent class to child command classes
// Handles the commands from the file. Manages subclasses using input command
// characters. Builds command objects from data file and calls execute.
//
// Assumptions:
// -- Data file format is correct
//
// Implementation:
// -- Has access to Library class through a reference to a pointer
// -- Builds and checks command type and values
//
//---------------------------------------------------------------------------
#ifndef COMMAND_H
#define COMMAND_H
class Library;
class Patron;
#include "item.h"
class Command {
public:
//Construct a new Command object. Default constructor.
Command();
//Destroy the Return object and free memory.
virtual ~Command();
// Handles the execution of object type on stored data members
virtual bool execute() = 0;
// Handles the display of command object
virtual void display() = 0;
// creates and returns a new command object pointer
virtual Command *create() = 0;
// builds a command from data file
virtual bool buildCommand(istream &inFile, Library *&library) = 0;
// gets and returns the Item object associated with command
Item *getItem();
// gets and returns the char code for command type
char getCommandType();
protected:
// pointer to patron associated with command
Patron *patron_;
// pointer to item assocaited with command
Item *item_;
// command type code
char commType_;
//// pointer to library associated with command
Library *libraryPtr_;
};
#endif