// Note: Instrumentation statements are highlighted in green

#include "ContactInfo.hpp"
#include "string_io.hpp"

///////////////////////////////////////////////////////////////////////////////
// ContactInfo class
///////////////////////////////////////////////////////////////////////////////

// Visual Member Definition
VISIBILITY_START1(ContactInfo, ContactInfoBase, "Contact Info", 1)
VVARIABLE(ContactInfo, nameInfo, "Name", 0, 0)
VVARIABLE(ContactInfo, homeInfo, "Home", 0, 0)
VVARIABLE(ContactInfo, businessInfo, "Business", 0, 0)
VVARIABLE(ContactInfo, personalInfo, "Personal", 0, 0)
VVARIABLE(ContactInfo, miscellaneousInfo, "Miscellaneous", 0, 0)
VVARIABLE(ContactInfo, emailAddresses, "Email addresses", 0, 0)
VCHARPTR_FUNCTION(ContactInfo, getName, "Name", 0, 0)
VCHARPTR_FUNCTION(ContactInfo, getEmailAddress, "E-Mail Address", 0, 0)
VCHARPTR_FUNCTION(ContactInfo, getHomePhone, "Home Phone", 0, 0)
VCHARPTR_FUNCTION(ContactInfo, getPager, "Pager", 0, 0)
VCHARPTR_FUNCTION(ContactInfo, getMobile, "Mobile", 0, 0)
VCHARPTR_FUNCTION(ContactInfo, getPersonalWebPage, "Personal Web Page", 0, 0)
VCHARPTR_FUNCTION(ContactInfo, getBusinessPhone, "Business Phone", 0, 0)
VCHARPTR_FUNCTION(ContactInfo, getBusinessFax, "Business Fax", 0, 0)
VCHARPTR_FUNCTION(ContactInfo, getJobTitle, "Job Title", 0, 0)
VCHARPTR_FUNCTION(ContactInfo, getDepartment, "Department", 0, 0)
VCHARPTR_FUNCTION(ContactInfo, getOffice, "Office", 0, 0)
VCHARPTR_FUNCTION(ContactInfo, getCompany, "Company Name", 0, 0)
VCHARPTR_FUNCTION(ContactInfo, getBusinessWebPage, "Business Web Page", 0, 0)
VVOID_FUNCTION(ContactInfo, clear, "Clear", 0, 0)
VISIBILITY_END

ContactInfo::ContactInfo(void)
{
}

ContactInfo::ContactInfo(const ContactInfo & that)
{
  *this = that;
}

ContactInfo::~ContactInfo(void)
{
}

ContactInfo & ContactInfo::operator =(const ContactInfo & that)
{
  if (this != &that) {
    nameInfo = that.nameInfo;
    homeInfo = that.homeInfo;
    businessInfo = that.businessInfo;
    personalInfo = that.personalInfo;
    miscellaneousInfo = that.miscellaneousInfo;
    emailAddresses = that.emailAddresses;
  }
  return *this;
}

std::ostream & operator<< (std::ostream& os, ContactInfo & out_obj)
{
  os << out_obj.nameInfo << " ";
  os << out_obj.homeInfo << " ";
  os << out_obj.businessInfo << " ";
  os << out_obj.personalInfo << " ";
  os << out_obj.miscellaneousInfo << " ";
  os << out_obj.emailAddresses << " ";
  return os;
}

std::istream & operator>> (std::istream & is, ContactInfo & in_obj)
{
  is >> in_obj.nameInfo;
  is >> in_obj.homeInfo;
  is >> in_obj.businessInfo;
  is >> in_obj.personalInfo;
  is >> in_obj.miscellaneousInfo;
  is >> in_obj.emailAddresses;
  return is;
}

bool ContactInfo::operator==(const ContactInfo & that) const
{
  return nameInfo == that.nameInfo;
}

bool ContactInfo::operator!=(const ContactInfo & that) const
{
  return nameInfo != that.nameInfo;
}

bool ContactInfo::operator<(const ContactInfo & that) const
{
  return nameInfo < that.nameInfo;
}

bool ContactInfo::operator>(const ContactInfo & that) const
{
  return nameInfo > that.nameInfo;
}

char * ContactInfo::getName(void)
{
  return nameInfo.createDisplayName();
}

char * ContactInfo::getEmailAddress(void)
{
  return emailAddresses.getDefaultEmailAddress();
}

char * ContactInfo::getHomePhone(void)
{
  return const_cast<char *>(homeInfo.phone.c_str());
}

char * ContactInfo::getPager(void)
{
  return const_cast<char *>(businessInfo.pager.c_str());
}

char * ContactInfo::getMobile(void)
{
  return const_cast<char *>(homeInfo.mobile.c_str());
}

char * ContactInfo::getPersonalWebPage(void)
{
  return const_cast<char *>(homeInfo.webPage.c_str());
}

char * ContactInfo::getBusinessPhone(void)
{
  return const_cast<char *>(businessInfo.phone.c_str());
}

char * ContactInfo::getBusinessFax(void)
{
  return const_cast<char *>(businessInfo.fax.c_str());
}

char * ContactInfo::getJobTitle(void)
{
  return const_cast<char *>(businessInfo.jobTitle.c_str());
}

char * ContactInfo::getDepartment(void)
{
  return const_cast<char *>(businessInfo.department.c_str());
}

char * ContactInfo::getOffice(void)
{
  return const_cast<char *>(businessInfo.office.c_str());
}

char * ContactInfo::getCompany(void)
{
  return const_cast<char *>(businessInfo.company.c_str());
}

char * ContactInfo::getBusinessWebPage(void)
{
  return const_cast<char *>(businessInfo.webPage.c_str());
}

void ContactInfo::clear(void)
{
  nameInfo.clear();
  homeInfo.clear();
  businessInfo.clear();
  personalInfo.clear();
  miscellaneousInfo.clear();
  emailAddresses.clear();
}
void ContactInfo::populateEditView(void)
{
  nameInfo.populateEditView();
  homeInfo.populateEditView();
  businessInfo.populateEditView();
  personalInfo.populateEditView();
  miscellaneousInfo.populateEditView();
  emailAddresses.populateEditView();
}



Copyright 2002-2007 Outerface Technologies, Inc.