-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathreturnCommand.h
63 lines (48 loc) · 1.4 KB
/
returnCommand.h
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
61
62
63
/**
* ReturnCommand.h
* ReturnCommand is a child of Command class.
* Return (denoted as ‘R’): (stock + 1) for each item returned
*
* @author Olga Kuriatnyk
*/
#ifndef RETURNCOMMAND_H
#define RETURNCOMMAND_H
#include "command.h"
#include "customerContainer.h"
#include "inventory.h"
#include "itemKey.h"
using namespace std;
// return command is a child class of Command
class ReturnCommand : public Command {
public:
// constructor
explicit ReturnCommand(const char &commandType);
// destructor
~ReturnCommand() override;
// copy constructor not allowed
ReturnCommand(const ReturnCommand &c) = delete;
// move not allowed
ReturnCommand(ReturnCommand &&other) = delete;
// assignment not allowed
ReturnCommand &operator=(const ReturnCommand &other) = delete;
// move assignment not allowed
ReturnCommand &operator=(ReturnCommand &&other) = delete;
// read the command string load into customerID and key
void read(istream &is) override;
// process return command
void process() override;
private:
int customerID;
char mediaType, movieType;
ItemKey key;
};
class ReturnCommandFactory : public CommandFactory {
public:
// register return command Factory
ReturnCommandFactory() { Command::registerType('R', this); }
// create new inventory command
Command *create(const char &commandType) const override {
return new ReturnCommand(commandType);
}
};
#endif