/* * File: contact.cpp * Purpose: Implementation of the contact class */ #include "contact.h" //get/set all the attributes std::string Contact::getName() { return name; } void Contact::setName(std::string name) { this->name=name; } std::string Contact::getPhone() { return phone; } void Contact::setPhone(std::string phone) { this->phone=phone; } std::string Contact::getEmail() { return email; } void Contact::setEmail(std::string email) { this->email=email; } std::string Contact::getAddress() { return address; } void Contact::setAddress(std::string address) { this->address=address; } std::string Contact::getCity() { return city; } void Contact::setCity(std::string city) { this->city=city; } std::string Contact::getState() { return state; } void Contact::setState(std::string state) { this->state=state; } std::string Contact::getZip() { return zip; } void Contact::setZip(std::string zip) { this->zip=zip; } std::string Contact::getDOB() { return dob; } void Contact::setDOB(std::string dob) { this->dob=dob; } //insert a pretty printed contact into os void Contact::display(std::ostream &os) { os << name << std::endl << " DOB: " << dob << std::endl << " Phone: " << phone << std::endl << " Email: " << email << std::endl << " Address: " << address << std::endl << " " << city << ',' << state << " " << zip << std::endl; } //insert a serialized version of contact into os void Contact::saveToFile(std::ostream &os) { os << name << std::endl << dob << std::endl << phone << std::endl << email << std::endl << address << std::endl << city << std::endl << state << std::endl << zip << std::endl; } //loadFromFile void Contact::loadFromFile(std::istream &os) { std::getline(os, name); std::getline(os, dob); std::getline(os, phone); std::getline(os, email); std::getline(os, address); std::getline(os, city); std::getline(os, state); std::getline(os, zip); }