-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathborrowCommand.h
66 lines (50 loc) · 1.42 KB
/
borrowCommand.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
64
65
66
/**
* BorrowCommand.h
* BorrowCommand is a child of Command class.
* Borrow (denoted as ‘B’): (stock – 1) for each item borrowed.
*
* @author Olga Kuriatnyk
*/
#ifndef BORROWCOMMAND_H
#define BORROWCOMMAND_H
#include "command.h"
#include "customerContainer.h"
#include "inventory.h"
#include "itemKey.h"
#include <iostream>
#include <sstream>
#include <string>
using namespace std;
class BorrowCommand : public Command {
public:
// explicit constructor
explicit BorrowCommand(const char &commandType);
// destructor
~BorrowCommand() override;
// copy constructor not allowed
BorrowCommand(const BorrowCommand &c) = delete;
// move not allowed
BorrowCommand(BorrowCommand &&other) = delete;
// assignment not allowed
BorrowCommand &operator=(const BorrowCommand &other) = delete;
// move assignment not allowed
BorrowCommand &operator=(BorrowCommand &&other) = delete;
// read the command string load into customerID and key
void read(istream &is) override;
// process borrow command
void process() override;
private:
int customerID;
char mediaType, movieType;
ItemKey key;
};
class BorrowCommandFactory : public CommandFactory {
public:
// register the Borrow Command factory
BorrowCommandFactory() { Command::registerType('B', this); }
// create new borrow command
Command *create(const char &commandType) const override {
return new BorrowCommand(commandType);
}
};
#endif