Ejemplo n.º 1
0
/**
   Used to initialize all the member variables of the class. This function is
   called by each constructor.
   @param - firstName: string for the student's first name
   @param - lastName: string for the student's last name
   @param - gpa: double representing the student's GPA
   @param - crecits: the number of credits the student has
*/
void Student::init(string firstName, string lastName, double gpa, int credits)
{
  setFirstName(firstName);
  setLastName(lastName);
  setGpa(gpa);
  setCredits(credits);
}
//Initialize setFirstName, setLastName, setMonthlySalary
Employee::Employee(std::string first, std::string last, float salary)
{
	setFirstName(first);
	setLastName(last);
	setMonthlySalary(salary);

}
Ejemplo n.º 3
0
Customer::Customer(const Customer& rhs)
: _id (rhs._id)
{
    setFirstName(rhs._firstName);
    setLastName(rhs._lastName);
    setAddress(rhs._address);
    setPhone(rhs._phone);
}
Ejemplo n.º 4
0
FullName::FullName(const char * fr, char initial, const char * ls)
{
   first = NULL;
   setFirstName(fr);
   setMiddleInitial(initial);
   last = NULL;
   setLastName(ls);
}
Ejemplo n.º 5
0
FullName::FullName(const FullName & other)
{
   first = NULL;
   setFirstName(other.getFirstName());
   setMiddleInitial(other.getMiddleInitial());
   last = NULL;
   setLastName(other.getLastName());
}
Ejemplo n.º 6
0
const FullName & FullName::operator=(const FullName & right)
{
   if ( this == & right ) return *this;
   setFirstName(right.getFirstName());
   setMiddleInitial(right.getMiddleInitial());
   setLastName(right.getLastName());
   return *this;
}
Ejemplo n.º 7
0
void FullName::copyTo( const FullName & right)    // copy parameter to invoking instance
{
   if ( this == & right ) return;
   setFirstName(right.getFirstName());
   setMiddleInitial(right.getMiddleInitial());
   setLastName(right.getLastName());
   return;
}
Ejemplo n.º 8
0
// constructor
Book::Book(const char* lName, const char* fName, const char* bTitle, Date checkOutDate, Date dueDate){
	setLastName(lName);
	setFirstName(fName);
	setTitle(bTitle);
	setCheckOutDate(checkOutDate);
	setDueDate(dueDate);
	count++;
}
Ejemplo n.º 9
0
FullName::FullName()
{
   first = NULL;
   setFirstName("John");
   setMiddleInitial('Q');
   last = NULL;
   setLastName("Public");
}
Ejemplo n.º 10
0
Customer& Customer::operator=(const Customer& rhs)
{
    _id = rhs._id;
    setFirstName(rhs._firstName);
    setLastName(rhs._lastName);
    setAddress(rhs._address);
    setPhone(rhs._phone);
    return *this;
}
Ejemplo n.º 11
0
void test_setFirstName_givenJack_should_return_Jack()
{
	char result;
	Personinfo->firstname =name;
	result = setFirstName( &NameDetail, "Jack" );
	
	TEST_ASSERT_EQUAL_STRING("Jack",result);
	
}
void QFacebookGraphUser::requestDone(bool ok) {
    if(ok)
    {
        QVariantMap map = result();
        QVariantMap::const_iterator i;
        for (i = map.constBegin(); i != map.constEnd(); ++i)
        {
            if(i.key() == "name" )
                setName(i.value().toString());
            if(i.key() == "hometown")
                setHometown(i.value().toMap());
            if(i.key() == "last_name")
                setLastName(i.value().toString());
            if(i.key() == "birthday")
                setBirthday(i.value().toString());
            if(i.key() == "education") {
                QFacebookGraphCommonEducationModel *edu = new QFacebookGraphCommonEducationModel();
                for (int j = 0; j < i.value().toList().size(); ++j) {
                    edu->populate(i.value().toList().at(j).toMap());
                    m_education.append(edu);
                    edu = new QFacebookGraphCommonEducationModel();
                }
            }
            if(i.key() == "work") {
                QFacebookGraphCommonWorkModel *work = new QFacebookGraphCommonWorkModel();
                for (int j = 0; j < i.value().toList().size(); ++j) {
                    work->populate(i.value().toList().at(j).toMap());
                    m_work.append(work);
                    work = new QFacebookGraphCommonWorkModel();
                }
            }
            if(i.key() == "first_name")
                setFirstName(i.value().toString());
            if(i.key() == "gender")
                setGender(i.value().toString());
            if(i.key() == "id")
                setFbid(i.value().toString());
            if(i.key() == "link")
                setLink(i.value().toString());
            if(i.key() == "locale")
                setLocale(i.value().toString());
            if(i.key() == "location")
                setLocation(i.value().toMap());
            if(i.key() == "middle_name")
                setMiddleName(i.value().toString());
            if(i.key() == "timezone")
                setTimezone(i.value().toLongLong());
            if(i.key() == "updated_time")
                setUpdatedtime(i.value().toString());
            if(i.key() == "verified")
                setVerified(i.value().toBool());
        }

        emit modelPopulated();
    }
}
Ejemplo n.º 13
0
bool BuddyInfo::readVariant( const QVariant &variant )
{
    if ( ! variant.canConvert(QVariant::Map) )
        return false;
    
    QVariantMap info = variant.toMap();
    setFirstName(info["firstName"].toString());
    setName(info["name"].toString());
    setStatus(info["status"].toString());
    setThumbSrc(info["thumbSrc"].toString());
    return true;
}
Ejemplo n.º 14
0
void FullName::input(void)
{
	char tempFirst[100];
	cin >> tempFirst;
	setFirstName(tempFirst);
	char tempMiddle;
	cin >> tempMiddle;
	setMiddleInitial(tempMiddle);
	char tempLast[100];
	cin >> tempLast;
	setLastName(tempLast);
}
void test_the_set_first_name_array_size_cannot_exceed_21_if_exceed_return_0(void)

