Click here to Skip to main content
11,636,778 members (77,923 online)
Click here to Skip to main content
Add your own
alternative version

Address Book

, 6 Aug 2000 CPOL 232.4K 5K 93
Address Book application
/* ------------------------ Person.cpp ------------------------------

  CPerson is a very simple class with holds all the data relating
  to a person.
  

  -------------------------------------------------------------------*/
#include <stdafx.h>
#include "person.h"

IMPLEMENT_SERIAL( CPerson, CObject, 0 )

CPerson::CPerson()
{
	Empty();
}

// Serialize is overloaded to take care of saving and loading the data.
void CPerson::Serialize( CArchive& archive )
{
    // call base class function first
    // base class is CObject in this case
    CObject::Serialize( archive );

    if( archive.IsStoring() )
        archive << m_strFirstName 
	            << m_strLastName
				<< m_strMiddleName
				<< m_strName
				<< m_strNickName
				<< m_strEMail
				<< m_strHomeStreet
				<< m_strHomeCity
				<< m_strHomePostalCode
				<< m_strHomeState
				<< m_strHomeCountry
				<< m_strHomePhone
				<< m_strHomeFax
				<< m_strCarPhone
				<< m_strPersonalWebPage
				<< m_strBusinessStreet
				<< m_strBusinessCity
				<< m_strBusinessPostalCode
				<< m_strBusinessState
				<< m_strBusinessCountry
				<< m_strBusinessWebPage
				<< m_strBusinessPhone
				<< m_strBusinessFax
				<< m_strPager
				<< m_strCompany
				<< m_strJobTitle
				<< m_strDepartment
				<< m_strOfficeLocation
				<< m_strNotes;
	
    else
        archive >> m_strFirstName 
	            >> m_strLastName
				>> m_strMiddleName
				>> m_strName
				>> m_strNickName
				>> m_strEMail
				>> m_strHomeStreet
				>> m_strHomeCity
				>> m_strHomePostalCode
				>> m_strHomeState
				>> m_strHomeCountry
				>> m_strHomePhone
				>> m_strHomeFax
				>> m_strCarPhone
				>> m_strPersonalWebPage
				>> m_strBusinessStreet
				>> m_strBusinessCity
				>> m_strBusinessPostalCode
				>> m_strBusinessState
				>> m_strBusinessCountry
				>> m_strBusinessWebPage
				>> m_strBusinessPhone
				>> m_strBusinessFax
				>> m_strPager
				>> m_strCompany
				>> m_strJobTitle
				>> m_strDepartment
				>> m_strOfficeLocation
				>> m_strNotes;
}

CPerson & CPerson::operator =(CPerson &person)
{
         m_strFirstName =         person.m_strFirstName; 
	     m_strLastName =          person.m_strLastName;
		 m_strMiddleName =        person.m_strMiddleName;
		 m_strName =              person.m_strName;
		 m_strNickName =          person.m_strNickName;
		 m_strEMail =             person.m_strEMail;
		 m_strHomeStreet =        person.m_strHomeStreet;
		 m_strHomeCity=           person.m_strHomeCity;
		 m_strHomePostalCode=     person.m_strHomePostalCode;
		 m_strHomeState=          person.m_strHomeState;
		 m_strHomeCountry=        person.m_strHomeCountry;
		 m_strHomePhone=          person.m_strHomePhone;
		 m_strHomeFax=            person.m_strHomeFax;
		 m_strCarPhone=           person.m_strCarPhone;
		 m_strPersonalWebPage=    person.m_strPersonalWebPage;
		 m_strBusinessStreet=     person.m_strBusinessStreet;
		 m_strBusinessCity=       person.m_strBusinessCity;
		 m_strBusinessPostalCode= person.m_strBusinessPostalCode;
		 m_strBusinessState=      person.m_strBusinessState;
		 m_strBusinessCountry=    person.m_strBusinessCountry;
		 m_strBusinessWebPage=    person.m_strBusinessWebPage;
		 m_strBusinessPhone=      person.m_strBusinessPhone;
		 m_strBusinessFax=        person.m_strBusinessFax;
		 m_strPager=              person.m_strPager;
		 m_strCompany=            person.m_strCompany;
		 m_strJobTitle=           person.m_strJobTitle;
		 m_strDepartment=         person.m_strDepartment;
		 m_strOfficeLocation=     person.m_strOfficeLocation;
		 m_strNotes=              person.m_strNotes;
		 return *this;
}

void CPerson::Empty()
{
	m_strFirstName= m_strLastName= m_strMiddleName=
    m_strName= m_strNickName= m_strEMail=m_strHomeStreet=
    m_strHomeCity= m_strHomePostalCode=m_strHomeState=
	m_strHomeCountry=m_strHomePhone=m_strHomeFax=
	m_strCarPhone=m_strPersonalWebPage=m_strBusinessStreet=
	m_strBusinessCity=m_strBusinessPostalCode=m_strBusinessState=
	m_strBusinessCountry=m_strBusinessWebPage=m_strBusinessPhone=
	m_strBusinessFax=m_strPager=m_strCompany= m_strJobTitle=
	m_strDepartment=m_strOfficeLocation=m_strNotes="";
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Xavier John
Software Developer
United States United States
No Biography provided

You may also be interested in...

| Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.150728.1 | Last Updated 7 Aug 2000
Article Copyright 1999 by Xavier John
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid