/*
 * University of Utah
 * 2005 High School Programming Contest
 * Record Matching
 *
 * Filename: record.cc
 * 
 * Description: Implements an object for storing individual records.
 *   See record.h for further information.
 *
 * Modification History:
 * 2/21/2005 - Initial Release
 */
#include <cctype>
#include "record.h"

record::record(string uid, string fName, string lName, string address,
               string zip, string phone, string email) {
  this->uid = uid;
  this->fName = fName;
  this->lName = lName;
  this->address = address;
  this->zip = zip;
  this->phone = phone;
  this->email = email;
}

string record::getUID() {
  return uid;
}


// Helper function for record::lowerCaseEquals which takes a string
// and returns a new version that is lowercased.
string lowerCase(string s) {
  string r = s;
  for (int i = 0; i < r.size(); i++) {
    r[i] = tolower(r[i]);
  }
  return r;
}


bool record::lowerCaseEquals(record r) {
  return (lowerCase(fName) == lowerCase(r.fName) &&
          lowerCase(lName) == lowerCase(r.lName) &&
          lowerCase(address) == lowerCase(r.address) &&
          lowerCase(zip) == lowerCase(r.zip) &&
          lowerCase(phone) == lowerCase(r.phone) &&
          lowerCase(email) == lowerCase(r.email));  
}

