-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathtextbook.cpp
More file actions
42 lines (34 loc) · 797 Bytes
/
textbook.cpp
File metadata and controls
42 lines (34 loc) · 797 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
#include "textbook.h"
Textbook::Textbook()
{
textbookName = "";
}
QString Textbook::getTextbookName(){
return textbookName;
}
bool Textbook::chapterExists(Chapter *chapter){
return chapters.contains(chapter);
}
void Textbook::setTextbookName(QString name){
textbookName = name;
}
QVector<Chapter*> Textbook::getChaptersList(){
return chapters;
}
Chapter* Textbook::getChapter(int index){
return chapters.at(index);
}
void Textbook::addChapter(Chapter* chapter){
chapters.append(chapter);
}
void Textbook::removeChapter(int index){
chapters.remove(index);
}
int Textbook::findIndex(QString chapter){
for(int i = 0; i < chapters.size(); i++){
if(chapters.at(i)->getChapterName() == chapter){
return i;
}
}
return -1;
}