-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlibraryHead.hpp
86 lines (75 loc) · 2.04 KB
/
libraryHead.hpp
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
#include <iostream>
#include <vector>
#include <fstream>
#include "materialHead.hpp"
class library
{
public:
library();
~library();
// functions accessible to all users
// search materials - by materials' ids
materials *search_by_id(std::string id);
// search materials - by materials' names
materials *search_by_name(std::string name);
// search materials - by borrowers' ids
materials *search_by_b_id(std::string id);
void print_all_materials();
void set_state_list_borrow(materials *m);
void set_state_list_return(materials *m);
unsigned int get_user_num();
void add_new_user(std::string id);
bool user_exists(std::string id);
protected:
materials_list m_l;
private:
std::vector<std::string> u_list;
unsigned int user_num;
};
class borrower : public library
{
public:
void borrow_book(materials *m);
void return_book(materials *m);
virtual bool reach_max() = 0;
void borrowed_list();
std::string get_name();
protected:
std::string b_name;
std::string b_id;
unsigned int b_num_borrowed;
};
class student : public borrower
{
public:
student(std::string name, unsigned int identity);
~student();
virtual bool reach_max();
private:
bool max;
};
class staff : public borrower
{
public:
staff(std::string name, unsigned int identity);
~staff();
virtual bool reach_max();
private:
bool max;
};
class admin : public library
{
public:
admin();
~admin();
bool is_admin(std::string id, std::string password);
// functions that are open to admin only
// add new material at the end of the materials list
void insert(materials *new_m);
// remove material from the library by id
void removeId(std::string id);
private:
unsigned int user_num;
std::string a_id;
std::string a_password;
};