{

 int space;

 PersonInfo spaceinfo;

 space = setFirstName(&spaceinfo, "qwertyuiopasdfghjklzxcasd");

 UnityAssertEqualNumber((_U_SINT)((0)), (_U_SINT)((space)), (((void *)0)), (_U_UINT)61, UNITY_DISPLAY_STYLE_INT);

}
void test_the_set_first_name_cannot_have_empty_string_if_empty_shall_return_0(void)

{

 int emptystring;

 PersonInfo EmptyString;

 emptystring = setFirstName(&EmptyString, "");

 UnityAssertEqualNumber((_U_SINT)((0)), (_U_SINT)((emptystring)), (((void *)0)), (_U_UINT)21, UNITY_DISPLAY_STYLE_INT);

}
void test_the_set_first_name_must_within_alphabet_A_to_Z_if_smaller_than_65_shall_return_0(void)

{

 int name;

 PersonInfo nameinfo;

 name = setFirstName(&nameinfo, "&");

 UnityAssertEqualNumber((_U_SINT)((0)), (_U_SINT)((name)), (((void *)0)), (_U_UINT)29, UNITY_DISPLAY_STYLE_INT);

}
void test_the_set_first_name_must_within_alphabet_A_to_Z_if_greater_than_90_shall_return_0(void)

{

 int name;

 PersonInfo NameInfo;

 name = setFirstName(&NameInfo, "[");

 UnityAssertEqualNumber((_U_SINT)((0)), (_U_SINT)((name)), (((void *)0)), (_U_UINT)37, UNITY_DISPLAY_STYLE_INT);

}
void test_the_set_first_name_must_within_alphabet_a_to_z_if_greater_than_122_shall_return_0(void)

{

 int name;

 PersonInfo CheckNameInfo;

 name = setFirstName(&CheckNameInfo, "|");

 UnityAssertEqualNumber((_U_SINT)((0)), (_U_SINT)((name)), (((void *)0)), (_U_UINT)53, UNITY_DISPLAY_STYLE_INT);

}
void test_the_set_first_name_must_within_alphabet_a_to_z_if_lesser_than_97_but_greater_than_90_shall_return_0(void)

