#include "Item.h" #include using namespace std; Item::Item() :item("**"), Type("**"), Author("**"), Owner("**"), Available("**"), Price(-1.0), isEmpty(true) {} Item::Item(Item &A) :item("**"), Type(A.Type), Author(A.Author), Owner(A.Owner), Available(A.Available), Price(A.Price), isEmpty(true) {} bool Item::Set(ifstream &In) { assert(!In.fail()); char dummy; string Variable; bool success=false; getline(In, Variable, '\n'); while(In&&Variable!="@") { switch(ConvertVar(Variable)) { case ITEM: getline(In, item, '\n');break; case TYPE: getline(In, Type, '\n');break; case AUTHOR: getline(In, Author, '\n');break; case OWNER: getline(In, Owner, '\n');success=true;break; case AVAIL: getline(In, Available, '\n');break; case PRICE: In>>dummy; In>>Price;break; case FIN: break; } In>>dummy; getline(In, Variable, '\n'); } if(success) { isEmpty=false; } else Delete(); return !isEmpty; } void Item::Delete() { item="**"; Type="**"; Author="**"; Owner="**"; Available="**"; Price=-1.0; isEmpty=true; } void Item::Print(ofstream &Out, bool IsSuppressed) { assert(!Out.fail()); if(item!="**") Out<<"Item:\n"<<'\t'<