#include "PrintVisitor.h" #include "CompanyEntry.h" #include "GroupEntry.h" #include "PersonEntry.h" #include void PrintVisitor::visit(const PersonEntry &pe) { std::cout << indent << "Person: " << pe.getName() << ' ' << pe.getPhone() << '\n'; } void PrintVisitor::visit(const CompanyEntry &ce) { std::cout << indent << "Company: " << ce.getName() << " <" << ce.getCategory() << "> " << ce.getPhone() << '\n'; } void PrintVisitor::visit(const GroupEntry &ge) { std::cout << indent << "Group: " << ge.getName() << '\n'; indent += " "; } void PrintVisitor::unVisit(const GroupEntry &) { // Get rid of the extra indent we added indent = indent.substr(indent.length() - 2, 2); }