// profile.h   revised 6/9/98
// class Address; class Profile;

#ifndef ProfileH
#define ProfileH
#include <fstream.h>

/*
class Address has private members "street_address" and "street_name".
"street_address" contains both the house number and the name of the street name,
 and "street_name" only contains the name of the street. 

The reason for this distinction is that usually street address is given in 
a format of house number and street name (as in "street_address"), but when
people search for a specific address, they often neglect (or don't remember) 
the house number.  Therefore, I will use "street_address" for I/O purpose and
use "street_name" for search schemes.

"MakeStreetName()" extracts "street_name" from "street_address".
for more detail, look at profile.cc implementation.
*/

/*
strcpy(char* s, char* t) copies string t into string s.
It initializes the private data members for Address 
(and also the name field of Profile)
strcpy(x,0) assigns x a null.
*/

class Address{

  public:

    Address()						
      {
        strcpy(street_address,0);
        strcpy(street_name,0);
        strcpy(city,0);
        strcpy(state,0);
//        cout<<"default address"<<endl;
      }
				
    Address(char* st, char* c, char* stt)		
      {
        strcpy(street_address,st);
        MakeStreetName();
        strcpy(city,c);
        strcpy(state,stt);
//       cout<<"new address"<<endl;
      }
						
    ~Address()
      { 
//        cout<<"destroy address"<<endl;
      }  //no delete is needed if new is not used. 
/*
    Address(Address &A)          //copy constructor
      {
        cout<<"copy address"<<endl;
        strcpy(street_address, A.street_address);
        strcpy(street_name,A.street_name);
      }
*/
    char* GetStreetAddress()	{return street_address;}
    char* GetStreetName()       {return street_name;}
    void  MakeStreetName();
    char* GetCity()             {return city;}
    char* GetState()            {return state;}

    void  EditStreet(char* TheStreet) 
      {
        strcpy(street_address,TheStreet);
        MakeStreetName(); 
      }

    void  EditCity(char* TheCity) 
      {
        strcpy(city,TheCity);
      }

    void  EditState(char* TheState)
      {
        strcpy(state,TheState);
      }
	   
  private:                           //house number and street name  
    char     street_address[100];    //in one string // Ex.  123 Culver Dr.
    char     street_name[100];       //street name only
    char     city[100];
    char     state[100];
};			              




/*
The class Profile contains all the data of a person.  
It gives information on name, address, etc.

strcpy() initializes name field.  see Address for more detail.

"Display()" outputs the data members of Profile.
*/


class Profile{
	
  public:
			
    Profile():address(0,0,0)                        
      {
        prof_num=0;
        strcpy(first_name,0); 
        strcpy(last_name,0); 
//        cout<<"default profile"<<endl;
      }

    Profile(int n, char* fn, char* ln, char* st, char* c, char* stt):address(st,c,stt)      
      {
        prof_num=n;
        strcpy(first_name,fn);
        strcpy(last_name,ln); 
//        cout<<"new profile"<<endl;
      }

    ~Profile()
      { 
//        cout<<"destroy profile"<<endl;
      }    //no delete is needed if new is now used. 
/*
    Profile(Profile &p):address(p.address)      //copy constructor
     {
       cout<<" copy profile"<<endl;
       entry_num=p.entry_num;
       strcpy(name,p.name);

     }
*/
//    void  InputEntryNum(int Num) {entry_num=Num;}
    int   GetProfNum()        {return prof_num;}		
    char* GetFirstName()      {return first_name;}
    char* GetLastName()       {return last_name;}
    char* GetStreetAddress()  {return address.GetStreetAddress();}
    char* GetAdrsStrtName()   {return address.GetStreetName();}
    char* GetCity()           {return address.GetCity();}
    char* GetState()          {return address.GetState();}

    Profile*  EditProfNum(int TheNum)
      {
        prof_num=TheNum;
        return this;
      }
    Profile*  EditFirstName(char* TheName) 
      {
        strcpy(first_name,TheName); 
        return this;
      }
    Profile*  EditLastName(char* TheName)
      {
        strcpy(last_name,TheName); 
        return this;
      }
    Profile*  EditStreet(char* TheStreet) 
      {
        address.EditStreet(TheStreet); 
        return this;
      }
    Profile*  EditCity(char* TheCity) 
      {
        address.EditCity(TheCity); 
        return this;
      }

    Profile*  EditState(char* TheState) 
      {
        address.EditState(TheState); 
        return this;
      }

    void  Display();
    void  Save(ostream& SaveFile);
   
  private:
    int       prof_num;
    char      first_name[100];
    char      last_name[100];
    Address   address;
};

#endif

		 		 
