Repository navigation
Expand file tree
/
Copy pathlibrary.cpp
More file actions
92 lines (77 loc) · 1.86 KB
/
Copy pathlibrary.cpp
File metadata and controls
92 lines (77 loc) · 1.86 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
84
85
86
87
88
89
90
91
92
#include "library.h"
#include <QDebug>
Library::Library()
{
}
void Library::addCaseBook(BookCase *bookcase)
{
arrCase.push_back(bookcase);
}
bool Library::addBook(uint index, Book *book)
{
if (arrCase[index]->getCaseBookAccommodation() - arrCase[index]->getSizeOfCaseArr() != 0)
{
arrCase[index]->addBook(book);
return true;
}
return false;
}
QString Library::displayBooksOfCase(int index)
{
foreach (const auto &var, arrCase)
{
if (var->getCaseBookNumber() == index)
{
return var->displayBooks();
}
}
return "Данного шкафа не существует";
}
QString Library::deleteBook(QString nameOfBook, uint index)
{
QString result;
return result = arrCase[index]->deleteBook(nameOfBook);
}
void Library::delBookFromTable(QString &bookName, int &caseNumber/* QString &bookAuthor*/)
{
//qDebug() << arrCase.size();
for(auto &var: arrCase)
{
if(var->getCaseBookNumber()==caseNumber)
{
var->deleteBook(bookName);
}
}
}
QString Library::deleteCasebook(uint index)
{
if((index <= sizeof(arrCase)) && (arrCase.size()!=0))
{
auto iter = arrCase.cbegin();
arrCase.erase(iter + (int)index);
return "Шкаф удален";
}
else
{
return "Шкаф не найден";
}
}
vectCase Library::getArrCase() const
{
return arrCase;
}
//-----------------------------------
/*
void Library::writeBooksMethod(QVector<QString> &kj)
{
kj.push_back(" v");
qDebug() << "tttttttttttttttttt";
for (auto& ht : arrCase)
{
qDebug() << "fffffffffffffffff";
qDebug() << ht;
kj.push_back(" b");
}
kj.push_back(" h");
}
*/