Library Management
Loading...
Searching...
No Matches
Book Class Reference

Represents a book in the library management system. More...

#include <Book.h>

Collaboration diagram for Book:
Collaboration graph

Public Member Functions

 Book ()
 Default constructor for the Book class. Initializes a book with default values.
 
 Book (string title, string author, string genre, short publicationYear, long long isbn, bool isAvailable)
 Parameterized constructor for the Book class. Initializes a book with the provided details.
 
const string & getTitle () const
 Get the title of the book.
 
void setTitle (const string &title)
 Set the title of the book.
 
const string & getAuthor () const
 Get the author of the book.
 
void setAuthor (const string &author)
 Set the author of the book.
 
const string & getGenre () const
 Get the genre of the book.
 
void setGenre (const string &genre)
 Set the genre of the book.
 
short getPublicationYear () const
 Get the publication year of the book.
 
void setPublicationYear (short publicationYear)
 Set the publication year of the book.
 
long long getIsbn () const
 Get the ISBN of the book.
 
void setIsbn (long long isbn)
 Set the ISBN of the book.
 
bool isAvailable () const
 Check if the book is available.
 
void setIsAvailable (bool isAvailable)
 Set the availability of the book.
 
bool operator< (const Book &b) const
 Compare two books based on their ISBN.
 
bool operator== (const Book &b) const
 Compare two books for equality based on their ISBN.
 
string getInfo () const
 Get detailed information about the book.
 
int getFine () const
 Get the fine associated with the book.
 
void setFine (int fine)
 Set the fine associated with the book.
 
int getDaysCheckedOut () const
 Get the number of days the book has been checked out.
 
void setDaysCheckedOut (int daysCheckedOut)
 Set the number of days the book has been checked out.
 

Private Attributes

string title
 The title of the book.
 
string author
 The author of the book.
 
string genre
 The genre of the book.
 
short publicationYear
 The year the book was published.
 
long long ISBN
 The ISBN of the book.
 
bool available
 Availability status of the book.
 
int fine
 The fine associated with the book.
 
int daysCheckedOut
 The number of days the book has been checked out.
 

Detailed Description

Represents a book in the library management system.

This class holds information about a book, including its title, author, genre, publication year, ISBN, availability status, fines, and days checked out. It provides methods to access and modify these properties, as well as to compare books and generate a detailed book description.

Constructor & Destructor Documentation

◆ Book()

Book::Book ( string title,
string author,
string genre,
short publicationYear,
long long isbn,
bool isAvailable )

Parameterized constructor for the Book class. Initializes a book with the provided details.

Parameters
titleTitle of the book.
authorAuthor of the book.
genreGenre of the book.
publicationYearYear the book was published.
isbnISBN of the book.
isAvailableAvailability of the book (true if available).

Member Function Documentation

◆ getAuthor()

const string & Book::getAuthor ( ) const
nodiscard

Get the author of the book.

Returns
The author of the book.

◆ getDaysCheckedOut()

int Book::getDaysCheckedOut ( ) const
nodiscard

Get the number of days the book has been checked out.

Returns
The number of days the book has been checked out.

◆ getFine()

int Book::getFine ( ) const
nodiscard

Get the fine associated with the book.

Returns
The fine amount for the book.

◆ getGenre()

const string & Book::getGenre ( ) const
nodiscard

Get the genre of the book.

Returns
The genre of the book.

◆ getInfo()

string Book::getInfo ( ) const
nodiscard

Get detailed information about the book.

Returns
A string containing the book's title, author, genre, ISBN, publication year, availability status, fines, and days checked out.
Here is the caller graph for this function:

◆ getIsbn()

long long Book::getIsbn ( ) const
nodiscard

Get the ISBN of the book.

Returns
The ISBN of the book.
Here is the caller graph for this function:

◆ getPublicationYear()

short Book::getPublicationYear ( ) const
nodiscard

Get the publication year of the book.

Returns
The publication year of the book.

◆ getTitle()

const string & Book::getTitle ( ) const
nodiscard

Get the title of the book.

Returns
The title of the book.

◆ isAvailable()

bool Book::isAvailable ( ) const
nodiscard

Check if the book is available.

Returns
true if the book is available, false otherwise.
Here is the caller graph for this function:

◆ operator<()

bool Book::operator< ( const Book & b) const

Compare two books based on their ISBN.

Parameters
bThe book to compare with.
Returns
true if the current book's ISBN is less than the other book's ISBN.

◆ operator==()

bool Book::operator== ( const Book & b) const

Compare two books for equality based on their ISBN.

Parameters
bThe book to compare with.
Returns
true if the current book's ISBN is equal to the other book's ISBN.

◆ setAuthor()

void Book::setAuthor ( const string & author)

Set the author of the book.

Parameters
authorThe new author for the book.

◆ setDaysCheckedOut()

void Book::setDaysCheckedOut ( int daysCheckedOut)

Set the number of days the book has been checked out.

Parameters
daysCheckedOutThe new number of days the book has been checked out.
Here is the caller graph for this function:

◆ setFine()

void Book::setFine ( int fine)

Set the fine associated with the book.

Parameters
fineThe new fine amount for the book.

◆ setGenre()

void Book::setGenre ( const string & genre)

Set the genre of the book.

Parameters
genreThe new genre for the book.

◆ setIsAvailable()

void Book::setIsAvailable ( bool isAvailable)

Set the availability of the book.

Parameters
isAvailableThe new availability status of the book.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setIsbn()

void Book::setIsbn ( long long isbn)

Set the ISBN of the book.

Parameters
isbnThe new ISBN for the book.

◆ setPublicationYear()

void Book::setPublicationYear ( short publicationYear)

Set the publication year of the book.

Parameters
publicationYearThe new publication year for the book.

◆ setTitle()

void Book::setTitle ( const string & title)

Set the title of the book.

Parameters
titleThe new title for the book.

The documentation for this class was generated from the following files: