#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include "PaintShop.h"
#include "Paint.h"
#include "Tool.h"
#include "PaintShopException.h"
using namespace std; ---> AQUI ME MARCA EL ERROR
void addPaint(PaintShop *ps, Paint* paint);
void addTool(PaintShop *ps, Tool* tool);
void paintInfo(PaintShop* ps, string id);
int main(int argc, char *argv[]) {
// Creating a PaintShop object
// -------------------------
PaintShop *ps = new PaintShop();
// Creating Paint objects and adding them to the paints list of object ps
// ----------------------------------------------------------------------
Paint *paintObj1 = new Paint("P1", "Plastic", "Red");
Paint *paintObj2 = new Paint("P2", "Acrylic", "Green");
Paint *paintObj3 = new Paint("P1", "Plastic", "Red"); // repeated object <----
ps->addPaint(paintObj1);
ps->addPaint(paintObj2);
ps->addPaint(paintObj3);
// Creating Tool objects and adding them to the tools list of object ps
// --------------------------------------------------------------------
Tool *toolObj1 = new Tool("T1", "Paintbrush");
Tool *toolObj2 = new Tool("T2", "Paintroller");
Tool *toolObj3 = new Tool("T1", "Paintbrusch"); // repeated object <----
ps->addTool(toolObj1);
ps->addTool(toolObj2);
ps->addTool(toolObj3);
// Listing Paint objects Information
// ---------------------------------
cout << "--------------" << endl;
cout << "List of paints" << endl;
cout << "--------------" << endl;
cout << ps->listPaints() << endl;
// Listing Tool objects Information
// --------------------------------
cout << "-------------" << endl;
cout << "List of tools" << endl;
cout << "-------------" << endl;
cout << ps->listTools() << endl;
// Searching Paints by its id
// --------------------------
cout << "-- Information related to Paint with id = P1:" << endl;
paintInfo(ps,"P1");
cout << "-- Information related to Paint with id = P3:" << endl;
paintInfo(ps,"P3");// This object does not exists <----
// Comparing objects
// -----------------
cout << paintObj1->equals(paintObj2) << endl;
cout << paintObj1->equals(paintObj3) << endl;
cout << "End of the exercise" << endl;
}
void addPaint(PaintShop *ps, Paint* paint)
{
try
{
ps->addPaint(paint);
}
catch(PaintShopException e)
{
cout << e.str() << endl;
}
}
void addTool(PaintShop *ps, Tool* tool)
{
try
{
ps->addTool(tool);
}
catch(PaintShopException e)
{
cout << e.str() << endl;
}
}
void paintInfo(PaintShop *ps, string id)
{
try
{
cout << ps->paintInfo(id) << endl;
}
catch(PaintShopException e)
{
cout << e.str() << endl;
}
}