-
Notifications
You must be signed in to change notification settings - Fork 0
/
Test.cpp
53 lines (43 loc) · 1.22 KB
/
Test.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
51
52
53
/*
Name: Eric Rabiner
Email: [email protected]
Date: July 6, 2019
*/
#include "Test.h"
namespace sict {
Test::Test(const std::string& str) {
size_t pos = 0;
id = std::stoi(_utility.extractToken(str, pos));
courseId = std::stoi(_utility.extractToken(str, pos));
testWeight = std::stoi(_utility.extractToken(str, pos));
}
const unsigned int Test::getId() const {
return id;
}
const unsigned int Test::getCourseId() const {
return courseId;
}
const unsigned int Test::getTestWeight() const {
return testWeight;
}
void Test::display(std::ostream& os) const {
os << "Test Id: " << getId() << ", Course Id: " << getCourseId() << ", Test Weight: " << getTestWeight() << std::endl;
}
Test::Test(Test&& src) {
*this = std::move(src);
}
Test& Test::operator=(Test&& src) {
if (this != &src) {
id = src.id ;
courseId = src.courseId;
testWeight = src.testWeight;
src.id = 0;
src.courseId = 0;
src.testWeight = 0;
}
}
std::ostream& operator<<(std::ostream& os, const Test& obj) {
obj.display(os);
return os;
}
}