bool WeatherDataModel::readLocation(QString line) { QStringList list = line.split(','); // Require 10 items in the list if(list.size() > 10) { LOG(warning) << "Location: Expected 10 entries, got " << list.size(); } else if(list.size() != 10) { LOG(error) << "Location: Expected 10 entries, got " << list.size(); return false; } setCity(list[1].toStdString()); setStateProvinceRegion(list[2].toStdString()); setCountry(list[3].toStdString()); setSource(list[4].toStdString()); setWMO(list[5].toStdString()); if(!setLatitude(list[6].toStdString())) { LOG(error) << QString("Location: Bad latitude value '%1'").arg(list[6]).toStdString(); return false; } if(!setLongitude(list[7].toStdString())) { LOG(error) << QString("Location: Bad latitude value '%1'").arg(list[7]).toStdString(); return false; } if(!setTimeZone(list[8].toStdString())) { LOG(error) << QString("Location: Bad time zone value '%1'").arg(list[8]).toStdString(); return false; } if(!setElevation(list[9].toStdString())) { LOG(error) << QString("Location: Bad elevation value '%1'").arg(list[9]).toStdString(); return false; } return true; }
/****************************************************************************** * Student() * This default constructor will create a Student object *****************************************************************************/ MathStudent::MathStudent() : Student() { #ifdef TEST cout << "Default Constructor is Called" << endl << endl; #endif setAddress(""); setCity(""); setState(""); setZipCode(0); }
/****************************************************************************** * Student() * This constructor will receive the student's name and id and create a * student object with that info *****************************************************************************/ MathStudent::MathStudent(string studentName, //The Student's Name int studentId) //The Student's ID : Student(studentName, studentId) { #ifdef TEST cout << "Non-default Constructor is Called" << endl << endl; #endif setAddress(""); setCity(""); setState(""); setZipCode(0); }
void QDeclarativeGeoAddress::setAddress(const QGeoAddress& address) { // Elaborate but takes care of emiting needed signals setCountry(address.country()); setCountryCode(address.countryCode()); setState(address.state()); setCounty(address.county()); setCity(address.city()); setDistrict(address.district()); setStreet(address.street()); setPostcode(address.postcode()); m_address = address; }
// 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; }
/****************************************************************************** * MathStudent() * This copy constructor will read in a Math Student Object, and do a deep * copy to the math student object being created *****************************************************************************/ MathStudent::MathStudent(const MathStudent &anotherMathStudent) //Another Math Student { #ifdef TEST cout << "Copy Constructor is Called" << endl << endl; #endif setName(anotherMathStudent.getName()); setID(anotherMathStudent.getID()); setPhoneNumber(anotherMathStudent.getPhoneNumber()); setAge(anotherMathStudent.getAge()); setGender(anotherMathStudent.getGender()); setClassStanding(anotherMathStudent.getClassStanding()); setGPA(anotherMathStudent.getGPA()); setZipCode(anotherMathStudent.getZipCode()); setAddress(anotherMathStudent.address); setCity(anotherMathStudent.city); setState(anotherMathStudent.state); }
void addAddress(Person* c, const QString& key, const QByteArray& fn) { auto addr = Person::Address(); QList<QByteArray> fields = fn.split(VCardUtils::Delimiter::SEPARATOR_TOKEN[0]); QStringList keyFields = key.split(VCardUtils::Delimiter::SEPARATOR_TOKEN); if(keyFields.size() < 2 || fields.size() < 7) { qDebug() << "Malformatted Address"; return; } addr.setType (keyFields[1] ); addr.setAddressLine (QString::fromUtf8(fields[2]) ); addr.setCity (QString::fromUtf8(fields[3]) ); addr.setState (QString::fromUtf8(fields[4]) ); addr.setZipCode (QString::fromUtf8(fields[5]) ); addr.setCountry (QString::fromUtf8(fields[6]) ); c->addAddress(addr); }
int WeatherModel::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { typedef bb::cascades::GroupDataModel QMocSuperClass; _id = QMocSuperClass::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { if (_id < 3) qt_static_metacall(this, _c, _id, _a); _id -= 3; } #ifndef QT_NO_PROPERTIES else if (_c == QMetaObject::ReadProperty) { void *_v = _a[0]; switch (_id) { case 0: *reinterpret_cast< QString*>(_v) = city(); break; } _id -= 1; } else if (_c == QMetaObject::WriteProperty) { void *_v = _a[0]; switch (_id) { case 0: setCity(*reinterpret_cast< QString*>(_v)); break; } _id -= 1; } else if (_c == QMetaObject::ResetProperty) { _id -= 1; } else if (_c == QMetaObject::QueryPropertyDesignable) { _id -= 1; } else if (_c == QMetaObject::QueryPropertyScriptable) { _id -= 1; } else if (_c == QMetaObject::QueryPropertyStored) { _id -= 1; } else if (_c == QMetaObject::QueryPropertyEditable) { _id -= 1; } else if (_c == QMetaObject::QueryPropertyUser) { _id -= 1; } #endif // QT_NO_PROPERTIES return _id; }
/****************************************************************************** * MathStudent() * This constructor will receive a math student's full info and create a math * student object with that info *****************************************************************************/ MathStudent::MathStudent(string studentName, //The Student's Name int studentId, //The Student's ID long long studentPhoneNum,//The Student's Phone Number int studentAge, //The Student's Age char studentGender, //The Student's Gender string studentClass, //The Student's Class Standing double studentGPA, //The Student's GPA char* studentAddress, //The Student's Address char* studentCity, //The Student's City char* studentState, //The Student's State int studentZipCode) //The Student's Zip Code : Student(studentName, studentId, studentPhoneNum, studentAge, studentGender, studentClass, studentGPA) { #ifdef TEST cout << "Non-default Constructor is Called" << endl << endl; #endif setAddress(studentAddress); setCity(studentCity); setState(studentState); setZipCode(studentZipCode); }
/****************************************************************************** * copyFrom() * This method receive a Math Student Object, then copy the info from that * math student object to the Math Student Object call the function *****************************************************************************/ void MathStudent::copyFrom(MathStudent anotherMathStudent) //Another Math Student { #ifdef TEST cout << "Copy From(deep copy) is Called" << endl << endl; #endif setName(anotherMathStudent.getName()); setID(anotherMathStudent.getID()); setPhoneNumber(anotherMathStudent.getPhoneNumber()); setAge(anotherMathStudent.getAge()); setGender(anotherMathStudent.getGender()); setClassStanding(anotherMathStudent.getClassStanding()); setGPA(anotherMathStudent.getGPA()); setZipCode(anotherMathStudent.getZipCode()); delete[] address; delete[] city; delete[] state; setAddress(anotherMathStudent.address); setCity(anotherMathStudent.city); setState(anotherMathStudent.state); }
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); } }
int MSNet::simulate(SUMOTime start, SUMOTime stop) { OptionsCont &oc = OptionsCont::getOptions(); if(oc.getSimulationVerbosity()>1) std::cout<<"----> void MSNet::simulate(...)"<<std::endl; //if((oc.getString("net-file").find("munchen"))|| // (oc.getString("net-file").find("munich"))) if(oc.getSafeBool("ger")) setCity("munchen"); //else if(oc.getString("net-file").find("cambiano")) else if(oc.getSafeBool("ita")) setCity("cambiano"); else setCity("unknown"); // the simulation loop MSNet::SimulationState state = SIMSTATE_RUNNING; myStep = start; #ifndef NO_TRACI #ifdef HAVE_PYTHON if(OptionsCont::getOptions().isSet("python-script")) { traci::TraCIServer::runEmbedded(OptionsCont::getOptions().getString("python-script")); WRITE_MESSAGE("Simulation End: Script ended"); closeSimulation(start); return 0; } #endif #endif // Initialize weather conditions if(oc.isSet("fiet")) setCurrentEnvTemp(oc.getFloat("fiet")); else setCurrentEnvTemp(5.3); if(oc.isSet("fieh")) setCurrentEnvHum(oc.getFloat("fieh")); else setCurrentEnvHum(67.8); while(state == SIMSTATE_RUNNING) { if(myLogStepNumber) preSimStepOutput(); simulationStep(); // FIXME Custom wait //for(int i=0;i++<0x00003fff;)for(int j=0;j++<0x00000fff;); if(oc.getSafeBool("rwc") || oc.getSafeBool("rlwc")) updateWeather(); if(myLogStepNumber) postSimStepOutput(); state = simulationState(stop); #ifndef NO_TRACI if(state != SIMSTATE_RUNNING) { if(OptionsCont::getOptions().getInt("remote-port") != 0 && !traci::TraCIServer::wasClosed()) state = SIMSTATE_RUNNING; } #endif } WRITE_MESSAGE("Simulation End: " + getStateMessage(state)); // exit simulation loop closeSimulation(start); return 0; }