#include "Item.h" using std::endl; // Enumeration representing the different availability states Item::Item() { active = false; availability = NOT_SET; } // String representation of the above states string Item::getName() const { return name; } void Item::setName(string name) { this->name = name; } string Item::getType() const { return type; } void Item::setType(string type) { this->type = type; } string Item::getAuthor() const { return author; } void Item::setAuthor(string author) { this->author = author; } string Item::getOwner() const { return owner; } void Item::setOwner(string owner) { this->owner = owner; } string Item::getPrice() const { return price; } void Item::setPrice(string price) { this->price = price; } Availability Item::getAvailability() const { return availability; } void Item::setAvailability(Availability availability) { this->availability = availability; } bool Item::isActive() const { return active; } void Item::setActive(bool active) { this->active = active; if (active == false) { // Clear everything out name = type = author = owner = price = ""; availability = NOT_SET; } } // Prints an item void Item::print(ostream& out, bool printOwner) const { if (!active) return; if (name != "") out << "Item:" << endl << " " << name << endl; if (type != "") out << "Media Type:" << endl << " " << type << endl; if (author != "") out << "by:" << endl << " " << author << endl; if (printOwner) out << "Owner:" << endl << " " << owner << endl; if (price != "") out << "Price:" << endl << " " << price << endl; if (availability != NOT_SET) out << "Availability:" << endl << " " << AVAILABILITIES[availability] << endl; out << endl; }