这篇教程C++ weight_sscanf函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中weight_sscanf函数的典型用法代码示例。如果您正苦于以下问题:C++ weight_sscanf函数的具体用法?C++ weight_sscanf怎么用?C++ weight_sscanf使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了weight_sscanf函数的16个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: weight_sscanfvoid ChangeMinDaysSelectivelyForm::ok(){ enum {ANY=0, YES=1, NO=2}; enum {NOCHANGE=0}; oldWeight=oldDays=oldConsecutive=oldNActs=-2; newWeight=newDays=newConsecutive=-2; QString oldWeightS=oldWeightLineEdit->text(); weight_sscanf(oldWeightS, "%lf", &oldWeight); if(!(oldWeight==-1 || (oldWeight>=0.0 && oldWeight<=100.0))){ QMessageBox::warning(this, tr("FET warning"), tr("Old weight must be -1 or both >=0 and <=100")); return; } QString newWeightS=newWeightLineEdit->text(); weight_sscanf(newWeightS, "%lf", &newWeight); if(!(newWeight==-1 || (newWeight>=0.0 && newWeight<=100.0))){ QMessageBox::warning(this, tr("FET warning"), tr("New weight must be -1 or both >=0 and <=100")); return; } oldDays=oldDaysSpinBox->value(); if(!(oldDays==-1 || (oldDays>=1 && oldDays<=gt.rules.nDaysPerWeek))){ QMessageBox::warning(this, tr("FET warning"), tr("Old min days must be -1 or both >=1 and <=n_days_per_week")); return; } newDays=newDaysSpinBox->value(); if(!(newDays==-1 || (newDays>=1 && newDays<=gt.rules.nDaysPerWeek))){ QMessageBox::warning(this, tr("FET warning"), tr("New min days must be -1 or both >=1 and <=n_days_per_week")); return; } oldConsecutive=oldConsecutiveComboBox->currentIndex(); assert(oldConsecutive>=0 && oldConsecutive<=2); newConsecutive=newConsecutiveComboBox->currentIndex(); assert(newConsecutive>=0 && newConsecutive<=2); oldNActs=oldNActsSpinBox->value(); if(!(oldNActs==-1 || oldNActs>=1)){ QMessageBox::warning(this, tr("FET warning"), tr("Old n_acts must be -1 or >=1")); return; } this->accept();}
开发者ID:RaminNietzsche,项目名称:POSFET,代码行数:48,
示例2: weight_sscanfvoid AddConstraintStudentsSetMinGapsBetweenBuildingChangesForm::addCurrentConstraint(){ SpaceConstraint *ctr=NULL; double weight; QString tmp=weightLineEdit->text(); weight_sscanf(tmp, "%lf", &weight); if(weight<100.0 || weight>100.0){ QMessageBox::warning(this, tr("FET information"), tr("Invalid weight (percentage). It has to be 100")); return; } QString students_name=studentsComboBox->currentText(); StudentsSet* s=gt.rules.searchStudentsSet(students_name); if(s==NULL){ QMessageBox::warning(this, tr("FET information"), tr("Invalid students set")); return; } ctr=new ConstraintStudentsSetMinGapsBetweenBuildingChanges(weight, students_name, minGapsSpinBox->value()); bool tmp2=gt.rules.addSpaceConstraint(ctr); if(tmp2) LongTextMessageBox::information(this, tr("FET information"), tr("Constraint added:")+"/n/n"+ctr->getDetailedDescription(gt.rules)); else{ QMessageBox::warning(this, tr("FET information"), tr("Constraint NOT added - please report error")); delete ctr; }}
开发者ID:RaminNietzsche,项目名称:POSFET,代码行数:33,
示例3: weight_sscanfvoid ModifyConstraintStudentsSetHomeRoomForm::ok(){ double weight; QString tmp=weightLineEdit->text(); weight_sscanf(tmp, "%lf", &weight); if(weight<0.0 || weight>100){ QMessageBox::warning(this, tr("FET information"), tr("Invalid weight")); return; } QString students=studentsComboBox->currentText(); assert(gt.rules.searchStudentsSet(students)!=NULL); int i=roomsComboBox->currentIndex(); if(i<0 || roomsComboBox->count()<=0){ QMessageBox::warning(this, tr("FET information"), tr("Invalid room")); return; } QString room=roomsComboBox->currentText(); this->_ctr->weightPercentage=weight; this->_ctr->roomName=room; this->_ctr->studentsName=students; gt.rules.internalStructureComputed=false; setRulesModifiedAndOtherThings(>.rules); this->close();}
开发者ID:RaminNietzsche,项目名称:POSFET,代码行数:31,
示例4: weight_sscanfvoid AddConstraintTeachersMinDaysPerWeekForm::addCurrentConstraint(){ TimeConstraint *ctr=NULL; double weight; QString tmp=weightLineEdit->text(); weight_sscanf(tmp, "%lf", &weight); if(weight<0.0 || weight>100.0){ QMessageBox::warning(this, tr("FET information"), tr("Invalid weight (percentage)")); return; } if(weight!=100.0){ QMessageBox::warning(this, tr("FET information"), tr("Invalid weight (percentage) - it has to be 100%")); return; } int min_days=minDaysSpinBox->value(); ctr=new ConstraintTeachersMinDaysPerWeek(weight, min_days); bool tmp2=gt.rules.addTimeConstraint(ctr); if(tmp2) LongTextMessageBox::information(this, tr("FET information"), tr("Constraint added:")+"/n/n"+ctr->getDetailedDescription(gt.rules)); else{ QMessageBox::warning(this, tr("FET information"), tr("Constraint NOT added - please report error")); delete ctr; }}
开发者ID:karandit,项目名称:fet,代码行数:32,
示例5: weight_sscanfvoid AddConstraintStudentsSetMaxHoursDailyForm::addCurrentConstraint(){ TimeConstraint *ctr=NULL; double weight; QString tmp=weightLineEdit->text(); weight_sscanf(tmp, "%lf", &weight); if(weight<0.0 || weight>100.0){ QMessageBox::warning(this, tr("FET information"), tr("Invalid weight")); return; } int maxHours=maxHoursSpinBox->value(); QString students_name=studentsComboBox->currentText(); StudentsSet* s=gt.rules.searchStudentsSet(students_name); if(s==NULL){ QMessageBox::warning(this, tr("FET information"), tr("Invalid students set")); return; } ctr=new ConstraintStudentsSetMaxHoursDaily(weight, maxHours, students_name); bool tmp2=gt.rules.addTimeConstraint(ctr); if(tmp2) LongTextMessageBox::information(this, tr("FET information"), tr("Constraint added:")+"/n/n"+ctr->getDetailedDescription(gt.rules)); else{ QMessageBox::warning(this, tr("FET information"), tr("Constraint NOT added - please report error")); delete ctr; }}
开发者ID:vanyog,项目名称:FET,代码行数:35,
示例6: weight_sscanfvoid ModifyConstraintStudentsSetMaxGapsPerDayForm::ok(){ double weight; QString tmp=weightLineEdit->text(); weight_sscanf(tmp, "%lf", &weight); if(weight<0.0 || weight>100.0){ QMessageBox::warning(this, tr("FET information"), tr("Invalid weight (percentage)")); return; } if(weight!=100.0){ QMessageBox::warning(this, tr("FET information"), tr("Invalid weight (percentage) - it must be 100%")); return; } QString students_name=studentsComboBox->currentText(); StudentsSet* s=gt.rules.searchStudentsSet(students_name); if(s==NULL){ QMessageBox::warning(this, tr("FET information"), tr("Invalid students set")); return; } this->_ctr->weightPercentage=weight; this->_ctr->maxGaps=maxGapsSpinBox->value(); this->_ctr->students=students_name; gt.rules.internalStructureComputed=false; setRulesModifiedAndOtherThings(>.rules); this->close();}
开发者ID:RaminNietzsche,项目名称:POSFET,代码行数:33,
示例7: weight_sscanfvoid ModifyConstraintStudentsMaxDaysPerWeekForm::ok(){ double weight; QString tmp=weightLineEdit->text(); weight_sscanf(tmp, "%lf", &weight); if(weight<0.0 || weight>100.0){ QMessageBox::warning(this, tr("FET information"), tr("Invalid weight (percentage)")); return; } if(weight!=100.0){ QMessageBox::warning(this, tr("FET information"), tr("Invalid weight (percentage) - it has to be 100%")); return; } int max_days=maxDaysSpinBox->value(); this->_ctr->weightPercentage=weight; this->_ctr->maxDaysPerWeek=max_days; gt.rules.internalStructureComputed=false; setRulesModifiedAndOtherThings(>.rules); this->close();}
开发者ID:karandit,项目名称:fet,代码行数:26,
示例8: weight_sscanfvoid AddConstraintTeachersActivityTagMaxHoursDailyForm::addCurrentConstraint(){ TimeConstraint *ctr=NULL; double weight; QString tmp=weightLineEdit->text(); weight_sscanf(tmp, "%lf", &weight); if(weight<0.0 || weight>100.0){ QMessageBox::warning(this, tr("FET warning"), tr("Invalid weight (percentage)")); return; } QString activityTagName=activityTagsComboBox->currentText(); int activityTagIndex=gt.rules.searchActivityTag(activityTagName); if(activityTagIndex<0){ QMessageBox::warning(this, tr("FET warning"), tr("Invalid activity tag")); return; } int max_hours=maxHoursSpinBox->value(); ctr=new ConstraintTeachersActivityTagMaxHoursDaily(weight, max_hours, activityTagName); bool tmp2=gt.rules.addTimeConstraint(ctr); if(tmp2) LongTextMessageBox::information(this, tr("FET information"), tr("Constraint added:")+"/n/n"+ctr->getDetailedDescription(gt.rules)); else{ QMessageBox::warning(this, tr("FET information"), tr("Constraint NOT added - please report error")); delete ctr; }}
开发者ID:karandit,项目名称:fet,代码行数:35,
示例9: weight_sscanfvoid AddConstraintTeacherIntervalMaxDaysPerWeekForm::addCurrentConstraint(){ TimeConstraint *ctr=NULL; double weight; QString tmp=weightLineEdit->text(); weight_sscanf(tmp, "%lf", &weight); if(weight<0.0 || weight>100.0){ QMessageBox::warning(this, tr("FET information"), tr("Invalid weight (percentage)")); return; } if(weight!=100.0){ QMessageBox::warning(this, tr("FET information"), tr("Invalid weight (percentage) - it has to be 100%")); return; } int max_days=maxDaysSpinBox->value(); QString teacher_name=teachersComboBox->currentText(); int teacher_ID=gt.rules.searchTeacher(teacher_name); if(teacher_ID<0){ QMessageBox::warning(this, tr("FET information"), tr("Invalid teacher")); return; } int startHour=startHourComboBox->currentIndex(); int endHour=endHourComboBox->currentIndex(); if(startHour<0 || startHour>=gt.rules.nHoursPerDay){ QMessageBox::warning(this, tr("FET information"), tr("Start hour invalid")); return; } if(endHour<0 || endHour>gt.rules.nHoursPerDay){ QMessageBox::warning(this, tr("FET information"), tr("End hour invalid")); return; } if(endHour<=startHour){ QMessageBox::warning(this, tr("FET information"), tr("Start hour cannot be greater or equal than end hour")); return; } ctr=new ConstraintTeacherIntervalMaxDaysPerWeek(weight, max_days, teacher_name, startHour, endHour); bool tmp2=gt.rules.addTimeConstraint(ctr); if(tmp2) LongTextMessageBox::information(this, tr("FET information"), tr("Constraint added:")+"/n/n"+ctr->getDetailedDescription(gt.rules)); else{ QMessageBox::warning(this, tr("FET information"), tr("Constraint NOT added - please report error")); delete ctr; }}
开发者ID:karandit,项目名称:fet,代码行数:58,
示例10: weight_sscanfvoid AddConstraintSubjectActivityTagPreferredRoomsForm::addConstraint(){ SpaceConstraint *ctr=NULL; double weight; QString tmp=weightLineEdit->text(); weight_sscanf(tmp, "%lf", &weight); if(weight<0.0 || weight>100){ QMessageBox::warning(this, tr("FET information"), tr("Invalid weight")); return; } if(selectedRoomsListWidget->count()==0){ QMessageBox::warning(this, tr("FET information"), tr("Empty list of selected rooms")); return; } if(selectedRoomsListWidget->count()==1){ QMessageBox::warning(this, tr("FET information"), tr("Only one selected room - please use constraint subject activity tag preferred room if you want a single room")); return; } if(subjectsComboBox->currentIndex()<0 || subjectsComboBox->count()<=0){ QMessageBox::warning(this, tr("FET information"), tr("Invalid selected subject")); return; } QString subject=subjectsComboBox->currentText(); if(activityTagsComboBox->currentIndex()<0 || activityTagsComboBox->count()<=0){ QMessageBox::warning(this, tr("FET information"), tr("Invalid selected activity tag")); return; } QString activityTag=activityTagsComboBox->currentText(); QStringList roomsList; for(int i=0; i<selectedRoomsListWidget->count(); i++) roomsList.append(selectedRoomsListWidget->item(i)->text()); ctr=new ConstraintSubjectActivityTagPreferredRooms(weight, subject, activityTag, roomsList); bool tmp2=gt.rules.addSpaceConstraint(ctr); if(tmp2){ QString s=tr("Constraint added:"); s+="/n/n"; s+=ctr->getDetailedDescription(gt.rules); LongTextMessageBox::information(this, tr("FET information"), s); } else{ QMessageBox::warning(this, tr("FET information"), tr("Constraint NOT added - please report error")); delete ctr; }}
开发者ID:RaminNietzsche,项目名称:POSFET,代码行数:57,
示例11: weight_sscanfvoid AddConstraintTwoActivitiesOrderedForm::addCurrentConstraint(){ TimeConstraint *ctr=NULL; double weight; QString tmp=weightLineEdit->text(); weight_sscanf(tmp, "%lf", &weight); if(weight<0.0 || weight>100.0){ QMessageBox::warning(this, tr("FET information"), tr("Invalid weight (percentage)")); return; } int fid; int tmp2=firstActivitiesComboBox->currentIndex(); assert(tmp2<gt.rules.activitiesList.size()); assert(tmp2<firstActivitiesList.size()); if(tmp2<0){ QMessageBox::warning(this, tr("FET information"), tr("Invalid activity")); return; } else fid=firstActivitiesList.at(tmp2); int sid; int tmp3=secondActivitiesComboBox->currentIndex(); assert(tmp3<gt.rules.activitiesList.size()); assert(tmp3<secondActivitiesList.size()); if(tmp3<0){ QMessageBox::warning(this, tr("FET information"), tr("Invalid activity")); return; } else sid=secondActivitiesList.at(tmp3); if(sid==fid){ QMessageBox::warning(this, tr("FET information"), tr("Same activities - impossible")); return; } ctr=new ConstraintTwoActivitiesOrdered(weight, fid, sid); bool tmp4=gt.rules.addTimeConstraint(ctr); if(tmp4) LongTextMessageBox::information(this, tr("FET information"), tr("Constraint added:")+"/n/n"+ctr->getDetailedDescription(gt.rules)); else{ QMessageBox::warning(this, tr("FET information"), tr("Constraint NOT added - error?")); delete ctr; }}
开发者ID:RaminNietzsche,项目名称:POSFET,代码行数:55,
示例12: weight_sscanfvoid ModifyConstraintActivitiesMaxSimultaneousInSelectedTimeSlotsForm::ok(){ double weight; QString tmp=weightLineEdit->text(); weight_sscanf(tmp, "%lf", &weight); if(weight<100.0 || weight>100.0){ QMessageBox::warning(this, tr("FET information"), tr("Invalid weight (percentage). It has to be 100")); return; } this->_ctr->weightPercentage=weight; QList<int> days; QList<int> hours; for(int j=0; j<gt.rules.nDaysPerWeek; j++) for(int i=0; i<gt.rules.nHoursPerDay; i++) if(selectedTimesTable->item(i, j)->text()==YES){ days.append(j); hours.append(i); } this->_ctr->selectedDays=days; this->_ctr->selectedHours=hours; int maxSimultaneous=maxSimultaneousSpinBox->value(); if(maxSimultaneous==0){ QMessageBox::warning(this, tr("FET information"), tr("You specified max simultaneous activities to be 0. This is " "not perfect from efficiency point of view, because you can use instead constraint activity(ies) preferred time slots, " "and help FET to find a timetable easier and faster, with an equivalent result. Please correct.")); return; } this->_ctr->maxSimultaneous=maxSimultaneous; if(this->selectedActivitiesList.count()==0){ QMessageBox::warning(this, tr("FET information"), tr("Empty list of activities")); return; } //we allow even only one activity /*if(this->selectedActivitiesList.count()==1){ QMessageBox::warning(this, tr("FET information"), tr("Only one selected activity")); return; }*/ this->_ctr->activitiesIds=selectedActivitiesList; gt.rules.internalStructureComputed=false; setRulesModifiedAndOtherThings(>.rules); this->close();}
开发者ID:karandit,项目名称:fet,代码行数:54,
示例13: weight_sscanfvoid AddConstraintActivityPreferredStartingTimeForm::addCurrentConstraint(){ TimeConstraint *ctr=NULL; double weight; QString tmp=weightLineEdit->text(); weight_sscanf(tmp, "%lf", &weight); if(weight<0.0 || weight>100.0){ QMessageBox::warning(this, tr("FET information"), tr("Invalid weight (percentage)")); return; } int day=dayComboBox->currentIndex(); if(day<0 || day>=gt.rules.nDaysPerWeek){ QMessageBox::warning(this, tr("FET information"), tr("Invalid day")); return; } int startHour=startHourComboBox->currentIndex(); if(startHour<0 || startHour>=gt.rules.nHoursPerDay){ QMessageBox::warning(this, tr("FET information"), tr("Invalid start hour")); return; } int id; int tmp2=activitiesComboBox->currentIndex(); assert(tmp2<gt.rules.activitiesList.size()); assert(tmp2<activitiesList.size()); if(tmp2<0){ QMessageBox::warning(this, tr("FET information"), tr("Invalid activity")); return; } else id=activitiesList.at(tmp2); ctr=new ConstraintActivityPreferredStartingTime(weight, id, day, startHour, permLockedCheckBox->isChecked()); bool tmp3=gt.rules.addTimeConstraint(ctr); if(tmp3){ LongTextMessageBox::information(this, tr("FET information"), tr("Constraint added:")+"/n/n"+ctr->getDetailedDescription(gt.rules)); LockUnlock::computeLockedUnlockedActivitiesOnlyTime(); LockUnlock::increaseCommunicationSpinBox(); } else{ QMessageBox::warning(this, tr("FET information"), tr("Constraint NOT added - duplicate")); delete ctr; }}
开发者ID:RaminNietzsche,项目名称:POSFET,代码行数:54,
示例14: weight_sscanfvoid AddConstraintActivityPreferredRoomsForm::addConstraint(){ SpaceConstraint *ctr=NULL; double weight; QString tmp=weightLineEdit->text(); weight_sscanf(tmp, "%lf", &weight); if(weight<0.0 || weight>100){ QMessageBox::warning(this, tr("FET information"), tr("Invalid weight (percentage)")); return; } if(selectedRoomsListWidget->count()==0){ QMessageBox::warning(this, tr("FET information"), tr("Empty list of selected rooms")); return; } if(selectedRoomsListWidget->count()==1){ QMessageBox::warning(this, tr("FET information"), tr("Only one selected room - please use constraint activity preferred room if you want a single room")); return; } int id; int tmp2=activitiesComboBox->currentIndex(); if(tmp2<0 || tmp2>=gt.rules.activitiesList.size() || tmp2>=activitiesList.size()){ QMessageBox::warning(this, tr("FET information"), tr("Invalid activity")); return; } else id=activitiesList.at(tmp2); QStringList roomsList; for(int i=0; i<selectedRoomsListWidget->count(); i++) roomsList.append(selectedRoomsListWidget->item(i)->text()); ctr=new ConstraintActivityPreferredRooms(weight, id, roomsList); bool tmp3=gt.rules.addSpaceConstraint(ctr); if(tmp3){ QString s=tr("Constraint added:"); s+="/n/n"; s+=ctr->getDetailedDescription(gt.rules); LongTextMessageBox::information(this, tr("FET information"), s); } else{ QMessageBox::warning(this, tr("FET information"), tr("Constraint NOT added - please report error")); delete ctr; }}
开发者ID:RaminNietzsche,项目名称:POSFET,代码行数:53,
示例15: weight_sscanfvoid SecondMinDaysDialog::yesPressed(){ double wt; QString tmp=percText->text(); weight_sscanf(tmp, "%lf", &wt); if(wt<0.0 || wt>100.0){ QMessageBox::warning(this, tr("FET information"), tr("Invalid weight (percentage) - must be >=0 and <=100.0")); return; } weight=wt; accept();}
开发者ID:vanyog,项目名称:FET,代码行数:13,
示例16: weight_sscanfvoid AddConstraintStudentsSetMinHoursDailyForm::addCurrentConstraint(){ TimeConstraint *ctr=NULL; double weight; QString tmp=weightLineEdit->text(); weight_sscanf(tmp, "%lf", &weight); if(weight<0.0 || weight>100.0){ QMessageBox::warning(this, tr("FET information"), tr("Invalid weight")); return; } if(weight!=100.0){ QMessageBox::warning(this, tr("FET information"), tr("Invalid weight - it has to be 100%")); return; } if(!ENABLE_STUDENTS_MIN_HOURS_DAILY_WITH_ALLOW_EMPTY_DAYS && allowEmptyDaysCheckBox->isChecked()){ QMessageBox::warning(this, tr("FET warning"), tr("Empty days for students min hours daily constraints are not enabled. You must enable them from the Settings->Advanced menu.")); return; } if(allowEmptyDaysCheckBox->isChecked() && minHoursSpinBox->value()<2){ QMessageBox::warning(this, tr("FET warning"), tr("If you allow empty days, the min hours must be at least 2 (to make it a non-trivial constraint)")); return; } int minHours=minHoursSpinBox->value(); QString students_name=studentsComboBox->currentText(); StudentsSet* s=gt.rules.searchStudentsSet(students_name); if(s==NULL){ QMessageBox::warning(this, tr("FET information"), tr("Invalid students set")); return; } ctr=new ConstraintStudentsSetMinHoursDaily(weight, minHours, students_name, allowEmptyDaysCheckBox->isChecked()); bool tmp2=gt.rules.addTimeConstraint(ctr); if(tmp2) LongTextMessageBox::information(this, tr("FET information"), tr("Constraint added:")+"/n/n"+ctr->getDetailedDescription(gt.rules)); else{ QMessageBox::warning(this, tr("FET information"), tr("Constraint NOT added - please report error")); delete ctr; }}
开发者ID:karandit,项目名称:fet,代码行数:50,
注:本文中的weight_sscanf函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ weights函数代码示例 C++ weekday函数代码示例 |