forked from tmont004/Virtual-Library-Management-System
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLibrarySystem.h
More file actions
81 lines (62 loc) · 1.92 KB
/
Copy pathLibrarySystem.h
File metadata and controls
81 lines (62 loc) · 1.92 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
#ifndef LIBRARYSYSTEM_H
#define LIBRARYSYSTEM_H
#include <iostream>
#include <unordered_map>
#include <queue>
#include "user_system.hpp"
#include "Book.h"
#include "bookdatabase.h" // Include the BookDatabase header
#include "json.hpp"
using namespace std;
using json = nlohmann::json;
// LibrarySystem class definition
class LibrarySystem {
public:
// Constructor to initialize the userInfo
LibrarySystem(const UserInfo& userInfo);
// Method to run the library system
void run();
// Methods for book management
void addBook();
void searchBooks();
void viewLibrary() const;
// Methods for user and admin management
bool operator==(const string &title) const;
void borrowBook(const Book& book);
void interactiveBorrowBook();
void viewBorrowedBooks() const;
void returnBook();
string getTitle() const;
// Setters for book details
void setTitle(const string &title);
void setAuthor(const string &author);
// void setCopiesInStock(int copies);
private:
// Data structures
unordered_map<string, User> users;
// queue<string> checkoutQueue;
BookDatabase bookDatabase; // Add an instance of BookDatabase
UserInfo userInfo; // Add an instance of UserInfo
void removeBook();
void updateBook();
void signalHandler(int signal);
// Methods for loading and saving data
void loadFromFile(const string &filename2);
void saveToFile();
// Methods for menu handling after login
void userOrAdminMenu();
void userMenu(const string& username);
void adminMenu();
void clearScreen();
void pressEnterToContinue();
// Additional member variables
string title;
string author;
int copiesInStock;
// Additional optional functions
int getNoOfCopiesInStock() const;
bool checkTitle(const string& title);
void updateInStock(int num);
void setCopiesInStock(int num);
};
#endif // LIBRARYSYSTEM_H