-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathcourse.cpp
More file actions
45 lines (34 loc) · 783 Bytes
/
course.cpp
File metadata and controls
45 lines (34 loc) · 783 Bytes
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
#include "course.h"
#include <QString>
Course::Course()
{
courseName = "";
}
QString Course::getCourseName(){
return courseName;
}
QVector<Textbook*> Course::getTextbooks(){
return textbooks;
}
bool Course::textbookExist(Textbook* txtbook){
return textbooks.contains(txtbook);
}
Textbook* Course::getTextbook(int index){
return textbooks.at(index);
}
void Course::addTextbook(Textbook* textbook){
textbooks.append(textbook);
}
void Course::removeTextbook(int index){
textbooks.remove(index);
}
void Course::setCourseName(QString name){
courseName = name;
}
int Course::findIndex(QString name){
for(int i = 0; i < textbooks.size(); i++){
if(textbooks.at(i)->getTextbookName() == name)
return i;
}
return -1;
}