{

 int name;

 PersonInfo checknameinfo;

 name = setFirstName(&checknameinfo, "_");

 UnityAssertEqualNumber((_U_SINT)((0)), (_U_SINT)((name)), (((void *)0)), (_U_UINT)45, UNITY_DISPLAY_STYLE_INT);

}
void test_the_set_first_name_must_within_alphabet_A_to_Z_if_yes_return_1(void)

{

 int name;

 PersonInfo Alphabet;

 name = setFirstName(&Alphabet, "Samuel ");

 UnityAssertEqualNumber((_U_SINT)((1)), (_U_SINT)((name)), (((void *)0)), (_U_UINT)69, UNITY_DISPLAY_STYLE_INT);

}
Ejemplo n.º 22
0
//----- DxfIn implemented to support non order dependant DXF code
Acad::ErrorStatus OarxEmployee::dxfInFields (AcDbDxfFiler *pFiler) {
	//----- Make sure the object is open is write mode
	//----- And enable UNDO resolution
	assertWriteEnabled () ;
	//----- Call parent class implementation for header
	AcDbEntity::dxfInFields (pFiler) ;
	//----- Move to our class pointer in the DXF file (Dxf code: 100)
	Adesk::Boolean bResult ;
	if ( (bResult =pFiler->atSubclassData ("OarxEmployee")) != Adesk::kTrue )
		return (Acad::eMissingDxfField) ;
	//----- Read the version number
	Acad::ErrorStatus es ;
	struct resbuf rb ;
	if ( (es =pFiler->readResBuf (&rb)) != Acad::eOk )
		return (es) ;
	if ( rb.restype != AcDb::kDxfInt32 || (unsigned long)rb.resval.rlong != mVersion )
		return (Acad::eMakeMeProxy) ;
	//----- Read datas in a non dependant order
	while ( pFiler->readResBuf (&rb) == Acad::eOk ) {
		if ( (es =pFiler->readItem (&rb)) != Acad::eOk )
			return (es) ;
		switch ( rb.restype ) {
			case AcDb::kDxfInt32:
				mID =rb.resval.rlong ;
				break ;
			case AcDb::kDxfInt32 + 1:
				mCubeNumber =rb.resval.rlong ;
				break ;
			case AcDb::kDxfXTextString:
				setFirstName (rb.resval.rstring) ;
				acdbFree (rb.resval.rstring) ;
				rb.resval.rstring =NULL ;
				break ;
			case AcDb::kDxfXTextString + 1:
				setLastName (rb.resval.rstring) ;
				acdbFree (rb.resval.rstring) ;
				rb.resval.rstring =NULL ;
				break ;
			case AcDb::kDxfXCoord:
				mCenter =asPnt3d (rb.resval.rpoint) ;
				break ;
			default:
				pFiler->pushBackItem () ;
				break ;
		}
	}
	if ( mID == -1 || mCubeNumber == -1 || mLastName == NULL || mFirstName == NULL ) //----- No way to test mCenter
		return (Acad::eMissingDxfField) ;
	return (pFiler->filerStatus ()) ;
}
Ejemplo n.º 23
0
// 9 arg constructor - set all PersonData attributes and CustomerData attributes
CustomerData::CustomerData(string l, string f, string a, string c, string s, string z, string p, int n, bool m)
{
	// set attributes derived from PersonData
	setLastName(l);
	setFirstName(f);
	setAddress(a);
	setCity(c);
	setState(s);
	setZip(z);
	setPhoneNumber(p);

	// set CustomerData attributes
	customerNumber = n;
	mailingList = m;
}
void test_setFirstName_given_empty_should_return_0(void)

{

 int result;

 struct PersonInfo_t PersonInfo;



 result = setFirstName(&PersonInfo,"");

 UnityAssertEqualNumber((_U_SINT)((0)), (_U_SINT)((result)), (((void *)0)), (_U_UINT)40, UNITY_DISPLAY_STYLE_INT);

}
Ejemplo n.º 25
0
//! [1]
bool EditableSqlModel::setData(const QModelIndex &index, const QVariant &value, int /* role */)
{
    if (index.column() < 1 || index.column() > 2)
        return false;

    QModelIndex primaryKeyIndex = QSqlQueryModel::index(index.row(), 0);
    int id = data(primaryKeyIndex).toInt();

    clear();

    bool ok;
    if (index.column() == 1) {
        ok = setFirstName(id, value.toString());
    } else {
        ok = setLastName(id, value.toString());
    }
    refresh();
    return ok;
}
void test_setFirstName_given_Scarlet_should_return_1_for_ValidName(void)

