-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathShow.cpp
More file actions
83 lines (72 loc) · 1.22 KB
/
Show.cpp
File metadata and controls
83 lines (72 loc) · 1.22 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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#include<iostream>
#include <sstream>
#include <string>
#include "Show.h"
using std::ostream;
using std::string;
using std::stringstream;
string pretty(showtype t) {
switch(t) {
case COMMENTARY:
return "COMMENTARY";
break;
case EPISODE:
return "EPISODE";
break;
case MOVIE:
return "MOVIE";
break;
case SPECIAL:
return "SPECIAL";
break;
default:
return "ERROR";
break;
}
}
showtype Show::gettype(const string& t) {
if(t == "COMMENTARY") {
return COMMENTARY;
}
else if(t == "EPISODE") {
return EPISODE;
}
else if(t == "MOVIE") {
return MOVIE;
}
else if(t == "SPECIAL") {
return SPECIAL;
}
return EPISODE;
}
Show::Show(const Show& other) {
name = other.name;
file = other.file;
type = other.type;
watched = other.watched;
}
Show::Show(Show& other) {
name = other.name;
file = other.file;
type = other.type;
watched = other.watched;
}
string Show::print() {
stringstream out;
out << name;
return out.str();
}
void Show::printdetail(ostream& o) {
o << watched << ' ' << pretty(type) << '\n' << name << '\n' << file;
}
void Show::watch() {
++watched;
}
void Show::unwatch() {
if (watched > 0) {
--watched;
}
}
const unsigned int Show::getwatched() {
return watched;
}