-
Notifications
You must be signed in to change notification settings - Fork 0
/
Document.cpp
52 lines (44 loc) · 1006 Bytes
/
Document.cpp
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
#include "Document.h"
using namespace std;
/* default constructor that will set no elements, this
* was needed in the previous assignement"
*/
Document::Document()
{
name = "";
priority = PRIORITY_3;
}
Document::Document(string in_name, string in_priority)
{
name = in_name;
priority = convert_priority(in_priority);
}
ostream& operator<<(ostream &os, Document &document)
{
os << "document" << endl;
os << "name: " << document.name << endl;
os << "priority: " << document.priority + 1 << endl;
return os;
}
/* priorities are enumerated -- switch statements?
*/
Priority Document::convert_priority(string str_priority)
{
if (str_priority.compare("1") == 0) {
return PRIORITY_1;
} else if (str_priority.compare("2") == 0) {
return PRIORITY_2;
} else if (str_priority.compare("3") == 0) {
return PRIORITY_3;
} else {
return PRIORITY_3;
}
}
Priority Document::get_priority()
{
return priority;
}
string Document::get_name()
{
return name;
}