{

 int result;

 struct PersonInfo_t PersonInfo;



 result = setFirstName( &PersonInfo, "Scarlet");

 UnityAssertEqualNumber((_U_SINT)((1)), (_U_SINT)((result)), (((void *)0)), (_U_UINT)19, UNITY_DISPLAY_STYLE_INT);





}
Ejemplo n.º 27
0
void User::fromJson(nlohmann::json& val)
{
    if(val.find("id") != val.end())
    {
        setId(val.at("id"));
    }
    if(val.find("username") != val.end())
    {
        setUsername(val.at("username"));
        
    }
    if(val.find("firstName") != val.end())
    {
        setFirstName(val.at("firstName"));
        
    }
    if(val.find("lastName") != val.end())
    {
        setLastName(val.at("lastName"));
        
    }
    if(val.find("email") != val.end())
    {
        setEmail(val.at("email"));
        
    }
    if(val.find("password") != val.end())
    {
        setPassword(val.at("password"));
        
    }
    if(val.find("phone") != val.end())
    {
        setPhone(val.at("phone"));
        
    }
    if(val.find("userStatus") != val.end())
    {
        setUserStatus(val.at("userStatus"));
    }
    
}
Ejemplo n.º 28
0
Person::Person(const char* firstName, const char* lastName, const char* taxId) {
    setFirstName(firstName);
    setLastName(lastName);
    setTaxId(taxId);
}
Ejemplo n.º 29
0
TeachingAssistant::TeachingAssistant(QString fName, QString lName, QString uName)
{
    setFirstName(fName);
    setLastName(lName);
    setUsername(uName);
}
Ejemplo n.º 30
0
void JabberContact::deserializeLine(const QString& key, const QString& value)
{

    QString val = value;
    if(val.startsWith('\"') && val.endsWith('\"'))
        val = val.mid(1, val.length() - 2);
    if(key == "ID") {
        setId(val);
    }
    else if(key == "Node") {
        setNode(val);
    }
    else if(key == "Resource") {
        setResource(val);
    }
    else if(key == "Name") {
        setName(val);
    }
    else if(key == "FirstName") {
        setFirstName(val);
    }
    else if(key == "Nick") {
        setNick(val);
    }
    else if(key == "Desc") {
        setDesc(val);
    }
    else if(key == "BirthDay") {
        setBirthday(val);
    }
    else if(key == "Url") {
        setUrl(val);
    }
    else if(key == "OrgName") {
        setOrgName(val);
    }
    else if(key == "OrgUnit") {
        setOrgUnit(val);
    }
    else if(key == "Title") {
        setTitle(val);
    }
    else if(key == "Role") {
        setRole(val);
    }
    else if(key == "Street") {
        setStreet(val);
    }
    else if(key == "ExtAddr") {
        setExtAddr(val);
    }
    else if(key == "City") {
        setCity(val);
    }
    else if(key == "Region") {
        setRegion(val);
    }
    else if(key == "PCode") {
        setPCode(val);
    }
    else if(key == "Country") {
        setCountry(val);
    }
    else if(key == "EMail") {
        setEmail(val);
    }
    else if(key == "Phone") {
        setPhone(val);
    }
    else if(key == "StatusTime") {
        setStatusTime(val.toUInt());
    }
    else if(key == "OnlineTime") {
        setOnlineTime(val.toUInt());
    }
    else if(key == "Subscribe") {
        setSubscribe(val.toUInt());
    }
    else if(key == "Group") {
        setGroup(val);
    }
    else if(key == "PhotoWidth") {
        setPhotoWidth(val.toUInt());
    }
    else if(key == "PhotoHeight") {
        setPhotoHeight(val.toUInt());
    }
    else if(key == "LogoWidth") {
        setLogoWidth(val.toUInt());
    }
    else if(key == "LogoHeight") {
        setLogoHeight(val.toUInt());
    }
    else if(key == "AutoReply") {
        setAutoReply(val);
    }
}