-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlibrary.hpp
78 lines (60 loc) · 3.52 KB
/
library.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
#ifndef LIBRARY_HPP
#define LIBRARY_HPP
#include "book.hpp"
#include "student.hpp"
#include "teacher.hpp"
#include "libraryuser.hpp"
#include <iostream>
#include <string>
using namespace std;
class Teacher;
class Library{
vector<Book*> book_list;
vector<bool> is_borrowed;
public:
Library();
//default constructor to initialize book list attribute to empty vector (empty library)
Library(vector<Book*> input_vector);
//paramaterized constructor to initialize stores the Book values from input vector into the book list attribute
bool insert_books(Book* input_book);
//PURPOSE: Insert books into the library but first check if inputted book already exists in the library
//INPUT: Input book to insert (Book instance passed in by value)
//OUTPUT: true if book is inserted, false if book is rejected
bool insert_books(string title = "N/A", string authors = "N/A", string genre = "N/A", string dop = "N/A");
//PURPOSE: Insert books into the library but first check if inputted book already exists in the library
//INPUT: String of title, author and date of publication of input book
//OUTPUT: true if book is inserted, false if book is rejected
bool remove_books(Book* input_book);
//PURPOSE: Remove books from the library but first check if inputted book exists in the library to be removed
//INPUT: Input book to remove (of type book)
//OUTPUT: True if removal succeeds, false if removal rejected
bool remove_books(string title = "N/A", string authors = "N/A", string genre = "N/A", string dop = "N/A");
//PURPOSE: Remove books from the library but first check if inputted book exists in the library to be removed
//INPUT: String of title, author and date of publication of input book
//OUTPUT: True if removal succeeds, false if removal is rejected
void advanced_search(string title_input = "", string author_input = "", string genre_input = "");
//PURPOSE: Search for a book in the library based on substrings of attributes
//INPUT: Title, author and genre substrings (can input one, two or all of parameters)
//OUTPUT: none
void borrow_book(Student& user, string title, string genre);
//PURPOSE: Allows student to borrow a book with the desired title from library and checks if the genre of that book is acceptable for them to borrow
//INPUT: student that will borrow the book, title of book to borrow, and genre of book to borrow
//OUTPUT: none
void borrow_book(Teacher& user, string title, string genre);
//PURPOSE: Allows teacher to borrow a book with the desired title from library and checks if the genre of that book is acceptable for them to borrow
//INPUT: teacher that will borrow the book, title of book to borrow, and genre of book to borrow
//OUTPUT: none
void return_book(LibraryUser& user, string title);
//PURPOSE: allows a user to return a book to the library, checks if book is actually borrowed to be returned and updates the status of that book to not borrowed when return succeeds
//INPUT: user (either student or teacher) that is returning the book and title of book to return
//OUTPUT: none
void print();
//PURPOSE: Print a list of the books stored in the library
//INPUT: None
//OUTPUT: Printed list of the books stored in the library
Book* find_book_by_title(string title);
//PURPOSE: Find a book in the library only by its title
//INPUT: title of book to be found in the library
//OUTPUT: pointer to the book with the found title
};
#endif